Skip to content

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

Closed

Description

@bong-water-water-bong

Summary

On the strixhalo box (Ryzen AI MAX+ 395, gfx1151, 124 GiB UMA, kernel 7.3.0-rc4-1bit), loading a 217 GiB shifted GGUF
(unsloth/DeepSeek-V4.1-Flash-1017-GGUF UD-IQ1_S, deepseek41 arch, 5 shards) through the HRX route makes ~107 GiB
of system memory unreclaimable, and it is not in the process's RSS. With the device absent the same file loads and
runs fine on the CPU. The GPU-side claim is independent of how many layers are offloaded, of the ubatch, and of the loader's
mmap prefetch, which points at the host buffers being registered with the device rather than at anything the graph
allocates.

Numbers (all same file, same box, merged head 01d7df4b9, -fit off, 4 GiB MemAvailable watchdog)

run device layers on HRX0 ubatch graph splits peak RSS MemAvailable floor outcome
CPU build none – 16 1 113 GiB 111 GiB ran, "Paris.", pp 8.0 / tg 5.1 t/s
HRX build, -dev none none 0 16 1 – 111 GiB ran, pp 4.15 / tg 5.55 t/s
-dev HRX0 -ngl 0 HRX0 0 512 635 – 3 GiB killed by the watchdog
-dev HRX0 -ngl 0, prefetch off HRX0 0 4 – 37.7 GiB 3 GiB killed
-dev HRX0 -ngl 8 HRX0 8 16 681 101 GiB 3 GiB killed
-dev HRX0 -ngl 8, -c 64 -b 4 -ub 4 HRX0 8 4 681 – 3 GiB killed (HRX0 compute buffer 1.78 MiB, HRX0_HOST 2.89 MiB)
-dev HRX0 -ngl 24 HRX0 24 16 – 93 GiB 3 GiB killed
-dev HRX0 -ngl 36 HRX0 36 16 – 112 GiB 3 GiB killed

The row that matters most is the 4th: peak RSS 37.7 GiB while MemAvailable fell by ~107 GiB. The process never mapped
that memory as anonymous. After the kill everything returns to the pool (mem_info_gtt_used 12 MiB, mem_info_vram_used
155 MiB, MemAvailable 110 GiB), so it is transient for the duration of the run, not a leak.

Loader facts from the same runs (load_tensors, verbose log):

tensor per_layer_token_embd.weight (size = 105471 MiB) lazy read enabled     -> 103 GiB Engram table, host buffer type
CPU_Mapped model buffer size = 46326.89 + 46634.37 + 19790.60 + 105471.89 MiB  (= 218 GiB, 4 of 5 shards)
HRX0 model buffer size       = 22456.91 MiB                                  (8 layers + output)

lazy_read::buft() returns the CPU buffer type, so the table is host-side by construction; llama_mmap additionally
POSIX_MADV_WILLNEEDs the complement of the lazy ranges (all ~114 GiB of non-lazy weights) at mmap time.

Hypotheses falsified by measurement (so they are not retried)

  1. too many layers offloaded - -ngl 0 (no layer tensor on the device) hits the wall too;
  2. the graph's split copies - -ub 4 -c 64 with 1.78 MiB of HRX0 compute buffer hits it too;
  3. the loader's whole-file prefetch - LLAMA_MMAP_NO_PREFETCH=1 (local probe patch forcing prefetch = 0) hits it too,
    and the peak RSS drops to 37.7 GiB while MemAvailable still collapses, which is what moves the suspicion from the page
    cache to device registration.

What I think it is

The HRX backend's host-visible buffers (or the whole CPU_Mapped set it can reach) appear to be registered/pinned with the
HSA agent for the duration of the run, so the pages stop counting as available instead of being clean, reclaimable page
cache. The device reports 122880 MiB free (the whole UMA window), so nothing in the accounting tells llama.cpp the box
cannot actually afford this file.

Why it matters

  • it blocks the whole deepseek41 route on this box: no HRX number (tok/s, KLD, pp512) can be measured until it is fixed;
  • the CPU route on the same file is fine (1 graph split, MemAvailable floor 111 GiB), so it is not a "the model does not
    fit" problem;
  • a fix would also be a general win for every model whose weights are mmapped and partly offloaded.

