You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Device: a lane runs up to 4096 steps on HEAP_OFF after a failed allocation (page faults on AMD) #1924
When heap_alloc_miss cannot bump a page, it posts ERR_HEAP and returns HEAP_OFF, the reserved first heap page, which every failing lane then shares. A lane reads the error word only through err_spun, every 4096 steps: the main loop has polled at 4096 since c7276c3, and 85ecb69 made 4095 the one mask. Until then the lane keeps stepping on nodes that other failing lanes overwrite, reads one shape as another, and can follow a word that was never a location.
HIP (the hip branch; RX 6600M, ROCm 7.2.4): bench/runtime/tree-radix at the default 1 GB span ends in Memory access fault by GPU node-1 ... Page not present, at an address about 34 GB past the corpus, instead of bend: out of memory. Polling on every step makes it report out of memory on every run, so the window is the cause.
CUDA: same path. A stray load outside the managed corpus is an illegal address, so the run would end in bend: device fault. It is rarer, since the span is the whole card. Untested.
Metal: same window. tree-radix at --gpu 1GB on an M-series reports out of memory cleanly, so either the GPU tolerated the loads or that run did not take the path. Untested beyond that one run.
Fix on the hip branch (1878aae): err_post sets a plain __shared__ flag (BEND_RTC only) that err_spun reads every step, so a lane stops at its next step after it posts. On HIP it costs nothing measurable (gameoflife 105 vs 109 ms). A per-step read of the global error word cost 24x, and a volatile shared flag 10x. Metal would need the flag passed down as threadgroup memory, since MSL has no file-scope threadgroup variables.
#1820's WL_NSPIN does not go through err_spun, so with both, its inner loop needs the flag too.
I got the same window on Metal: a valid full pool posts ERR_HEAP and returns HEAP_OFF, but the next poll still says 0.
Working branch gives each device lane a private u32 latch. Host Env stays 16 bytes. Keeping the poll as a macro matters; I dropped the slower helper-function version.
The real allocator test now goes from 4 to 0. Metal run and receipts. Five paired samples, 8 bangs after warmup per sample, IO.now milliseconds (host scheduling/printing included):
Consumer
main
latch
Scalar loop
1070
1066
Fork tree
216
217
Still holding off on a PR: comp.ts is 66053/66000, so it needs actual headroom from #1922 first. No cap changes or comment shaving. This was an Apple Paravirtual device; CUDA/HIP and a physical M4 are not tested.
Activity
oxura commentedon Oct 29, 2026
I got the same window on Metal: a valid full pool posts ERR_HEAP and returns HEAP_OFF, but the next poll still says 0.
Working branch gives each device lane a private u32 latch. Host Env stays 16 bytes. Keeping the poll as a macro matters; I dropped the slower helper-function version.
The real allocator test now goes from 4 to 0. Metal run and receipts. Five paired samples, 8 bangs after warmup per sample, IO.now milliseconds (host scheduling/printing included):
Still holding off on a PR: comp.ts is 66053/66000, so it needs actual headroom from #1922 first. No cap changes or comment shaving. This was an Apple Paravirtual device; CUDA/HIP and a physical M4 are not tested.
fix(runtime): a device lane that misses the heap stops at its next st…