Skip to content

HIP train (Strix Linux + Windows): #79 #93 #94 #101 #104 #107 #123 #124 - #131

Merged
AzeezIsh merged 77 commits into
mainfrom
integ/hip-2026-09-28
Sep 29, 2026
Merged

AzeezIsh merged 77 commits into
mainfrom
integ/hip-2026-09-28

Conversation

@AzeezIsh

@AzeezIsh AzeezIsh commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Per-deployment train for the Strix-HIP stack, which covers both Strix Linux and Windows since both compile kernels/strix-hip. It replaces the mixed-architecture trains #112 and #129: a single train let one platform's failure (#104) block every other platform's PRs, and it spent full GB10 gates on code the GB10 never compiles.

PR Footprint Why it's here
#79 strix-hip kernel NVFP4 dequant in w4a16_gemm_t_m128: 27B prefill +5%, bit-identical
#94 strix-hip kernel FP8 prefill GEMM GROUP_M=8 + exact E4M3 decode: 27B prefill +6–13%, bit-identical
#107 strix-hip manifest wy9..16 expected-absent on 27B (fixes Windows 27B DFlash2 boot on main)
#124 strix-hip kernel wyn honours state_is_table (fixes the C≥2 DFlash2 hipErrorIllegalAddress)
#93 shared Rust skips the transposed FP8 copies gfx1151 never reads (−7.2 GB on 27B)
#101 shared Rust + strix-hip kernels DP4A batch8 verify GEMVs (+8.5% decode, output identical)
#123 shared Rust (server) join the scheduler before exit. Fixes #106, the HIP pure virtual abort at shutdown
fb983ae74 shared Rust gates #101's Strix-only w8a16_gemv_batch8 lookup on atlas_hip. Without it, every NVIDIA model refused to boot (caught by reiner job 528)
#104 (+ fix 1dd752f54) shared Rust + shared prefill kernels carries the DFlash2 drafter ctx across turns and primes its memory before KV sizing. Without it, main can't serve the 27B DFlash2 agentic recipe on Strix: strix 055c hit an OOM at the first prefill (cuMemAlloc 1.6 GB with 5 GB free). Joined at 73796fd0a after the fix passed reiner 625zzz4 (192/192, 0 failed)

Gates (head 73796fd0a):

Each PR is merged --no-ff from its own head, so each one closes as merged when this lands.

🤖 Generated with Claude Code


Constituent PR states (2026-09-28): #79, #93, #94 and #101 were closed to cut the open count, and their commits ride here unchanged. #107, #123 and #124 are still open and close as merged. #105 is stacked on this branch, so retire this train by merging it, never by deleting the branch.

Gate record:

