aql: the stall watchdog is progress-aware; the DMA lane's ring completion is fenced

Main's stall watchdog samples only the queues' read indices, and the DMA
lane trusts the SDMA queue's written-back read pointer for its room check.
Both stall wrongly: a drive-paced prefill parks every queue for seconds
(one rank spins at the all-reduce while the other reads its layer off the
drive -- spurious dumps), and the SDMA engine's written-back read pointer
can stop moving while the engine runs on -- a full ring then waits forever,
wedging the startup pool fill above ~32 GiB/rank.

pread_exact counts the bytes it returns (rad::dio_progress); every O_DIRECT
read funnels through it, and read_progress adds that to the queues' read
indices: a wait that moves nothing anywhere is a hang however slow the
drives are, so the threshold is a flat 5 s and every stall report is
genuine. The main DMA lane names its lists the way the xp queue already
does -- each list ends by writing its number to a word the engine keeps
advancing (fin/ends) -- and dma_read takes the further of that fence and
the read pointer, so the room check can no longer mistake a stalled
writeback for a stalled engine. dump_dma_lanes reports the finished-list
count.

Verified on the wedge reproducer: GLM startup with a 36000 MiB pool fill,
decode with promotions, and a 13300-word drive-paced prefill -- zero
spurious dumps, the ring live throughout.

Assisted-by: GLM-5.3-Flash
This commit is contained in:
overchop authored and StillDeadcode committed 2026-10-30 15:02:09 +01:00
1 parent 74e7fddd79
commit 6f6b5c3f78
3 files changed
+60 -16

No files matched your search

+7
View File
@@ -11,10 +11,17 @@
* (rad_format.h), so every mover read takes the unbounced path. The bounce is for other callers.
*/
#pragma once
#include <atomic>
#include <cstdint>
namespace rad {
/* Bytes the drive has returned through this reader, monotonically. The stall
* watchdog (aql.cpp) counts this alongside the queues' read indices: a host wait
* that moves nothing anywhere -- no queue advanced, no read came back -- is the
* only one that reports a stall. */
inline std::atomic<uint64_t> dio_progress{0};
enum {
RAD_DIO_READ = 1,
RAD_DIO_WRITE = 2, /* implies read: a partial block is a read-modify-write */