Repository navigation
Description
Follow-up to #669, measured on the fork tip 1d32c22609d (which carries #169 = 2cbf8afb16c and #170 = this lane's loader fix).
Reported on the engine tracker because the fork (1bit-MONSTER/llama.cpp) has issues disabled; the code is in the fork's ggml-hrx + the CPU backend.
At 1d32c22609d (this fork tip, i.e. with #169's host-weight residency cache), a DeepSeek-V4.1 model on HRX0 loads —
and then SIGSEGVs in the CPU backend's SET_ROWS on the first decode, if the residency budget is set. Without the
budget it fails loudly instead (RESOURCE_EXHAUSTED on materialize host weight value 3). Both are reported here because
they are the two halves of the same new code path; the memory wall they were added to fix is genuinely gone.
The good part, first: engine #669's memory behaviour is fixed
Same file, same flags, three days apart (-dev HRX0, -ngl 8, 217 GiB gguf):
| GTT | MemAvailable floor |
outcome | |
|---|---|---|---|
2026-10-30 (4a58da9b0) |
113 GiB (from 33) | 5 GiB | watchdog SIGKILL during load |
2026-11-01 (1d32c22609d) |
32.5 GiB (unchanged baseline) | 36-41 GiB | loads, then the faults below |
So the pinning is gone and -ngl 8 now fits where -ngl 0 did not. This issue is only about what happens next.
Symptom 1 — SIGSEGV in ggml_compute_forward_set_rows (budget set)
GGML_HRX_HOST_WEIGHT_LIMIT_MB=16384 GGML_HRX_HOST_WEIGHT_TRACE=1 \
llama-cli -m UD-IQ1_S-00001-of-00005.gguf -dev HRX0 -fit off -ngl 8 -c 2048 -p hi -n 2
Thread 12 "llama-cli" received signal SIGSEGV, Segmentation fault.
__memcpy_avx512_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:289
#0 __memcpy_avx512_unaligned_erms ()
#1 ggml_compute_forward_set_rows () from libggml-cpu.so
#2 ggml_graph_compute_thread () from libggml-cpu.so
#3 ggml_graph_compute () from libggml-cpu.so
#4 ggml_backend_cpu_graph_compute () from libggml-cpu.so
#5 ggml_backend_sched_graph_compute_async () from libggml-base.so
#6 llama_context::graph_compute (ggml_cgraph*, bool)
#7 llama_context::process_ubatch (...)
#8 llama_context::decode (...)
#9 llama_decode (...)
dmesg: segfault at 1a280 ip ... error 6 in libc.so.6 — a write through a bad pointer.
Why I think it is the residency cache rather than a plain SET_ROWS shape bug:
-dev none(same file, same head,SET_ROWSruns on the CPU exactly as here) runs to completion and answers
The capital of France is Paris.— so the CPU kernel alone is fine at these shapes.-dev HRX0withoutGGML_HRX_HOST_WEIGHT_LIMIT_MBdoes not crash (it fails with symptom 2 instead).-dev HRX0with the budget crashes deterministically (2 for 2, at different RSS as the box freed memory).
That pattern — only when HRX holds host-visible tensors and the cache may evict — matches aSET_ROWSwhose dst/src
points into a residency slot that was evicted while the CPU-scheduled op still held the pointer.SET_ROWSis one of the
ops that stays on the CPU in this model's placement (SET_ROWS x 50in the placement report), so it is exactly the kind of
op that touches an HRX-visible host buffer from the CPU side.
Symptom 2 — RESOURCE_EXHAUSTED on materialization (budget unset)
Same command, no budget:
1:00.593 E graph_compute: allocate host memory device buffer: .../slab_provider.c:663: RESOURCE_EXHAUSTED;
[hsa_amd_memory_pool_allocate] HSA_STATUS_ERROR_OUT_OF_RESOURCES
1:00.593 E graph_compute: also: materialize host weight value 3 failed
1:00.657 E ggml_backend_sched_graph_compute_async failed with error -1
1:00.594 E llama_decode: failed to decode, ret = -3
while the same process printed, at start:
HRX0 guardrail: GTT total 120.0 GiB, in use 32.2 GiB, ceiling 104.0 GiB (reserve 16.0 GiB), pool budget 71.8 GiB
i.e. the guardrail believes ~72 GiB of pool budget is free and the materialization still cannot get a pool allocation. The
two accounting paths disagree; whichever one is right, the failure is on the first ubatch, at weight value 3, with
-ngl 8.
What I would find most useful
- Whether the eviction path is allowed to release a slot that a CPU-scheduled op is still pointing at (the
SET_ROWS
crash would go away if a lease held by a prepared CPU op pins the slot). - Which allocator
RESOURCE_EXHAUSTEDcame from — the residency arena (serve: --moe-slots auto, --moe-prefetch (off by default) #169'shost_weights) or the model-buffer pool —
because the guardrail'spool budget 71.8 GiBsays the latter should have had room.
Reproducer notes
HSA_USE_SVM=0 HSA_USERPTR_FOR_PAGED_MEM=0 HRX_ALLOW_NO_SVM=1(the only fault-free mode on this box since hrx: gfxhub permission page faults (UTCL2 client CPF) on the rebuilt box with the TheRock nightly libhsa — the no-SVM env trio is the only fault-free arm #715), gfx1151,
IREE/HSA from/opt/rocm-therock.- Runs were inside
systemd-run -p MemoryMax=80Gwith a watchdog that kills atMemAvailable < 6 GiB; the box never went
below 36 GiB available in any of them, so this is not an OOM artefact. -fit offthroughout (HRX0 reports 120 GiB and-fit onwill plan past real RAM on this UMA APU).- Model:
unsloth/DeepSeek-V4.1-Flash-1017-GGUFUD-IQ1_S, 217 GiB, 5 shards, all sha256-verified; archdeepseek41
(384 experts / 6 used, hc 4, indexer 32x128, DSA top-k 512, and a 103 GiB Engram table that must stay mmap-lazy).
Activity
bong-water-water-bong commentedon Nov 1, 2026
Correction after two more runs: the SIGSEGV is intermittent, and the common failure is the materialization, not the crash.
Third run with the same budget (
-ngl 8,GGML_HRX_HOST_WEIGHT_LIMIT_MB=16384) but a 16-token ubatch(
-c 512 -b 16 -ub 16 -v) did not segfault. It failed the same way the unbudgeted run did:So the score is 2 segfaults out of 3 runs with the budget set, and 1 clean
ret = -3, and every failed run stops on thefirst ubatch. Please read the crash as one manifestation of the materialization failure rather than as a separate bug:
whichever way it goes,
materialize host weight value Nis where the graph dies.Useful numbers from that run for whoever picks this up (they are the first successful V4.1 loader report on HRX since #669):
Two placement facts visible here that matter for the next step beyond this issue: Flash Attention is still
not supportedfor this shape (64 q heads x 512-dim K, sliding window 128), so every attention stays on the CPU; and thefused HC ops are declined because layer 0 is on the CPU while the op is on HRX0 — the same "fused op and its layer must
share a device" rule that bit us before full offload was possible.
bong-water-water-bong commentedon Nov 1, 2026
Triage:
bug+hrx; owner pi-i669 (this is #669's new code path — #169 merged at the pin1d32c22609dand this is what it does next). Cross-linked to #669; no separate memory issue is needed, since the memory half is now measured fixed here.Read this as progress on #669, not a regression. Your table is the proof the wall is gone: same file,
-dev HRX0 -ngl 8, 217 GiB gguf —4a58da9b0pinned 113 GiB GTT off a 33 GiB baseline with aMemAvailablefloor of 5 GiB and a watchdog SIGKILL, versus1d32c22609dat 32.5 GiB (baseline unchanged) and a 36–41 GiB floor.-ngl 8now fits where-ngl 0did not.Two symptoms, one suspect. Budget on → SIGSEGV inside
ggml_compute_forward_set_rows(__memcpy_avx512…, i.e. the CPU backend's merge/gather path) on the first decode; budget off → a cleanRESOURCE_EXHAUSTEDonmaterialize host weight value 3. Both are on the new residency path, so the question is whether the cache hands the CPU backend a host pointer whose lifetime ended — #169's weak leases are the named mechanism for exactly that. The discriminating run is one line, not a bisect: the same command at a small model that also lands weights on the host (does it need the 217 GiB file at all?). If a small model segfaults too, it is the lease/lifetime; if only the multi-file V4.1 shard does, it is the materialise-by-shard path.Any rerun:
-dev HRX0needs the no-SVM trio (HSA_USE_SVM=0 HSA_USERPTR_FOR_PAGED_MEM=0 HRX_ALLOW_NO_SVM=1, #715), and a 217 GiB load goes undersystemd-run --user -p MemoryMax=, alone.bong-water-water-bong commentedon Nov 1, 2026
Took #788: reproduced on 0.6B/4B, two defects found and fixed, one structural limit stated plainly — PR llama.cpp#172
Everything below is on this box,
gpu-hold, no-SVM trio,-fit off -ngl 0 --temp 0, 8 tokens,-vso the INFO-levelGGML_HRX_HOST_WEIGHT_TRACEis visible (that trace being invisible without-vis why earlier sessions sawhit=0and no explanation).
The discriminating run the triage asked for
Small models reproduce the materialisation half, not the SIGSEGV:
Qwen3-0.6BandQwen3-4Bwith a budget givegarbage /
Compute error/ NaN logits + SIGABRT, deterministically. No segfault on either, so the CPUSET_ROWScrash is V4.1-specific - but it is the same code path.
Defect 1 - the budget was never the budget
HostWeightCache::arena_budget_locked()returned the arena's current size, notGGML_HRX_HOST_WEIGHT_LIMIT_MB. Soafter the first growth (64 -> 128 MiB) every caller thought the limit was 128 MiB:
Qwen3-0.6Bat a 4096 MiBbudget evicted 316 times with 536.1 MiB resident (the same run with the budget off: 0 evictions), and the arena
could never grow to the limit it was given.
arena_make_roomalso counted freed bytes rather than contiguousspace - that is your message
366.4 MiB free in 3 blocks, 304.3 MiB wanted, a refusal on an arena 80% free.Defect 2 - a re-materialised ref lost its sub-offset
resolve_command_bindingbuilds a ref asweight base + the command's own sub-offset, butrebind_prepared_host_weightsoverwroteref.offsetwith the new base (andref.lengthwith the whole weight).Every sub-range binding pointed at the start of its weight after the first re-materialisation. That is exactly why the
failure only appears once something is evicted, and it is the most likely mechanism behind a GPU-visible slot being
read with a stale/incorrect view.
Measured after the fixes (PR llama.cpp#172,
1bit/i669-arena-budget-fix@8c7bdb2769a, MERGEABLE/CLEAN)evict=316Okay, the user is asking,evict=0Okay, the user is asking,evict=0The limit, stated rather than buried
A budget below the model's per-execution working set still corrupts, and #788's own run is close to that line
(22.5 GiB resident for 8/41 layers against a 16384 MiB budget). The reason is structural: eviction during an execution
frees slots that are parked until that execution ends (the rule that fixed the earlier NaN), so they cannot serve the
next weight - the 1024 arm says it in one line:
arena is full after eviction: 0.0 MiB of 1024.0 MiB resident, 69.8 MiB free in 3 blocks, 304.3 MiB wanted.Operator rule until the placement road lands: set
GGML_HRX_HOST_WEIGHT_LIMIT_MBabove the working set (V4.1-ngl 8: >= 32 GiB, not 16384) or leave it unset. The structural fix is to stop materialising weights no HRX opreads, which is the placement road and is gated on #674 - not in this PR.
I have not merged anything and the 217 GiB file is not on this box, so V4.1 itself is unmeasured here; the 4B-at-4096
arm is the same shape and is the arm that used to abort.
bong-water-water-bong commentedon Nov 2, 2026
EVIDENCE — #788: the discriminating small-model case, measured at the pin (not closeable yet; PR #172 covers one of the two classes)
1bit/i669-arena-budget-fix@8c7bdb2769a, open) — partiallyAnswering the triage's own discriminating question — does a small model show it? — at the pin
1d32c22609d6,Qwen3-4B-Q4_K_M,-dev HRX0 -fit off -ngl 0 -c 256 --temp 0 -n 8, #715 trio, onegpu-holdticket:GGML_HRX_HOST_WEIGHT_LIMIT_MB=256(below the working set)G…),arena is full after eviction: 102.4 MiB of 256.0 MiB resident, 37.4 MiB free in 35 blocks, 19.5 MiB wantedGGML_HRX_HOST_WEIGHT_LIMIT_MB=4096(above it)HRX returned NaN logits: 151936 of 151936So yes: the small model reproduces, and it is the same code path as V4.1's. No SIGSEGV on 0.6B/4B — the CPU
SET_ROWScrash is V4.1-specific, but it is one manifestation of the same materialisation failure, exactly as the triage said.
What #172 fixes, measured the same way: at 4096 the 4B goes to
Okay, the user is askingwithevict=0(
hit=603 miss=334, resident 3160.5/4096 MiB) — the eviction storm (316 evictions with 536 MiB resident against a4096 MiB limit) was the arena's current size being used as the budget. It also makes a re-materialised ref keep its
sub-offset instead of being rewritten to the weight base.
What #172 does not fix, measured the same way: 256 MiB still corrupts (
GGGGGG), and 1024 MiB still gives NaN +SIGABRT. That is structural: mid-execution eviction parks slots until the execution ends - the 1024 log says it in one
line,
arena is full after eviction: 0.0 MiB of 1024.0 MiB resident, 69.8 MiB free in 3 blocks, 304.3 MiB wanted.Close condition I would put on the row: #172 merged closes the reported configuration class (a budget above the
per-execution working set) and is what #788's 16384 MiB run needs; the sub-working-set class needs either the loud
refusal or the placement road ("stop materialising weights no HRX op reads", gated on #674). Operator rule until then:
budget above the working set (V4.1
-ngl 8: >= 32 GiB) or unset.Lane pi-i669 — the residency cache is my code (#169).
bong-water-water-bong commentedon Nov 2, 2026
#172 is merged (
ba4fdf01bb2) — what that closes, and the one decision left on this issueClosed by #172 (fork tip
ba4fdf01bb2, engine pin bump is pi-release's c20 work tomorrow)Three changes in
ggml/src/ggml-hrx/runtime/host-memory.cppand one incommand-program-executor.cpp: the residencybudget is now
GGML_HRX_HOST_WEIGHT_LIMIT_MBinstead of the arena's current size; the arena grows to that budgetbefore evicting anything; eviction stops when a contiguous block fits rather than when enough bytes were freed;
and a re-materialised weight's prepared ref is shifted by the delta between the old and new base instead of being
overwritten with the bare base (which had pointed every sub-range binding at the start of its weight).
Measured on the same arms that produced the issue:
Okay, the user is asking,evict=0, resident 3160.5/4096 MiBevict=316 hit=299Okay, the user is asking,evict=0 hit=603V4.1's own configuration (16384 MiB) is in this class — 0 evictions once the working set fits under the budget, which
is what the issue's 22.5 GiB/8-of-41-layers run needs. The file is not on this box, so V4.1 itself is still unmeasured
here; the 4B-at-4096 arm is the same shape and is the arm that used to abort.
One caveat for the bump: until the c20 pin moves to
ba4fdf01bb2, the engine still runs the pre-#172 backend (pintoday is
1d32c22609d6), so the symptom as reported is still live for anyone on the current engine pin.Still open: what a too-small budget should do — the decision
A budget below the per-execution working set cannot work as designed: eviction mid-execution frees slots that stay
parked until that execution ends (the rule that fixed the earlier NaN), so they cannot serve the next weight. At the
pin, 4B at 256 MiB gives garbage and at 1024 MiB gives NaN + SIGABRT, with the allocator saying
arena is full after eviction: 0.0 MiB of 1024.0 MiB resident, 69.8 MiB free in 3 blocks, 304.3 MiB wanted.Two things follow, and the first is the one I would like a word on:
cannot serve a weight after evicting everything evictable at the configured budget, fail the decode with a message
that names the budget, the working set and the two ways out (raise it to >= the working set, or unset it) — instead
of emitting wrong logits. The alternative is to treat the budget as advisory and grow past it, which keeps the model
working but makes the bound meaningless. I do not think I should pick that on the operator's behalf.
If the answer is "refuse", the code task is small but not nil: today a failed acquisition does append an error and
the prepared-bound/program path does propagate it, yet the run demonstrably continues with stale bindings and
produces
GGGGGG— that swallowing caller is the thing to fix, and it is the same fix that turns hrx: with #169's residency budget on, V4.1 loads on HRX0 then SIGSEGVs in CPU SET_ROWS; with the budget off it is RESOURCE_EXHAUSTED at materialize weight 3 (follow-up to #669) #788's symptom 1into a clean stop. Once it stops loudly, the close condition for this issue is met.
a budget is needed at all. That road is gated on hrx: any graph whose weight ops all run on the CPU computes garbage (1 s reproducer) #674 (still reproducing at the pin, evidenced separately).
Operating rule until either lands, for the board:
GGML_HRX_HOST_WEIGHT_LIMIT_MBabove the working set (V4.1-ngl 8: >= 32 GiB) or unset; unbudgeted behaviour is unchanged by #172, byte for byte.Lane pi-i669 — the residency cache is my code (#169); I am not touching the pin.
bong-water-water-bong commentedon Nov 2, 2026
DECISION RECORDED — loud refusal, implemented: fork PR #173 (
1bit/i788-refuse@f1905b50e17)ba4fdf01bb2, merged) + #173 (open)Per the 22:22 decision the knob is a bound: refuse, do not exceed.
What #173 does
HostWeightCachelatches the first weight it cannot serve at the configured budget after evicting everythingevictable, records
need,residentand parked bytes, and from then on fails every acquire immediately - so the runstops at the first ubatch instead of re-materialising once per token. The refusal is printed where it happens, not
only returned, because measurement says it has to be: on the pin, the 1024 MiB arm produced 36
arena is full after evictionlines, zero propagated errors and still ended in NaN + SIGABRT.Measured (merged #172 tip + #173, one
gpu-holdticket, #715 trio, 4B-dev HRX0 -ngl 0)refusing to run: … a 304 MiB weight does not fit with 0 MiB resident and 839 MiB parked for the running execution. Raise it to at least 1144 MiB or unset it (engine #788).->llama_decode: failed to decode, ret = -3->Error: Compute error.— was NaN logits + SIGABRTret = -3— was garbage tokensOkay, the user is asking; refusal never firesOkay, the user is asking; refusal never firesNo NaN, no garbage, no abort in any arm, and a budget that fits behaves exactly as before.
Close condition, stated so the close cannot drift
This issue closes with #172 + #173 once #173 is merged and the pin bump reaches them (pi-release). Until the pin
move, the engine still builds the pre-#172 backend. The remaining structural work is not in this issue: it is the
placement road ("stop materialising weights no HRX op reads"), which is #669's and still gated on #674.
Lane pi-i669 - the residency cache is my code (#169).
Bump HRX: llama.cpp d8bd0ff6052a (#171, #172, #173) + held hrx-system…
bong-water-water-bong commentedon Nov 2, 2026
CLOSING EVIDENCE — #788 closes on #172 + #173 at the bump, measured on the pinned backend
ba4fdf01bb2(budget means the budget) + fork #173 →d8bd0ff6052(loud refusal below the working set), both in engine main via #810 →c85596aPin proof, so this close cannot be claimed on a stale binary:
git ls-tree origin/main third_party/llama.cpp→d8bd0ff6052a3cc15b5f83d8d0625aac5b644404, and engine main isc85596a("Bump HRX: llama.cpp d8bd0ff6052a (#171, #172, #173)"). There is no package at this pin on the box(
1bit-hrx-3092596/-004377f/-41ff9dfare all from 19 Oct and predate all three), so the measurement below is a buildof that exact commit (
1bit/pin-d8bd0ff6052, clean, no experiment switch), withrefusing to runverified presentin the resulting
libggml-hrx.sobefore running anything.Qwen3-4B-Q4_K_M,-dev HRX0 -fit off -ngl 0 -c 256 --temp 0 -n 8, #715 trio, onegpu-holdticket:a 5 MiB weight does not fit with 191 MiB resident and 60 MiB parked for the running execution. Raise it to at least 259 MiB or unset itError: Compute error.(llama_decode: ret = -3)a 304 MiB weight does not fit with 0 MiB resident and 839 MiB parked for the running execution. Raise it to at least 1144 MiB or unset itError: Compute error.Okay, the user is askingOkay, the user is askingOkay, the user is askingThat is the whole decision, measured: the knob is a bound, an impossible bound says so with the arithmetic and the way
out, and a bound that fits changes nothing - including the untouched default.
What was actually wrong, for the record: the budget arithmetic used the arena's current size as the budget
(#172), and a re-materialised weight's prepared ref lost its per-binding sub-offset (#172); a budget below the working
set then evicted and re-materialised once per token - 36
arena is full after evictionlines in a single run - while thefailed acquisitions never surfaced, ending in
NaN logits 151936/151936or garbage (#173 adds the latched refusal).What does not close with this and is not in this issue: the structural fix - stop materialising weights no HRX op
reads, which is what removes the need for a budget at all - is #669's placement road, still gated on #674 (which still
reproduces at the pin and is evidenced separately).
Lane pi-i669 - the residency cache is my code (#169).
bong-water-water-bong commentedon Nov 2, 2026
Closed on the evidence above — both classes the issue was split into are now covered, one by a fix and one by a refusal.
Fix, both commits at the pin:
ba4fdf01bb2— the budget means the budget (the arithmetic was using the arena's current size as the budget, and a re-materialised weight's prepared ref lost its per-binding sub-offset);d8bd0ff6052— refuse to run when the budget is below the working set;c85596a36put them inmainwith the pin atd8bd0ff6052a, which I checked independently:git ls-tree c85596a36 third_party/llama.cpp→d8bd0ff6052a3cc15…, and docs: census figures of 2026-09-27 (94.88% mapped, 64.33% checked) #172's sha is an ancestor (compare = ahead 1, behind 0). Census 2026-09-27 #171 (the kv-share guard page) rode the same bump.Reproduced against the acceptance on the row — "no SIGSEGV on the budgeted path, and the unbudgeted path still refusing cleanly", later split into the reported class and the sub-working-set class:
Qwen3-4B … -dev HRX0 -ngl 0, #715 trio, onegpu-holdticket, pind8bd0ff6052a)a 5 MiB weight does not fit with 191 MiB resident and 60 MiB parked … Raise it to at least 259 MiB or unset itError: Compute error.(llama_decode: ret = -3)a 304 MiB weight does not fit with 0 MiB resident and 839 MiB parked … Raise it to at least 1144 MiB or unset itError: Compute error.Okay, the user is askingOkay, the user is askingOkay, the user is askingSo the sub-working-set class closes on the loud refusal branch of the choice this issue carried (the other branch was the placement road), and the reported class closes on the fix: a budget that fits changes nothing, including the untouched default.
What this close does not absorb, stated so the board stays honest: the structural removal — stop materialising weights no HRX op reads — is #669's placement road, gated on #674, which still reproduces at this pin. #788 was the "it loads and then corrupts" defect; #669 is "why does it need a budget at all".
The diagnosis is worth keeping with the close because it is the part that will be re-read later: budget arithmetic on the current arena size, a re-materialised ref losing its sub-offset, then one evict-and-re-materialise per token (36
arena is full after evictionlines in a single run) with the failed acquisitions never surfacing — ending inNaN logits 151936/151936or garbage. A latched refusal is what made that visible instead of silent.bong-water-water-bong commentedon Nov 2, 2026
CLOSING EVIDENCE at the bump — engine
c85596a, backendd8bd0ff6052a, through1bit serve(the engine's own GPU route)c85596a(engine main) carrying fork #172ba4fdf01bb2+ fork #173d8bd0ff6052Compute error.— no NaN, no SIGSEGV, no wrong tokensPin proof:
git ls-tree origin/main third_party/llama.cpp→d8bd0ff6052a3cc15b5f83d8d0625aac5b644404; engine mainc85596a("Bump HRX: llama.cpp d8bd0ff6052a (#171, #172, #173)"). No package exists at this pin on the box, so bothsides were built from it here: engine
1bitfromc85596a(~/wt/i680-engine/build-priv/1bit) and its server from thepinned submodule (
stage-pin788-srv/llama-server), passed in withONEBIT_LLAMA_SERVERsoservecould not fall backto a 19-Oct package. The refusal string lives in
libggml-hrx.so(x1), not in the1bitorllama-serverexecutables (x0 there) - which is why the log line below, not a
stringson the wrapper, is the proof it was active.Qwen3-4B-Q4_K_M --device hrx --ctx-size 256, #715 trio, onegpu-holdticket:{'code': 500, 'message': 'Compute error.'}hrx: refusing to run: GGML_HRX_HOST_WEIGHT_LIMIT_MB=1024 MiB cannot hold this model's per-execution working set - a 304 MiB weight does not fit with 0 MiB resident and 838 MiB parked for the running execution. Raise it to at least 1144 MiB or unset it (engine #788).thenllama_decode: failed to decode, ret = -3Okay, the user is asking for the capital of France. I needNo
NaN logitsand no abort in either arm. That is the decision measured end to end on the engine's own route: animpossible bound stops the request with the arithmetic and the way out; a bound that fits is untouched.
Lane pi-i669 - the residency cache is my code (#169).
bong-water-water-bong commentedon Nov 2, 2026
Reopening the question for a large host-weight working set: 6 configs, and every one that destroys an arena entry segfaults
I closed nothing here — adding the measurement that #172/#173 could not make, because it needs a model whose host-weight
working set is much bigger than a 4B's. Everything below is on the box,
gpu-hold, #715 no-SVM trio,-fit off -ngl 8 -c 2048, 32 tokens,--temp 0, fork pind8bd0ff6052(so #172 + #173 are both in), modelDeepSeek-V4.1-Flash-1017-UD-IQ1_S(217 GiB, archdeepseek41, staged pin = engine mainc85596a/e6af100).Only
GGML_HRX_HOST_WEIGHT_LIMIT_MBchanges between runs:materialize host weight value 3→hsa_amd_memory_pool_allocateRESOURCE_EXHAUSTED(all entries dropped)a 843 MiB weight does not fit with 0 MiB resident and 1002 MiB parked … Raise it to at least 1846 MiB,Compute error, rc=0(all entries dropped)(all entries dropped)Every arm that destroys an entry crashes; the one arm that destroys none refuses cleanly. That is the whole finding.
The mechanism is in the code and matches the two symptoms #788 already has: arena growth calls
entries_.clear()("Every slot in the old arena is gone, so no entry may keep pointing at it") and eviction erases entries too, while
HostWeightLeaseholds aweak_ptr<Entry>— solease.buffer()starts returningnullptrfor leases thatprepared.resident_host_weightsstill holds from an earlier execution, and the executor binds that null pointer. On thismodel that happens on the first ubatch, because the working set (~843.8 MiB weight with 517.8 MiB already resident)
exceeds the first growth (1024 MiB → next power of two of the largest weight), so a second growth is unavoidable unless
every materialised weight is declined up front — and a budget small enough to do that evicts instead, which crashes the
same way. #172's "not fixed here" note is therefore not a corner case on this model, it is the whole path.
Two things worth saying for whoever picks this up:
RESOURCE_EXHAUSTEDis a consequence of the same policy gap, not a pool limit: with the limit at0,
host_weight_exceeds_residency()declines nothing, so the 105471.89 MiB Engram table (aTENSOR_READ_LAZYhost-resident weight) reaches
materializeand the HSA allocation for 105 GiB fails. The 217 GiB model needs somebudget purely to decline that table to the CPU.
(bs=1), down from 1175 three days ago;
FILL/SCALE/ADD/MUL/TOP_Kare off the fallback list entirely;HRX0 model buffer 22456.91 MiBfor 8/41 layers;MemAvailablefloor 36-47 GiB in every arm (the HRX route pins ~107 GiB outside process RSS on a 217 GiB mmap (DeepSeek-V4.1 UD-IQ1_S), independent of -ngl/ubatch/prefetch #669 memory wall isgenuinely gone); and
-dev noneon the same file answers "The capital of France is Paris." So the only thing standingbetween this lane and a V4.1 tok/s row is the lease lifetime above.
Reproducer for the cheapest crashing arm (~50 s):
Lane pi-dsv41 (I hold the model and the 6-arm logs; they are in
~/wt/dsv41-testdata/d3/,arm*-run.out+arm*-budget*.log).bong-water-water-bong commentedon Nov 2, 2026
Measured: the #173 refusal's "raise it to at least N MiB" is a per-blocker number, not a safe budget — and the bound can refuse mid-stream
Follow-up to the closing evidence above, from the memory lane's device work at the same pin (fork
d8bd0ff6052a,hrx-system
82804197bc,~/wt/i674-repro/stage-pin788/llama-cli, #715 no-SVM trio,gpu-hold,-dev HRX0 -ngl 0 -fit off -c 256 -n 8 -no-cnv). 37 arms across four tickets; the point is the diagnostic, because it is the operator'sonly tool for sizing this knob and I used it as one.
1. The advice can be at or below the budget that just failed
a 304 MiB weight does not fit with 641 MiB resident and 1226 MiB parked … Raise it to at least 2173 MiBa 72 MiB weight does not fit with 4101 MiB resident and 434 MiB parked … at least 4608 MiBBoth are the message at
runtime/host-memory.cpp:1963-1968(and the latched re-report at:1936-1941). The arithmeticis a byte sum over a snapshot —
refusal_need_ + resident + parked, rounded up to MiB — while the thing that actuallyfailed is
arena_reservefinding no contiguous block; the line immediately before it says so in different terms:So the advice is per-blocker and greedy: each budget level reveals the next weight that does not fit, and following
one step's advice lands on the next blocker. That is not a defect in the fix (a refusal is the correct outcome), but it
does mean the number should not be read as "the model's requirement".
The arithmetic behind that is visible in the same rows: at the moment of refusal
resident + parked ≈ budget(2422+60 at2483, 2437+73 at 2513, 2518+127 at 2648, …), i.e. the arena is essentially full, so the printed target is
budget + failing weight— "make one more weight's worth of room". Measured progression, 4B, 5 MiB steps (deterministic:the same budgets print identical triples 31 minutes apart):
token_embd.weight, the only tensor of that size)blk.N.attn_q/attn_output.weight)blk.N.ffn_gate/ffn_up.weight)blk.N.ffn_down.weight)attn_k)attn_v) / 5 MiBThe blocking family walks a per-layer cycle 5 → 13 → 19 MiB four times, with
attn_k(1 MiB) andattn_v(2 MiB) onlyappearing in the last three bands — i.e. the cache fills layer by layer and the wall moves one layer at a time. The exact
floor for this model and shape is 2683 MiB (2678 refuses), against 2375.9 MiB of tensor bytes.
(Blocker sizes map to exactly one tensor family in this GGUF, which has only the size classes 1, 2, 5, 13, 19 and 304 MiB;
tools/gguf_tensors.pyin the study tree does the mapping.)2. The bound can refuse a request in the middle of a served stream, and that surfaces as HTTP 500
llama-server, 4B,-ngl 0 -c 2048 -np 1, budget 2720 MiB (the smallest budget that completed a one-shot run):loaded fine, served 20 requests, then refused the 21st (a 245-token prompt) and every later one:
The unbounded arm served all 25 requests with 0 refusals and 0 errors. So the working set is workload-dependent
(it grew with the prompt shape from ~2700 to ~2725 MiB), and a budget tuned on a short prompt can fail a long one. The
process stays healthy — the failure mode is 500s, which is the intended #173 behaviour, but from the outside it looks
like a server error rather than a misconfiguration.
3. What the numbers actually say the budget should be
tensor bytes at 4B (floor 2683 MiB = 1.13x the weight bytes), and 4101-4604 MiB against 5294.5 MiB at 8B (floor between
5120 and 5376 = 0.97-1.03x).
budget + ~1 GiBone-for-one: 4B 2720→+3729, 3584→+4605, 4096→+5121 MiB (slope 1.01);8B 5376→+6283, 5632→+6539, 6144→+7051 MiB (slope 1.000). The arena never returns a slot it has grown, so every MiB of
budget above the working set is a MiB of permanent GTT.
drm-total-gtt: unbounded +3301 MiB,floor-bounded +3683 MiB, both reproducible to the MiB — so the bound costs 382 MiB more even at its lowest running
budget, and 1 MiB/MiB above that (4096 → +5121). Earlier readings of +4101/+4113 MiB for the unbounded arm come from
other sessions; the unbounded path is stable within a session and not comparable across sessions, which is worth
knowing before anyone tunes this knob against a historical number. Sizing rule that survived the measurements:
measure the floor with a staircase, then add headroom for the largest prompt/ubatch the server will serve — or leave
the knob unset.
4. Two small things in the same file
runtime/host-memory.h:128documents the limit as "GGML_HRX_HOST_WEIGHT_LIMIT_MB, default 2048", but the code iskDefaultMiB = 0(runtime/host-memory.cpp:1454-1471) and every measurement here shows the unbounded path by default.The header comment looks stale.
blocks, wanted block,arena_capacity_) would make it actionable — right now that detail is in the line above it,from a different function.
Raw logs, if useful:
~/amd-oss/hrx-study/evidence/memory/residency-{sweep-20261102-1218,sweep-fine-20261102-1221, steady-20261102-1225,floor-8b-20261102-1242,staircase-20261102-1252,perproc-20261102-1309,unbounded-spread-20261102-1312}.logplus
steady-b2720.srv.log. Measurement was per-process (drm-total-gttfrom/proc/<pid>/fdinfo) wherever the twomethods could be cross-checked; they agreed to 2 MiB. Scripts under
~/amd-oss/hrx-study/tools/scripts/; the findings are written up in~/amd-oss/hrx-study/FACTS-memory.md§4.6/§7.5/§7.6.Nothing here changes the fix; it only calibrates what the diagnostic means.
bong-water-water-bong commentedon Nov 2, 2026
The band between refusal and crash is empty: at
-ngl 8this model refuses below ~2.9 GiB and segfaults on eviction mid-execution at and above itFour arms on the big host-weight working set, one
gpu-hold,-dev HRX0 -fit off -ngl 8 -c 2048, 32 tokens, pind8bd0ff6052(so #172 + #173 are both in), model DeepSeek-V4.1-Flash-1017-UD-IQ1_S (217 GiB, archdeepseek41),#715 no-SVM trio, each arm in its own
MemoryMax=84Gcgroup under a 6 GiB MemAvailable watchdog. OnlyGGML_HRX_HOST_WEIGHT_LIMIT_MBchanges;GGML_HRX_HOST_WEIGHT_TRACE=1,GGML_HRX_REPORT=1,-v.refused: a 843 MiB weight does not fit with 0 MiB resident and 1002 MiB parked→evict=31 resident=0materialize host weight value 0 failed,Compute error, rc=0arena grown to 1856.0 MiB for a 843.8 MiB weight (all entries dropped)→ same refusal (1845 MiB parked) →evict=11arena grown to 2048.0 MiB … (all entries dropped)→ same refusal (1845 MiB parked) →evict=11hit=1 miss=72 **evict=3** resident=2861.8 MiB allocs=49 limit=3072.0 MiB, still climbingWhat this pins down
#173's arithmetic: a 843 MiB weightagainst
resident + parked ≈ budget), and the refusal's own advice walks the next blocker, so the working set isgreater than 3072 MiB at this shape — consistent with 4096 and 24576, which also crash. There is no budget that both
fits this model's per-execution working set and survives.
(
all entries dropped) without crashing — because no execution was live at that moment (the refusal fires first).3072 is the arm that dropped entries while executing (
evict=3,miss=72, and it was still materialising when itdied). Same mechanism as the earlier 4096/24576 crash, which is 6 s of execution after the drop rather than 0. So the
weak_ptr<Entry>expiry sits behind both failure paths: any entry dropped under a live lease ⇒ the executor binds adead slot.
843 MiB parkedfor the running execution, i.e. weekly: 1bit OS image builds under cron; the guard reports real failures #173 is parking awhole weight per execution, so the requirement at this model's per-blocker sizes is ~
993 + 843MiB at minimum before thenext blocker, and the staircase keeps going up from there.
Suggestion, since a refusal is the intended outcome and a crash is not
The cheap fix is to never drop an entry a live execution holds: mark leased entries unpinnable-by-eviction for the
duration of
bind_and_execute_prepared_command_programand, if the budget cannot be honoured without dropping one, take the#173refusal path ("raise it to N or unset it") instead of clearing the slot. That keeps the documented contract("refuse, do not exceed") and closes the SIGSEGV class for any model whose working set exceeds its budget — which, on this
217 GiB file, is currently every budget.
Repro (each arm ~90 s; logs kept at
~/wt/dsv41-testdata/d3/sweep-{1024,1856,2048,3072}.log, script~/lb/dsv41-d3-sweep.sh):For the record, the box was never at risk in any arm: 84-87 GiB available throughout, watchdog floor 58 GiB, GTT back to the
other lanes' 31.6 GB baseline after every arm, no OOM, nothing else disturbed.
bong-water-water-bong commentedon Nov 3, 2026
Adding two arms from today's V4.1 measurements, because they falsify the natural workaround for this crash and narrow the
mechanism. Same model/pin/shape as the opening report unless noted: DeepSeek-V4.1-Flash-1017-UD-IQ1_S (217 GiB, arch
deepseek41), pind8bd0ff6052,-dev HRX0 -fit off -ngl 0 -c 256 -b 16 -ub 16, 32 tokens, #715 no-SVM trio, each arm inMemoryMax=40Gunder an 8 GiB MemAvailable watchdog. OnlyGGML_HRX_HOST_WEIGHT_LIMIT_MBchanges.The hypothesis these test:
host-weight-placement.cpp:48declines any weight withggml_nbytes > limit, so a budget belowthe smallest real weight should mean no materialisation at all — nothing to evict, arena pinned at its minimum, no crash.
evict=54 miss=60 hit=2 resident=34.9 MiB limit=64.0 MiBarena grown to 64.0 MiB for a 0.0 MiB weightmin_MemAvailable=74 GiBevict=0 miss=61 resident=367.1 MiB limit=512.0 MiBarena grown to 512.0 MiB for a 32.8 MiB weight (all entries dropped)min_MemAvailable=71 GiBBoth arms load cleanly first (
offloaded 0/41 layers, all fourCPU_Mappedbuffers, the 105471 MiB Engram tablelazy read enabled,graph splits = 707), then die inside the same first ubatch. Two things follow:cache churns and then the process dies. So "set the budget below the weights" is not a workaround for this bug.
evict=54); the512 MiB arm dies with
evict=0but immediately afterarena grown ... (all entries dropped). That points at a singlecause underneath both: an entry that a live
HostWeightLeasestill points at is dropped, by eviction in one arm and byreallocation in the other, and the run then continues on stale bindings. Which is also why the NaN/garbage warning in
host-memory.cpp:1961exists.Also worth recording as a positive: this shape is memory-safe for the box —
min_MemAvailable74 / 71 GiB, device GTTflat at 32.5 GiB, nothing allocated near the #680 guardrail. The failure is purely in the residency bookkeeping, not pressure.
That makes the
-ngl 0+ small-budget shape a cheap, low-risk reproducer for whoever fixes the lease lifetime: ~60 s per arm,no big host or device footprint.
bong-water-water-bong commentedon Nov 3, 2026
Backtrace for the cheap reproducer, so whoever takes the fix does not have to reload the 76 GiB model to get one. Same
shape as my previous comment:
GGML_HRX_HOST_WEIGHT_LIMIT_MB=64,-dev HRX0 -fit off -ngl 0 -c 256 -b 16 -ub 16, 32 tokens,pin
d8bd0ff6052, under gdb in aMemoryMax=40Gscope. Crashes in ~73 s,MemAvailablefloor 74 GiB.Two details that may shortcut the investigation:
memcpydestination is0x1a280= 107136 — not a wild address in the usual sense but a small,value-shaped integer in a pointer slot, with
len = 0. That reads like a byte offset used where a base address wasexpected (an arena/slot offset surviving into a CPU tensor's
data), rather than a plain null dereference or anexhausted arena. It is consistent with the same
-dev nonecontrol being clean (my lane's control on this pin: 1 graphsplit, 5.55 t/s, correct output), i.e. this needs the HRX residency path to appear at all.
SET_ROWSis a state write in the dsv41 graph (SET_ROWS x 50in the placement report), not a weight read, andevict_for()already refuses to evict an entry withuse_count() != 1. So the invalidation is more likely on thegrowth route (
entries_.clear()atarena_reserve, which has no lease check) or in how the materialised pointerreaches the node — the 64 MiB arm evicts (
evict=54) and the 512 MiB arm does not (evict=0, growth(all entries dropped)), and both crash identically, which is what a single shared cause looks like.Reproducer script is
~/lb/dsv41-d3-arm64.shon strixhalo (BUDGET= / NG= / CAP= overridable); the gdb invocation is thesame command with
gdb -batch -nx -ex run -ex "bt 18"in place of the binary. Happy to hand over the exact commands on thebox if it helps.
bong-water-water-bong commentedon Nov 3, 2026
Root cause found for this crash, and it is not the arena. Filed with the evidence and three fix options as #920. Short version:
dst=%rsiatggml_compute_forward_set_rows, fields viaoffsetof) shows exactly two CPUSET_ROWSbefore the fault:dsv4_csa_state_kv_l2with a real host pointer (0x7ffed23668c0, fine), thentype=0 op=42 ne=[1,256,2,1] data=0x1a000, which faults withrdi=0x1a300.0x1a000 = GGML_HRX_FAKE_PTR_BASE (0x1000, ggml-hrx.cpp:46) + 0x19000: the destination is device-local HRX memory. The shape isbmfromsrc/models/deepseek41.cpp:607.GGML_OP_FILL(hip_declare_eager_op(GGML_OP_FILL), private addondispatch-hip-dflash-select.cpp:366), sobmis device-local;ggml_set_rows()returnsggml_view_tensor(ctx, a)(ggml.c:3956) butggml_is_view_op()does not coverSET_ROWS, so the scheduler assigns the node fromsrc[]and puts it on the CPU;ggml-backend.cpp:1227only consultsview_srcwhen the node is still unassigned, andggml_backend_view_initnever checks the backend. The CPU memcpy then writes at0x1000 + offset.Corrections to my earlier comments here, on the record: the 12:35 "arena growth (
entries_.clear()has no lease check) / offset-vs-base" reading is wrong, and so is the budget framing — the budget only decides which weights materialise. Controls that exclude the arena: a 0.6B model at budgets 64/512/4096 MiB is clean with growth, eviction andall entries droppedall exercised; with-dev HRX0it runs zero CPUset_rows. This is a two-backend placement gap that any budget reproduces once the V4.1 candidate-mask path runs.bong-water-water-bong commentedon Nov 4, 2026
Three more data points on the advice the refusal prints, from a different model and a different rung (DeepSeek-V4.1-Flash UD-IQ1_S, 217 GiB file,
-dev HRX0 -ngl 8 -fit off -c 256 -b 16 -ub 16, fork pind8bd0ff60). Same box, same session, onlyGGML_HRX_HOST_WEIGHT_LIMIT_MBchanged:So doubling the budget nearly doubles what it then says it needs (+81 MiB over the budget at 4096, +362 MiB over it at 8192) — the demanded figure tracks the budget, because a larger budget admits larger host weights instead of declining them, and
parkedgrows with the budget as well (3659 -> 5790 MiB). Following the message therefore does not converge; only a budget small enough to keep declining the big weights does.The second row is also the fragmentation signature already filed as #900: 481.9 MiB free in 5 blocks while 843.8 MiB is wanted — the bytes exist, contiguously they do not.
arena_reservereports the request as unsatisfiable with 0 bytes resident after eviction.One related note for whoever picks this up: with the fork's own HIP add-on loaded, this config died in
SET_ROWSat the first decode (rc=139) exactly as in #920, and with a local copy of the add-on that does not declareGGML_OP_FILLthe same two arms load and reach decode cleanly (rc=0, refusal above). That is a second independent confirmation of #920's diagnosis, this time at-ngl 8rather than-ngl 0. Measurements only, no patch from me — #788/#900/#920 are someone else's to fix.bong-water-water-bong commentedon Nov 4, 2026
Correction to my sentence above, before anyone acts on it. I wrote that a small budget "keeps declining the big weights". Measured since, it does not always: at
GGML_HRX_HOST_WEIGHT_LIMIT_MB=512the same 517 MiB host weight is not declined at placement, it fails at execution:(
-dev HRX0 -ngl 4 -fit off -c 256 -b 16 -ub 16, same model, same session; identical with-fcd, different value id.) So the three regimes for the same tensor are:host weight 517 MiB exceeds the 512 MiB residency limit->materialize host weight value N failed->Compute errora 517 MiB weight does not fit with 0 MiB resident and 3659 MiB parked, tells you to raise it to 4177an 843 MiB weight does not fit ... 5790 MiB parked, tells you to raise it to 8554host-weight-placement.cpp's predicate (ggml_nbytes(weight) > residency_limit()) is the "decline at placement" path I described, and it evidently does not cover this weight's op — that is the part worth a look, because a decline would have left the op on the CPU and the model would have run. All three rows are aCompute error, never a wrong answer, which is the good part.