Head Box / job Result
4996d16f0 reiner 625zzz3 (GB10 boot check) byte-identical to main on 4 models at short, 2k and 10k; first-token latency unchanged. pass
4996d16f0 winbox (27B smoke) 0 unresolved lookups, 0 faults, ≈24 tok/s code. pass
4996d16f0 strix 055c (full) ST-995 85.53 / 79.38 (ref 84.92 / 76.86, pass). The agentic and C=4 legs failed: OOM at the first prefill, the memory-sizing gap #104 fixes
73796fd0a strix 060zz-hip-train-gate-104 queued after 060z: the same full gate with the 3 GB reserve stopgap removed, so #104 has to size memory on its own
73796fd0a reiner 632 running: GB10 boot identity vs main (#104 edits shared GB10 prefill kernels) plus a clean-shutdown scan
73796fd0a winbox running since 17:26Z: 27B DFlash2 smoke

Merge order: this merges once 060zz, 632 and the Windows smoke pass. #105 stays stacked here and still merges cleanly onto 73796fd0a.

AzeezIsh and others added 30 commits September 21, 2026 02:20
…s NVFP4-packed

On NVFP4-packed checkpoints the shared lm_head DenseWeight pointer
addresses PACKED bytes (e.g. nvidia/Qwen3.8-27B-NVFP4 ships lm_head.weight
as U8 [248320, 2560] — ~636 MB, not ~2.5 GB of BF16). The decode path
already guards this: the drafter's logits GEMM routes through the NVFP4
twin via w4a16, with a comment naming the exact failure — a BF16 GEMM on
packed bytes reads 4x the buffer and faults (CUDA-700 ILA).

Phase G missed that guard in two places:

1. from_weights.rs quantized lm_head_shared as BF16 unconditionally.
   With ATLAS_DFLASH_DRAFTER_FP8=1 the load crashed deterministically on
   gfx1151 — 90+ gfxhub page faults, hipErrorIllegalAddress — after all
   35 per-layer quantizes succeeded, at the lm_head launch.
2. The fp8 decode branches in batch_forward.rs and forward_block.rs fell
   back to dense_gemm_bf16_pipelined on lm_head_shared when the FP8
   mirror was absent — the same OOB read, deferred to first decode.

Fix mirrors the existing non-fp8 dispatch: skip the lm_head quantize
when lm_head_nvfp4 is Some (the packed-twin signal), and collapse the
fp8 branch into the shared dispatch — when no FP8 mirror exists the head
drafts logits through the NVFP4 twin exactly like the BF16 path. On
checkpoints whose lm_head is genuinely BF16 (no nvfp4 twin) the quantize
and the fp8 row-scaled path are unchanged.

Validated on AzeezStrix gfx1151: ATLAS_DFLASH_DRAFTER_FP8=1 now boots
clean — Phase G logs "drafter weights ready as FP8" with the lm_head
quantize skipped — and a probe request drafted via the nvfp4 fallback
(mean_na=2.583, p1=0.917, coherent output). cargo fmt clean.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…umbers

Found on winbox serving Qwen3.8-Flash-Next-NVFP4 (2026-09-20, gfx1151;
identical logic on GB10): on the MinHeap+unittest prompt both decode arms
were cut at 641 tokens mid `values = [8, 3, 1, 6, 4, 2, 7,`.

  serial:  decode_logits_content — "Content-loop watchdog fired
           (period-2…64 repeat); rolled back to boundary, re-steering
           content_tokens=570 dropped=70 rollback=1" → rollback=2 →
           "ending response early (rollback declined)"
  MTP:     emit_step — "Content-loop watchdog fired in MTP/emit path …
           ending response"

detect_content_token_loop_normalized_with maps every numeric token to
NUMERIC_SENTINEL, so a comma-separated list of distinct numbers
normalizes to `N , N , N , …` — a period-2 anchored repeat at
NORM_MIN_REPEATS=4. Any list of ≥5 distinct numbers (test fixtures,
arrays, tables) tripped it.

Fix: a new `VocabMasks::punctuation` (token decodes to non-empty
ASCII punctuation/whitespace) lets the normalized detector learn the
matched period via detect_token_loop_period and decline when the window
is only sentinels and punctuation. A real numeric runaway (`1, 1, 1, …`)
still fires — identical tokens repeat literally, so the exact detector
catches it. `punct == None` keeps the legacy fail-open behaviour.
…tic leg

Cherry-picked from d3279da with the winbox row stripped — that lands
on the Windows PR (#41) so the two PRs do not duplicate records.
…nt declares

The on-device DFlash2 candidate selector reduced each row's unary logits
to a top-4 list and evaluated the bilinear score over only the first 64
selector dimensions (`s_context[64]`, `tid < 64`, two-warp partial sum),
while the loader reads `selector_rank` (256) and `selector_top_k` (16)
from the drafter config and the host fallback already honours both. The
fast path therefore evaluated a cheaper selector than the trained one.

The kernel now takes `top_k`, keeps per-thread/warp/block top-k lists up
to DF2_SEL_MAX_TOP_K=16, builds the context vector over the full rank up to
DF2_SEL_MAX_RANK=256, scores one candidate per warp across the whole rank,
and orders candidates (value desc, index asc) so tie-breaks match the
engine's first-index-wins argmax rule. `Dflash2CandidateSelector::new`
fails fast when a checkpoint exceeds the caps instead of degrading; the
host fallback uses the same order. Pinned: kernel arity (10), the Rust
mirrors of the kernel caps, gb10/strix-hip copies byte-identical, and an
ignored GPU parity test against an f32 host reference.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…ip qwen3.8-27b

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…w + 32K seq

The 2026-09-15 leg (604/1007, mean_na 0.496) collapsed because
ATLAS_DFLASH_CTX_WINDOW defaulted to 4096 — the conditioning accumulator
is indexed by absolute position, so the drafter saw only the prompt head
on long transcripts — and max_seq 24576 rejected the ~25K-tail samples.
Now: ctx_window tracks maxseq, --dflash-window-size 0 = full-prefix
drafter attention, max_seq 32768 covers the dataset peak (~25.2K).

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Warm agentic turns hit the prefix cache, so the target prefill never
re-runs the matched span — and the per-request DflashProposerState threw
away the previous turn's ctx every request. First propose then paid the
full-prompt precompute (~6.5 s at 16K ctx on gfx1151) AND, because
dflash_hidden_save never captured the skipped span, the accumulator's
prefix slots stayed zero — the drafter proposed blind over the cached
prefix, which is the acceptance collapse measured on the long-context
agentic leg.

Mirror the MTP drafter carry (mtp_carry.rs): on free_sequence the ctx
hidden accumulator, paged KV blocks, device block table, watermarks and
positions move into a single proposer-level slot; on the next sequence's
first ctx seed the entry is adopted iff the carried tokens are a prefix
of the new prompt, truncating watermarks to the common span so propose's
incremental path precomputes only the tail. Opt-out: ATLAS_DFLASH_CTX_CARRY=0.
live_state() models a mid-flight state (ctx_len=12), but production only
calls adopt_dflash_ctx when ctx_len == 0. The reject test was asserting
the fixture's own ctx_len as if adopt had written it. fresh_state()
matches alloc_state's output shape.
The piecewise propose graph identity is (generation, block_table_ptr,
ctx_ptr, markov_ptr, lane) — every pointer the identity pins now
survives the turn boundary via the ctx carry (block table + accumulator)
or lives in lane scratch (markov). The only mismatch was the generation
stamp itself, so each ~672-turn leg re-captured 11 subgraphs per request.

carry_dflash_ctx now lifts the generation's graphs out of
propose_graphs before free_state's retire sweep destroys them;
adopt_dflash_ctx re-keys them under the adopting generation and pins the
lane so the baked lane-scratch pointers resolve identically. Rejected
carries destroy the lifted graphs (recapture is a single warmup+capture
pass). Single-seq path always captures on lane 0, so the common case is
a pure re-key.
update_dflash_ctx_len_after_prefill unconditionally assigned
ctx_len = chunk_start + proc_count after the adopt attempt. On a
cache-hit warm turn the processed suffix can end below the adopted
common prefix, regressing ctx_len under ctx_committed and tripping
the propose-side 'ctx_len - committed' subtraction (usize underflow).

Clamp with .max() instead — the adopt watermark is authoritative for
coverage it actually installed.
max_ctx_len was derived from the drafter's 4096-token sliding-attention
window while the accumulator itself is allocated at max_seq_len and the
paged-attention ctx budget follows ctx_window. Prompts past 4096 slid the
accumulator and acceptance collapsed to exactly 0 (probe: mean_na=0.000
on 7K prompts vs 4.571 on 1.3K). Tie the retention cap and the drafter
paged-KV pool to ctx_window (default 4096 unchanged; ctx_window=0 now
cleanly disables ctx conditioning instead of overflowing).

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The DFlash ctx accumulator kept the FIRST max_ctx_len positions during
prefill and dropped the tail, then decode-time slides retained
mid-document rows next to the cursor — a multi-thousand-token hole that
collapsed acceptance to exactly 0 on prompts past the cap (the same
signature as the Sept agentic regression).

Rework to dense-window semantics: prefill captures append at a derived
cursor (base + chunk_start - origin), the post-prefill update is a pure
idempotent recompute, and exceeding the cap slides to the NEWEST half
with absolute positions preserved — matching commit_ctx's policy.

Carry adoption moves into the first capture call so the carried
accumulator install can't orphan writes, and adopts only rows whose
absolute position falls below this prefill's start — a slid carry's
non-zero-based positions no longer get restamped or double-claimed.
The adopt gate now validates rows by position coverage (positions <
min(common, prefill_start)); the old ctx_len=12 fixture fell below
MIN_CARRY_TOKENS=256 and was correctly rejected. Size the live_state
fixture at 300 rows with matching watermarks/positions; the divergence
test now genuinely truncates (300 carried -> 280 adopted).
The causal/SWA mask compared the query's absolute RoPE position
(q_rope_pos) against KV slot indices. That only works while slot index
== absolute position. After the DFlash ctx window slides (dense
compaction), slot i holds position ctx_positions[i] >> i, so every ctx
row landed outside the sliding window and attention emitted zeros —
exactly the acceptance=0 collapse on >ctx_window prompts.

Mask in slot space (q_offset): slots are dense, recency-ordered, so
"newest window slots" is the correct SWA semantic under slides and
carry-adopt holes alike. Non-indirect callers are unaffected
(q_rope_pos == q_offset there). Fixes on strix-hip, gb10, strix.
…fill

The accumulator was allocated at max_seq_len rows (~1.36 GB at 26K)
but the dense window never legitimately holds more than max_ctx_len
rows: decode appends slide before writing, and the prefill capture
now slides mid-prefill when a long prompt would overflow — keeping
the newest rows with a non-overlapping in-place copy (dst_end <=
src_start since needed > max_ctx_len implies cursor > max_ctx_len -
proc_count). Carry/pool buffers stay uniform-sized. Frees ~0.5 GB at
ctx_window=16384, needed for Marconi snapshot slots + prefix caching
to fit under the strix device ceiling.
… to physical rows

The chunked-prefill capture was passed layer_kv_write_start (a constant
write floor, 0 on cold prefills) as chunk_start, so every chunk's
captures aliased rows [0..proc_count) and update_dflash_ctx_len_after_
prefill computed ctx_len=total — whose retention slide then memmoved
rows far past the ctx_window-sized accumulator, page-faulting the GPU
(SDMA GCVM_L2_PROTECTION_FAULT). Pass effective_seq_len_start (==
proc_start, the absolute position of the first computed token) so
captures append contiguously; bound the update slide by ctx_acc_rows
for the all-cached-chunks edge; guard the mid-prefill slide against
degenerate windows.
Priming inside from_weights ran after the residual KV allocator had
already consumed the device map — the 629 MB accumulator then couldn't
find contiguous space and startup OOM'd. Move the pool to a global so
factory::build can prime one buffer before KV sizing; the alloc counts
as Atlas-own so the KV residual self-shrinks. from_weights keeps an
only-if-empty fallback prime for other build paths.

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The reserve was only ever subtracted from the KV budget — never held
contiguously — so the ~100 post-KV allocs (Marconi per-layer regions,
drafter KV, NVFP4 staging) competed for a fragmented tail and died on
cuMemAlloc with GBs nominally free. Holding the reserve across KV sizing
and releasing it right after PagedKvCache::new gives those allocs a clean
region; KV sizing is unchanged (balloon replaces the reserve subtraction).
~100 per-layer snapshot allocations shredded the unified-memory map badly
enough that later ~40MB allocs failed with GBs nominally free. One blob per
kind (h + conv) with per-layer offset views keeps the region coalesced;
per-layer scatter remains as a fallback when the blob cannot allocate.
Post-free drafter demand (KV pools + fused weights + NVFP4 staging) is
~1.1 GiB; the 1 GiB balloon left the last ~125 MB spilling into the
fragmented tail and failing with 4.5 GB nominally free.
Encodes the memory profile that clears the ~55.5 GB allocatable ceiling
(util 0.84 + 12 Marconi slots @ 8K-token anchors + prefill 1024) on the
balloon/contiguous-blob allocator stack. Requires carry >= 80cd404.
… scripts

dflash_agentic_only.sh: util 0.84 was host-OOM-killed mid-leg on the
unified-memory Strix box (~56GB spark RSS + harness crossed the 61GB
line, kern.log 2026-09-24T05:08Z). Default to 0.81, 12 Marconi slots @
512-block anchors (8K tokens), prefill 1024, ctx window 12288,
dflash-window 2048, max-seq 26624. WT/GPU_UTIL/SSM_* now env-overridable.
Document that the pre-probe also absorbs one-time JIT/graph-capture so
turn 1 doesn't trip the harness turn timeout (58 turns dropped on the
last run).

serve_dflash2.sh: keep 0.84 standalone default, note 0.81 when a harness
is co-resident.
The 2026-09-24T1632Z leg ran util 0.81 → 2,704-token KV pool → 967
'KV cache exhausted' mid-prefill failures → the serve returned empty
HTTP-200 completions the harness counted as successful (965/1007 turns,
score 0.0048). A starved pool produces a silently-invalid leg.

- abort leg when 'max KV tokens' < KV_MIN_TOKENS (default 40000)
- flag the leg INVALID in chain.log when the serve log shows any
  'KV cache exhausted' lines
- HOST env passthrough so the harness can run off-box (co-resident
  harness at util ≥0.84 host-OOMs; at ≤0.82 the pool starves)
- SSM_SLOTS comment: under-requesting under-sizes the preflight
  reserve balloon, the contiguous Marconi blob spills to the
  fragmented tail and startup dies
- warmup probe filler 1400→1000 lines (was tripping the seq cap)

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…Strix-validated)