Suggested next steps

  1. Attribute the bytes: run the HRX memory-metrics profiler (GGML_HRX_REPORT memory breakdown, loom-memprof-hrx) over
    one load while sampling /sys/class/drm/card0/device/mem_info_gtt_used per second - that names the pool and the caller.
    I have asked the orchestrator for a 2-minute exclusive box window for exactly this run (BOX-REQUEST-2).
  2. If it is registration: register only the buffers that are actually dispatched to HRX0 (per-tensor), or use a mapping that
    is not pinned (e.g. leave CPU_Mapped unregistered and copy only what a dispatch needs).
  3. If it is UMA driver behaviour: teach the device-memory accounting the real MemAvailable so --fit, -ngl and the
    scheduler stop assuming 120 GiB is free.

Repro (from ~/wt/dsv41-engine, pin third_party/llama.cpp = 01d7df4b9, -DONEBIT_HRX=ON):

M=~/models/dsv41/UD-IQ1_S/DeepSeek-V4.1-Flash-1017-UD-IQ1_S-00001-of-00005.gguf
IREE_HAL_AMDGPU_LIBHSA_PATH=/opt/rocm-therock/lib/python3.14/site-packages/_rocm_sdk_core/lib/libhsa-runtime64.so.1 \
  ./build/hrx/llama/bin/llama-cli -m $M -dev HRX0 -fit off -ngl 0 -c 256 --no-warmup --no-jinja --chat-template chatml \
  -p 'The capital of France is' -n 4 -v --log-file /tmp/hrx.log
# watch: awk '/MemAvailable/{print $2/1048576" GiB"}' /proc/meminfo ; cat /sys/class/drm/card0/device/mem_info_gtt_used

