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

+3 -1
View File
@@ -40,7 +40,9 @@ int64_t pread_some(int fd, void* dst, int64_t bytes, int64_t off) {
int pread_exact(int fd, void* dst, int64_t bytes, int64_t off) {
const int64_t got = pread_some(fd, dst, bytes, off);
if (got < 0) return (int)got;
return got == bytes ? RAD_OK : RAD_E_IO;
if (got != bytes) return RAD_E_IO;
dio_progress.fetch_add((uint64_t)bytes, std::memory_order_relaxed);
return RAD_OK;
}
int pwrite_exact(int fd, const void* src, int64_t bytes, int64_t off) {