Rejoins the HIP train with its GB10 fix 1dd752f (oversized prefill chunk skipped
the window slide; the next chunk's slide read past the buffer). Verified on reiner
625zzz4: 192/192 agentic samples, 0 failed, 87 oversized chunks handled, 0 faults.
Needed on Strix: without it the 27B DFlash2 serve OOMs at first prefill (055c).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@AzeezIsh

Copy link
Copy Markdown
Contributor Author

Reiner 632 (GB10 boot check on 73796fd0a, #104 included): pass. Greedy output is byte-identical to main at short, 2k and 10k on all 4 cached models (Flash-Next, 27B, Nemotron Lightning, Qwen3.6-35B-A3B), |Δlogprob| 0.00000. 10k first-token latency is unchanged (27B 13.03 → 13.00 s). The invalid-free counts at shutdown (45–147,411) match this train's earlier run and main's behaviour. They're fixed by #121 in #132, not here.

winbox on 73796fd0a: the 27B DFlash2 smoke passed. 0 unresolved lookups, 0 faults, code ≈24–26 tok/s, and output hashes identical to the 4996d16f0 run.

Remaining gate: Strix 060zz (full gate, reserve stopgap removed).

@github-actions github-actions Bot added the needs-rebase Conflicts with main — its green checks are NOT real (GitHub skips merge-commit workflows) label Sep 29, 2026
One conflict, in dflash_head.rs's module list: #104 adds `mod carry;` and #127
adds `mod batched_ctx;`. Keep both. The two paths compose. #127's batched
propose records ctx chunks from the same `committed = ctx_committed.min(ctx_len)`
watermark as the serial path, so #104's carried prefix is skipped by both.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@AzeezIsh

Copy link
Copy Markdown
Contributor Author

Re-merged onto main after #132 landed. The head is now 56b3d6a05 (73796fd0a + main b03dc7363).

The one conflict was in the dflash_head.rs module list: #104 adds mod carry; and #127 adds mod batched_ctx;. Both are kept. The two features compose because #127's batched propose records ctx chunks from the same ctx_committed watermark as the serial path, so #104's carried prefix is skipped either way.

Gates on 56b3d6a05:

#127 added 13 lookups: gated_delta_rule_wy5..16_defer and
gated_delta_rule_commit. Their kernels exist only in
kernels/gb10/common/gated_delta_rule_wyn.cu. strix-hip ships a
gated_delta_rule_wyn module without them, so plain try_kernel resolved
all 13 to handle 0, and the boot kernel gate refused qwen3.8-27b on
gfx1151:
"Error: 13 unresolved kernel lookup(s) for (qwen3.8-27b, gfx1151, nvfp4)"
(winbox, 56b3d6a).

Use try_kernel_gated(!cfg!(atlas_hip), ...), the same fix as #101's
batch8 lookup. gdn_defer_active already requires both handles to be
non-zero, so HIP keeps the eager commit. GB10 behaviour is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@AzeezIsh

Copy link
Copy Markdown
Contributor Author

The winbox smoke on 56b3d6a05 caught a boot refusal that main has had since #132. Pushed the fix as 303ac9d7a.

The error: Error: 13 unresolved kernel lookup(s) for (qwen3.8-27b, gfx1151, nvfp4), so the 27B DFlash2 server never came up.

Cause: #127 added 13 lookups: gated_delta_rule_wy5..16_defer and gated_delta_rule_commit. They use plain try_kernel, but those kernels exist only in kernels/gb10/common/gated_delta_rule_wyn.cu. strix-hip ships a gated_delta_rule_wyn module without them, so all 13 resolve to handle 0 on gfx1151. This is the same class as #101's batch8 lookup (and #87).

Fix: try_kernel_gated(!cfg!(atlas_hip), …). gdn_defer_active already requires both handles to be non-zero, so HIP keeps the eager commit.

  • On GB10 the code is identical. Reiner 639's check of 56b3d6a05 still applies.
  • On strix the behaviour is identical too, since the handles were already 0 there. Strix 060zz had already started on 56b3d6a05, so it's allowed to finish; the only difference on 303ac9d7a is the boot warning.
  • Windows is re-running the 27B smoke on 303ac9d7a.

Main is broken for Windows 27B boot until this train merges.

@AzeezIsh

Copy link
Copy Markdown
Contributor Author

Reiner 639 (GB10) on 56b3d6a05. GB10 code is identical at 303ac9d7a, since the HIP fix is cfg-gated.

… pool lock

free_state_tests and free_state_carry_tests exercise the process-global
CTX_ACC_POOL. Only some of their tests took POOL_TEST_LOCK. Under the
default parallel test runner, the unlocked ones raced the locked ones:
9/30 parallel runs failed on 73796fd (#104 alone) and 10/30 on
56b3d6a, while single-threaded runs were 30/30 green on both.
The failures were real_free_state_success_path_reclaims_all_resources,
ctx_carry_rejects_divergent_prefix_without_leaking and
real_free_state_block_table_free_failure_restores_handle_for_retry.

Every test in both files now takes lock_and_drain_pool(). These are the
only test files that touch the pool. Test-only change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@AzeezIsh

Copy link
Copy Markdown
Contributor Author

The unit-test failure was a pre-existing flake in #104's tests, not something the merge introduced. Fixed in a7674ee16 (test-only).

  • Single-threaded: all 112 dflash_head tests pass on both 73796fd0a and 56b3d6a05.
  • Parallel (the default runner, 30 runs each): 9/30 failed on 73796fd0a (spark-model: carry the DFlash2 drafter ctx across turns (Strix-validated ctx-carry stack onto main) #104 alone) and 10/30 on 56b3d6a05.
  • Cause: some free_state_tests / free_state_carry_tests tests used the process-global CTX_ACC_POOL without taking POOL_TEST_LOCK, so they raced the tests that did.
  • Fix: every test in both files now takes lock_and_drain_pool(). These are the only test files that touch the pool.
  • On a7674ee16: 0/30 parallel runs failed.

Gates on the head: GB10 639 passed. Strix 060zz is running. Winbox ST-995 is running. The code changes since those were started are 303ac9d7a (HIP-only lookup gating) and a7674ee16 (test-only).

@github-actions github-actions Bot removed the needs-rebase Conflicts with main — its green checks are NOT real (GitHub skips merge-commit workflows) label Sep 29, 2026
…fails

#104's reserve balloon holds the inference reserve as a real allocation
while the KV pool is claimed. That raises peak allocation at that moment by
the reserve: 4.1 GB on Flash-Next, so 86.4 GB instead of 82.3 GB at util
0.90. On Windows gfx1151, Flash-Next with MTP (#80 merged onto this train)
then failed to boot:
"cuMemAlloc_v2 failed: status 2, requested 102449152 bytes (device reports
11980.1 MB free / 96.0 GB total)". That request is the KV pool itself
(6253 blocks x 16 KiB). The same recipe booted without the balloon.

- build_model: if PagedKvCache::new fails while the balloon is held, free
  the balloon and retry once. This is the pre-balloon behavior; the
  balloon's anti-fragmentation benefit is kept wherever it fits.
- PagedKvCache::new frees the layer pools it already claimed when a later
  alloc fails, so the retry starts from the same free memory.
- KvCacheConfig derives Clone for the retry.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@AzeezIsh

Copy link
Copy Markdown
Contributor Author

Found and fixed a Windows boot regression: 6fb49ff1d. #80's Flash-Next MTP recipe, merged locally onto this train, failed to boot on winbox:

cuMemAlloc_v2 failed: status 2, requested 102449152 bytes (device reports 11980.1 MB free / 96.0 GB total)

Cause: #104's reserve balloon. It holds the 4.1 GB inference reserve as a real allocation while the KV pool is claimed.

Fix: if PagedKvCache::new fails while the balloon is held, free the balloon and retry once, which is the pre-#104 behavior. PagedKvCache::new now also frees the layers it already claimed when a later allocation fails, so the retry doesn't lose memory to the failed attempt.

6fb49ff's retry wasn't enough on winbox. After the balloon was freed,
the KV layer-pool claim still failed: "requested 102449152 bytes (device
reports 16067.2 MB free / 96.0 GB total)". A freed multi-GB block there
does not become allocatable again in time. Pre-KV usage without the
balloon is the same 80.0 GB that booted on #80 alone.

On Windows, skip the reserve balloon. reserve_net then falls back to the
virtual reserve subtraction, which is #80's path. Linux (Strix, GB10),
where the balloon's anti-fragmentation benefit was measured, is
unchanged. So are the drafter balloon (the Windows 27B DFlash2 ST-995 passed
with it) and the retry.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@AzeezIsh

Copy link
Copy Markdown
Contributor Author

All gates passed. Merging.

platform head result
Strix Linux, full (060zz) 56b3d6a05 agentic 1007/1007, 0 failed, score 0.6185, 0 KV-exhausted with no 3 GB reserve (#104 sizing); C=2 and C=4 clean with batched GDN conv+WY engaged (#124); ST-995 85.23 / 78.31 (ref 84.92 / 76.86); every teardown joined, pure_virtual=0 (#123)
GB10 (639) 56b3d6a05 byte-identical to main on 4 models; C=2/4/8 cross-contamination 0 contaminated
Windows 27B 303ac9d7a ST-995 85.33 / 79.01, 0 faults
Windows 27B e539e53de smoke with identical hashes, ~28 tok/s; agentic-webserver ×10: 10/10 ok, 10/10 followed directions, 0 faults
Windows, #80 merged on top e539e53de Flash-Next serial and MTP hashes unchanged; agentic ×10: 10/10, 0 faults

Fixes added during gating:

e539e53de and 6fb49ff1d don't change Linux behaviour when the first allocation succeeds, so the 060zz and 639 results still apply.

The red "PR benchmark gate" check is the governance-record check (no governance/pr-131.jsonl), not a benchmark result. #105 (stacked on this branch) gets retargeted to main after the merge. The branch isn't deleted.

@AzeezIsh
AzeezIsh marked this pull request as ready for review September 29, 2026 13:06
@AzeezIsh
AzeezIsh merged commit 94c0ed8 into main Sep 29, 2026
25 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

strix-hip (Linux): spark serve aborts at exit with 'pure virtual method called' after a clean drain

1 participant