Activity

  1. bong-water-water-bong commented on Oct 30, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    Attribution: it is GTT, and it tracks the loader's host buffers 1:1

    Ran the probe in an exclusive 2-minute window (-dev HRX0 -fit off -ngl 0 -c 256, no layers offloaded, 2 tokens), sampling /sys/class/drm/card0/device/mem_info_{gtt,vram}_used and MemAvailable once per second:

    16:20:56  gtt=     12M  vram=155M  avail=111922M     <- baseline
    16:21:52  gtt=    790M  vram=156M  avail=111444M     <- loader starts mapping tensors
    16:21:57  gtt=  14182M  vram=156M  avail= 99140M
    16:22:12  gtt=  42712M  vram=178M  avail= 70266M
    16:22:32  gtt=  68876M  vram=188M  avail= 45155M
    16:22:52  gtt=  92730M  vram=226M  avail= 20278M
    16:23:07  gtt= 106594M  vram=252M  avail=  6583M     <- 104 GiB GTT, MemAvailable 6.4 GiB
    

    GTT grows by 106.6 GiB while VRAM stays at ~0.25 GiB, and MemAvailable falls in lockstep. So the bytes are GPU-accessible system memory taken through the amdgpu/HSA path — not the 1 GiB VRAM carve-out, not dirty page cache. Everything returns when the process dies (gtt 12 MiB, vram 155 MiB, MemAvailable 110.8 GiB).

    Because this is with -ngl 0 — nothing of the model is on the device — what is being turned into device memory is the host-side CPU_Mapped model buffers themselves: they are registered/made device-visible as the loader maps them, not when a dispatch needs them.

    Also from the same run's placement report (useful for the next PR): the fused hc ops are in the graph (DSV4_HC_COMB x 80, DSV4_HC_PRE x 79, DSV4_HC_POST x 80) but placed on CPU, because with -ngl 0 their layer is on CPU.

    What this implies for a fix

    Register on demand, per tensor, only for the dispatches that actually run on the device (and unregister/drop when the schedule releases them), instead of registering the whole mapping at load. With -ngl 8 the device model buffer is 22 GiB, so the ceiling becomes ~22 GiB of GTT rather than 107 GiB — that alone would leave ~90 GiB of headroom on this box and make the route measurable. Second choice: keep CPU_Mapped unregistered and copy only what a split needs (the copies we already pay for on the 635-723 graph splits).

    Third, orthogonal and cheap: the device advertises 122880 MiB free (the whole UMA window) to llama.cpp, so --fit and the scheduler plan against memory the box cannot afford. Reporting min(device window, MemAvailable) would make -fit on behave sanely for every large model on this APU.

  2. bong-water-water-bong commented on Oct 30, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    Attribution: it is HostWeightCache, per tensor on first device use — not a buffer registered at load

    Read the existing evidence (the 16:20 probe in /tmp/pools.log + hrx-probe.log) rather than re-running it, then
    went to the code in the fork at 1bit/hrx-vulkan-patched (01d7df4b9). Three findings, one of which contradicts the
    "registration at load" hypothesis.

    1. There is no registration code at all. grep hsa_amd_memory_lock over ggml/src/ggml-hrx/ finds nothing; the
    backend never pins or imports a foreign host pointer. GGML_HRX_REPORT has no memory-breakdown code in this tree
    (only the placement observer), so the probe could only ever have printed the placement line. And in the probe log the
    GTT ramp starts after load_tensors completes (log clock M.SS.mmm: load_tensors at 0.01.13x for the 4B
    reproducer below, GTT still flat at that instant), while sched_reserve reports the HRX side owning 230 MiB
    (HRX0 compute 94.25 MiB + HRX0_HOST 136.59 MiB). Nothing pins the 218 GiB CPU_Mapped set at load.

    2. The actual owner is HostWeightCache, and it never gives anything back.
    command-program-executor.cpp:566-635 materialize_host_bindings, with value-map.h:67
    requires_materialization() { return host_data != nullptr; }:

    materialize_weight = binding.weight && access.read && !access.write &&
                         (binding.requires_materialization() || access.transformed_read);

    binding.weight is true for any WEIGHTS-usage buffer and requires_materialization() is true for every
    host-resident tensor
    , so each weight an HRX-placed node reads is, per tensor on first device use: repacked to a
    native layout if needed, allocated as a fresh HRX_MEMORY_TYPE_DEVICE_LOCAL buffer, uploaded, and inserted into
    HostWeightCache::entries_ with no budget, no LRU and no erase path (host-memory.cpp:1524; the only removals are
    clear() on backend free and the lease dying). On a UMA APU "device local" is system memory in BOs that are never
    mapped into the process, which is exactly the observed signature: GTT and MemAvailable move, RSS does not.

    3. Reproduced in 3 seconds on a 2.4 GiB file. Qwen3-4B-Q4_K_M, -fit off -ngl 0 -c 256, 1 Hz
    mem_info_gtt_used + MemAvailable, each run inside gpu-hold + a 4 GiB MemAvailable watchdog. Deltas are within-run,
    so a busy box does not spoil them:

    run graph splits GTT start -> peak delta GTT greedy output
    -dev none (CPU reference) 1 12 M -> 174 M +162 M <think>\nOkay, the user is asking for the capital of France. I need
    -dev HRX0 -ngl 0 145 12 M -> 4583 M +4571 M same, verbatim
    -dev HRX0 -ngl 37 (all offloaded) — 12 M -> 3520 M +3508 M same, verbatim

    1.9x the model claimed as GTT at -ngl 0, never returned; still 1.1 GiB of it at full offload (the 304 MiB
    CPU_Mapped output-layer weight plus overhead) — which is why every -ngl in the table above dies, not just
    -ngl 0. -ngl 37 is numerically identical to -dev none, so HRX is fine when the weights live in HRX buffers.

    4. The obvious fix is falsified — and it uncovers a second bug. Declining, in device_supports_op, any op whose
    weight input is host resident (the "host-only tensors are not registered with the device" behaviour) does collapse the
    memory, and breaks the output:

    unpatched: 1446 nodes,  648 off HRX (MUL_MAT   0), 145 splits, gtt +4571 M, correct output
    patched  : 1446 nodes,  798 off HRX (MUL_MAT 325), 217 splits, gtt  +556 M, output "ibel  1   …"
    

    It is the split count, not the memory: 325 MUL_MATs on CPU add 72 cross-device splits, and the CPU<->HRX handoff
    mangles activations (the unpatched run already logs one synchronous download fallback for an unregistered host pointer). Nothing exercised this before, because every -ngl 0 run with the device present died of the memory wall
    first. So "same output Paris." cannot be met by the placement fix alone.

    What the fix has to be

    Bounding HostWeightCache alone frees nothing: the bytes have a second strong owner,
    PreparedCommandProgram::resident_host_weights (command-program-executor.h:108), which holds a lease for the whole
    lifetime of the cached prepared program — and a single prompt is one graph program, so trim_graph_programs never
    fires inside it. The shape that works is: cache budget + LRU eviction, prepared programs holding weak_ptr plus the
    cache key, and a rebind_prepared_host_weights next to the existing rebind_prepared_host_staging hook
    (command-program-executor.cpp:1673, :1768) that re-acquires and re-uploads on a miss. ~100 lines across three
    hot-path files.

    I have not landed that (two days from a release, unreviewed hot-path change) and I have not taken the 217 GiB
    numbers yet: the box had hyperloom's GPU sweep running for my whole session. Both are queued with the orchestrator.

  3. added
    bug
    perf
    on Oct 31, 2026
  4. bong-water-water-bong commented on Oct 31, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    The reclaim bug, measured: the residency bound holds, the cache never hits, and libhrx's allocator keeps the churn

    Follow-up to the attribution above, from a per-execution instrumentation run on the bounded-residency fix (the
    HostWeightCache budget + weak leases + re-acquire/rebind-at-execution design). Qwen3-4B-Q4_K_M (2378 MiB),
    -dev HRX0 -fit off -ngl 0 -c 256, temp 0, GTT sampled at 0.2 s during the run; one log line per execution
    (GGML_HRX_HOST_WEIGHT_TRACE=1) printing hits/misses/evictions/live entries/resident bytes/limit.

    limit executions misses evictions live entries resident_bytes GTT peak delta
    2048 MiB 3077 6783 6450 333 2037.2 MiB (bound holds) 11049M +11037M
    64 MiB 3060 6749 6737 11 60.9 MiB (bound holds) 7393M +7381M
    unpatched, same case — — — — — 4583M +4571M

    Three facts:

    1. The budget works. resident_bytes sits at 60.9 MiB against a 64 MiB limit and 2037 MiB against 2048, and live
      entries drop from 333 to 11. Output stays verbatim correct against -dev none at both limits.
    2. The cache never hits: hit=0 in both runs. 6783 misses / 6450 evictions across 3077 executions; refilled
      is 1-6 on ~2100 of them and 0 on only 542. Even at 2048 MiB the working set does not fit a 2378 MiB model, so the
      LRU evicts the entry it is about to need again — thrash.
    3. The freed bytes never go back to the driver. With 11 live entries and 61 MiB resident, GTT still climbs to
      7393 MiB and the trace sits flat at 7369-7393 MiB until the process exits, then drops to 12 MiB at once. ~6700
      hrx_buffer_release calls did not return memory: libhrx/IREE's HAL allocator caches freed device buffers per
      size
      , and thousands of differently-sized weight tensors mean thousands of retained size classes.

    So the bug is not in the bound or the eviction order — it is that evict-then-reallocate is the wrong primitive under
    a per-size pool
    . Which gives the fix as two requirements, both cheap once stated:

    • materialize resident weights out of one arena (a single limit-sized device buffer, sub-allocated) so there is
      one size class and eviction reuses a slot instead of allocating and releasing a distinct block;
    • and size the budget above the per-execution working set, otherwise the design thrashes: hit=0 at 2048 MiB for
      a 2378 MiB model is the measurement that says so.

    For #669 this means the wall is not HostWeightCache retention alone; it is retention plus per-size pool caching of
    the churn. A placement change (decline host-weight ops that cannot fit the budget) also works and is already measured
    at +556 MiB instead of +4571 MiB, but it is gated on #674. No PR from me until one of these measures as a win on the
    GTT-growth case.

  5. bong-water-water-bong commented on Oct 31, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    Pin check: the GET_ROWS commit does not move the #669 before number, and the finding reproduces

    Re-ran the instrumentation as a separate sitting with the 4B on the current fork pin, ambient clean (GTT 12M at start,
    95 GiB cap never approached). Two things to record.

    The fork pin is 4a58da9b0, and it is the commit my fix was already measured at (origin/1bit/hrx-vulkan-patched
    tip, "ggml-hrx: GET_ROWS id range 2^30 for the DeepSeek-V4.1 Engram table"). Unpatched, same model, -ngl 0, at both
    pins:

    run pin splits GTT start -> peak delta
    -dev none 4a58da9b0 1 12M -> 174M +162M
    -dev HRX0 -ngl 0 unpatched 4a58da9b0 145 12M -> 4583M +4571M
    -dev HRX0 -ngl 0 unpatched 01d7df4b9 145 12M -> 4583M +4571M

    Identical to the megabyte, peak included - as expected, since that commit is about the DeepSeek-V4.1 Engram table and
    Qwen3-4B-Q4_K_M has no Engram table. So the numbers above stand unchanged across the pin move.

    The reclaim finding reproduces exactly (four runs, two sittings, same pin, same ambient):

    limit GTT delta hit miss evict resident_bytes live entries output
    2048 MiB +11039M 0 6783 6450 2037.2 MiB 333 verbatim = -dev none
    64 MiB +7381M 0 6749 6737 60.9 MiB 12 verbatim = -dev none

    Budget holds exactly, cache never hits, churn is retained by the per-size allocator pool instead of by the cache. One
    correction to my own record for anyone re-reading: an intermediate reading of +2367M at this pin was taken while
    another agent held 82 GiB of GTT (start baseline 82290M); that was a busy box, not a pin effect.

    Next is a code change, not another measurement: residency from one limit-sized arena (single size class, eviction
    reuses a slot) rather than allocate/free per eviction, with the budget above the per-execution working set.

  6. bong-water-water-bong commented on Nov 1, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    The reclaim fix (one residency arena) is written, measured, and not a win - and the measurement says why

    The plan from the 08:05/18:40 entries was: replace the per-weight hrx_buffer_allocate/hrx_buffer_release churn with one arena (one size class, eviction frees a slot instead of a buffer), on the evidence that ~6700 releases returned nothing because libhrx/IREE pools freed device buffers per size class.

    That is now implemented (1bit/i669-host-weight-residency @ 076c9cb24ad, on the fork, DO NOT MERGE - it returns NaN logits) and measured against the unpatched pin on the same box, same model, one gpu-hold ticket, mem_info_gtt_used at 5 Hz, 95 GiB cap, no-SVM env trio:

    arm GTT start -> peak delta result
    unpatched 4a58da9b0, 4B -ngl 0 43281M -> 47403M +4121M generates, 20.2/16.5 t/s
    arena, 4B -ngl 0, limit 2048 MiB 43281M -> 44587M +1305M aborted: HRX: NaN logits
    arena, 4B -ngl 0, limit 4096 MiB 43281M -> 51755M +8473M generates, 17.4/10.2 t/s
    arena, 4B -ngl 8, limit 4096 MiB 43281M -> 52717M +9435M generates, 30.0/10.0 t/s
    arena, 0.6B -ngl 0 43281M -> 44047M +765M aborted (same path)

    Three findings, all of them measured rather than argued:

    1. At -ngl 0 this model materializes essentially the whole weight set anyway: with the arena at the 2048 MiB limit, resident reached 2029.9 MiB before the arena ran out. So a bound below that thrashes (consistent with the earlier hit=0 at 2048 MiB) and a bound above it costs more GTT than the bug it is meant to fix (+8473M at 4096 MiB vs +4121M unpatched). The reclaim path is bounded below by the materialized working set; the win cannot come from there.
    2. The growth path itself must not allocate repeatedly: every arena growth releases the previous buffer, and a released buffer is exactly what the per-size pools retain, so the 64 -> 128 -> ... -> 4096 MiB ladder leaked the ladder (that is where the +8.4 GiB came from; one-shot growth to the limit removes it).
    3. Eviction inside the arena is not safe for the program that is currently bound. Leases are weak snapshots, so use_count()==1 does not mean "nobody is reading it"; handing a slot to another weight while the running program still binds the old offset produces garbage - in this case NaN logits (0.6B) and Compute error (4B). Refusing the weight instead fails loudly, which is the behaviour the design wanted, but it also means the arena needs per-program pinning before it can evict at all.

    Correction to this issue's premise, therefore: the reclaim bug is real (the cache holds the bound, the allocator keeps the churn), but fixing it does not lower GTT at -ngl 0, because the amount materialized is the dominant term. The weights have to stop being materialized for HRX ops that never read them - that is the placement path, and it needs #674. The arena work, the numbers and the NaN are preserved on the branch with a DO NOT MERGE message so the next pass does not repeat them.

    -dev none on the same 4B model is +162M; that remains the floor the placement path has to approach.

  7. added a commit that references this issue on Nov 1, 2026
  8. bong-water-water-bong commented on Nov 2, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    CLOSING ROW at the bump (c85596a / d8bd0ff6052a) — what is measured here, and the one thing that is still open by design

    # by evidence
    669 #169 2cbf8afb16c + #172 ba4fdf01bb2 + #173 d8bd0ff6052, all in engine main via #810 c85596a; the wall itself measured on the real file by the dsv41 lane the HRX route no longer pins memory outside the model's own residency: with the device present, -ngl 0, GTT grows by the materialised working set and nothing more, MemAvailable stays at a healthy floor on an 18.6 GB model, and the growth is now bounded and refusable instead of unbounded

    Pin: engine main c85596a, third_party/llama.cpp = d8bd0ff6052a3cc15b5f83d8d0625aac5b644404 (checked with
    git ls-tree). No package exists at this pin, so the measurements are a clean build of it: llama-cli from
    d8bd0ff6052a (stage-pin788, refusing to run present in libggml-hrx.so), plus the engine 1bit at c85596a for
    the serve rows above.

    Every row is the issue's own configuration - device present, weights host resident (-ngl 0) - one gpu-hold
    ticket, #715 trio, -fit off -c 256 --temp 0:

    row GTT MemAvailable floor answer
    Qwen3-4B -ngl 0, default (no budget) 33294M -> 37415M (delta +4121M) 54.6 GiB Okay, the user is asking
    Qwen3-4B -ngl 0, budget 4096 MiB 33294M -> 38695M (delta +5401M) 52.9 GiB Okay, the user is asking
    Qwen3-4B -dev none (the floor #669 asked to match) 33294M -> 33591M (delta +296M) 56.8 GiB Okay, the user is asking
    Qwen3-Coder-30B-A3B (18.6 GB) -ngl 0, default, MemoryMax=48G 33294M -> 51853M (delta +18559M) 45.4 GiB The capital of France is Paris.

    Read against the issue: the filed failure was a 217 GiB file whose -ngl 0 run left RSS at 37.7 GiB while
    MemAvailable fell ~107 GiB and the watchdog had to kill it. At this pin the same configuration class costs GTT equal to
    the model that is actually resident (4B: +4.1 GiB; 18.6 GB model: +18.6 GiB), the floor stays in the 45-57 GiB band on
    this box's ambient load, and the residency can be bounded or refused on demand (4B at 1024 MiB refuses with the numbers,
    as evidenced on #788). The 217 GiB file is not on this box, so the file-level row remains the dsv41 lane's
    measurement at this pin class: -ngl 8, GTT 32.5 GiB unchanged from baseline, MemAvailable floor 36-41 GiB,
    where 4a58da9b0 pinned 113 GiB off a 33 GiB baseline with a 5 GiB floor and was killed.

    What is deliberately still open, and is not this issue's failure: at the default (no budget) the materialised
    working set still lands in GTT - that is the residency cache doing its job, not a leak, but it is also why a small model
    still costs its own size in GTT at -ngl 0. Removing that cost means not materialising weights no HRX op reads, i.e.
    the placement road, which is #669's design successor and is gated on #674 (still reproducing at this pin; its own
    1-second evidence is on that issue).

    So: this row supports closing #669 as the runaway pin is gone and the residency is bounded/refusable, with the
    placement road carried on #674. Judge it on the numbers above plus the dsv41 file-level row; I am not closing it myself.

    Lane pi-i669.

  9. bong-water-water-bong commented on Nov 2, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    Closing on the lane's evidence — the filed defect is measured gone; the residual is the working set, and it is #674's

    The issue filed a runaway: 217 GiB DeepSeek-V4.1 UD-IQ1_S, -ngl 0, RSS 37.7 GiB while MemAvailable fell
    ~107 GiB, killed by the watchdog — and it reproduced with -ngl 0, with -ub 4 -c 64 (1.78 MiB of HRX0 compute
    buffer) and with LLAMA_MMAP_NO_PREFETCH=1, i.e. independent of offload, graph split and prefetch.

    File-level row (the issue's own configuration), pin 1d32c22609d6 — which carries the fix #169
    2cbf8afb1
    ; verified, not assumed: 2cbf8afb1 is an ancestor of 1d32c2260, and 1d32c2260 is an ancestor of the
    fork head / current pin d8bd0ff6052a3cc15:

    file route GTT MemAvailable floor outcome
    V4.1 UD-IQ1_S (217 GiB) -dev HRX0 -ngl 8, #169 32.5 GiB, unchanged from baseline 36–41 GiB runs
    same file, 4a58da9b0 -ngl 8 pinned 113 GiB off a 33 GiB baseline 5 GiB killed

    Harness rows at the current pin d8bd0ff6052a (#169 + #172 ba4fdf01bb2 + #173 d8bd0ff6052), one ticket,
    #715 trio, -fit off -c 256 --temp 0, all answering:

    row GTT delta floor text
    Qwen3-4B -ngl 0, default 33294M → 37415M (+4121M) 54.6 GiB Okay, the user is asking
    Qwen3-4B -ngl 0, budget 4096 MiB +5401M 52.9 GiB same
    Qwen3-4B -dev none +296M 56.8 GiB same
    Qwen3-Coder-30B-A3B (18.6 GB) -ngl 0, MemoryMax=48G +18559M 45.4 GiB The capital of France is Paris.

    Plus the property the fix added and #788 closed on: the residency is now bounded and refusable — a budget below the
    working set refuses with the arithmetic (Raise it to at least 259 MiB or unset it) and 0 NaN, instead of silently
    degrading.

    What this close does NOT claim, stated so it cannot be read as more

    The "+4571M → +162M at the same harness" arm I recorded on this issue's acceptance is not met. At -ngl 0 the 4B
    delta is +4121M, i.e. the same delta the unpatched pin produced, because -ngl 0 materialises the working set
    into GTT — about 1× the model. That is the residency cache doing its job, not the runaway: it is bounded, refusable,
    and it does not scale with the file. Removing it means not materialising weights no HRX op reads, which is the
    placement road and is gated on #674 (open, bucket A, its 1-second reproducer still reproduces). Anyone reading
    "#669 closed" as "HRX at -ngl 0 costs only compute now" is reading it wrong: -dev none is +296M, -ngl 0 is
    +4121M on the same 4B.

    Closing the runaway (unbounded pinning outside RSS on a 217 GiB mmap), keeping the working set on #674. Lane
    pi-i669 asked for exactly this judgement and I am making it on the numbers above, not on the merge.

  10. bong-water-water-bong commented on Nov 3, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    The 217 GiB row, priced by reading the model: the 107 GiB ramp was exactly one tensor, and one budget band declines it

    Work item 4 of this issue's brief is the file-level row (~/models/dsv41 UD-IQ1_S, 217 GiB, -ngl 0, surviving to the
    prompt with a MemAvailable floor >= 100 GiB). No window has been granted, so this pass read the model instead - a GGUF
    census needs no GPU, and it changes what the window is for.

    1043 tensors, 216.97 GiB, and the size distribution is two bands with a gap: per_layer_token_embd.weight (the
    Engram table) at 103.00 GiB, then many MoE expert stacks at 1113.8 MiB each, then 113.97 GiB of everything else
    at or below that.

    host_weight_exceeds_residency() declines a node when ggml_nbytes(weight) > GGML_HRX_HOST_WEIGHT_LIMIT_MB (whole MiB),
    so:

    GGML_HRX_HOST_WEIGHT_LIMIT_MB tensors declined bytes declined
    1114 / 2048 / 4096 / 8192 / 16384 / 32768 1 103.00 GiB (per_layer_token_embd.weight)
    1024 33 (Engram + the 1113.8 MiB expert stacks) 137.8 GiB
    128 123 211.3 GiB

    Every budget from 1114 MiB to 103 GiB declines exactly one tensor, and it is the Engram table. That is the tensor the
    30 Oct probe showed being materialised: the -ngl 0 run at 4a58da9b0 ramped 14 G -> 68 G -> 92 G -> 107 G GTT with
    MemAvailable 99 -> 5 GiB
    , i.e. 107 GiB ~= 103.00 GiB Engram + ~4 GiB.

    Consequence for the row's arms, which are not equivalent:

    arm holds a 100 GiB floor?
    -dev none yes, the reference
    -dev HRX0 -ngl 0, budget unset no, by construction - 107 GiB of pinned GTT on a 122.2 GiB box, killed at a 5 GiB floor on 30 Oct
    -dev HRX0 -ngl 8 no as written - 32.5 GiB GTT / 36-41 GiB floor at the pin (vs 113 GiB / 5 GiB / killed at 4a58da9b0), 60 GiB under the floor
    -dev HRX0 -ngl 0 + GGML_HRX_HOST_WEIGHT_LIMIT_MB=8192 yes, or it refuses loudly - declines the Engram and nothing else, and resident_bytes tracks limit_ (measured: 60.9 MiB at a 64 limit, 2037.2 MiB at 2048), so GTT is bounded by ~8 GiB or #173 stops it with one line

    So the row now runs four arms, and the budget-8192 arm is the one that can actually meet the acceptance. Prediction, on
    the record before the run: hrx0bud8 answers to the prompt with a floor >= 100 GiB if its per-execution working set fits
    8192 MiB, and otherwise stops at the first ubatch with the #173 refusal - either way no 107 GiB ramp. A ramp there
    falsifies the reasoning above.

    Still owed, unchanged: the window. It is priced and enforced in code (~/wt/i674-repro/logs/i669-dsv41-row.sh
    refuses before taking a ticket): pids 5664 + 4513 stopped this boot (30.20 GiB GTT, 100% of the card counter) plus
    the WINDOW-669-OPEN marker. MemAvailable was 81 GiB at the 19:55 check and 59 GiB at 21:15; the floor is
    unreachable by waiting.

    Honest limit: the non-Engram part of the 107 GiB ramp is only bounded below by ~4 GiB (the 30 Oct run was killed
    before the dense weights' first use), so 8192 MiB is plausible, not proven, as a ceiling for it. Census + runner:
    ~/wt/i674-repro/logs/i669-dsv41-census.py, i669-dsv41-row.sh. Nothing merged; no window taken; no device contact
    beyond reading /proc and the shard headers.

  11. bong-water-water-bong commented on Nov 4, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    One line from the memory lane, bookkeeping only - the label this file's default is read through, corrected:

    ggml/src/ggml-hrx/runtime/host-memory.h said GGML_HRX_HOST_WEIGHT_LIMIT_MB defaults to 2048 MiB and that "a single weight larger than the whole budget is refused rather than made resident". The code has said kDefaultMiB = 0 since the same commit (2cbf8afb16), and every bounded path - evict_for, the acquire-time refusal at host-memory.cpp:1881, and the arena refusal with its GGML_LOG_ERROR at :1963 - is inside if (limit_ != 0). So on a default run the bound is off and that refusal can never fire; a reader who takes the header at face value concludes the opposite, which is the misreading this issue keeps inviting. Comment-only fix: 1bit-MONSTER/llama.cpp#191 at dca10712, no behaviour change.

    Nothing here changes the two rows already recorded on this issue: the 103 GiB Engram table is unreachable by the refusal on a default run, and the 217 GiB file has still had no window (6th boot today: 54.2 GiB MemAvailable at 05:53 AST against a 100 GiB floor, 40.9 GiB of GTT held by other lanes).

  12. bong-water-water-bong commented on Nov 4, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    The 217 GiB row is retired, per the 06:2x technical decision

    The row that has been priced every boot since 30 October is closed as not runnable rather than unanswered. Evidence,
    all of it from this lane's own readings on this box:

    boot best MemAvailable seen what else held GTT
    30 Oct (the original measurement) ran, and killed the box at a 5 GiB floor —
    01-02 Nov x2 58-63 GiB peak other lanes' serves
    03 Nov 74.3 -> 77.5 GiB peak in a 100 s series 31.1 -> 48.7 GiB (llama-perplexity, servers)
    04 Nov 01:08 census 74.3 GiB 31 GiB
    04 Nov 05:53 (this boot, 6 min in) 54.2 GiB 40.9 GiB, before my file is even mapped

    Six boots, six peaks between 54 and 81 GiB against the row's >= 100 GiB floor, and the 40+ GiB of GTT is other lanes' work,
    not something this issue can wait out. The question the row existed to answer - does the budget-8192 arm hold a 100 GiB
    floor on the 217 GiB file
    - is answered by reading: resident_bytes tracks limit_ (measured 11-01: 60.9 MiB at a 64 MiB
    limit, 2037.2 MiB at 2048), so the arm is bounded by ~8 GiB, or it refuses loudly (#173). And the half that a run could
    still surprise us on - does the shipped default still OOM the box on this file - was measured on 30 Oct and is a property
    of the default, not of this file: unbounded host-weight residency.

    So nothing is left that a window would teach us. Retired.

    What the default does instead, now that it cannot be measured

    Unbounded by default is kept (the measured case for 0 is real: a bound thrashes small models), but the silence around it
    is fixed in two parts, both now open for review against 1bit/hrx-vulkan-patched:

    • 1bit-MONSTER/llama.cpp#191 - host-memory.h claimed the limit defaults to 2048 MiB and that an oversize weight is
      refused; the code has said kDefaultMiB = 0 since the same commit, and every bounded path is behind limit_ != 0.
      Comment-only.
    • 1bit-MONSTER/llama.cpp#193 - a default run that pins more host weight than the box had available at the first
      materialization logs one line naming the resident MiB and the flag, and stays quiet after that. No refusal, no
      behaviour change; unknown MemAvailable means silence rather than a guessed threshold. The parse has a device-free unit
      test.

    Together those two replace "a 103 GiB weight has no guard and no voice" with "the default is unbounded and says so, once,
    when it passes what the box had".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugperf

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions