Repository navigation
HIP train (Strix Linux + Windows): #79 #93 #94 #101 #104 #107 #123 #124 - #131
Conversation
…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.
…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.
…fragmentation wall
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]>
|
Reiner winbox on Remaining gate: Strix |
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]>
|
Re-merged onto main after #132 landed. The head is now The one conflict was in the Gates on
|
#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]>
|
The winbox smoke on The error: Cause: #127 added 13 lookups:
Fix:
Main is broken for Windows 27B boot until this train merges. |
|
Reiner
|
… 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]>
|
The unit-test failure was a pre-existing flake in #104's tests, not something the merge introduced. Fixed in
Gates on the head: GB10 |
…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]>
|
Found and fixed a Windows boot regression:
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
|
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]>
|
All gates passed. Merging.
Fixes added during gating:
The red "PR benchmark gate" check is the governance-record check (no |
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.w4a16_gemm_t_m128: 27B prefill +5%, bit-identicalstate_is_table(fixes the C≥2 DFlash2hipErrorIllegalAddress)pure virtualabort at shutdownfb983ae74w8a16_gemv_batch8lookup onatlas_hip. Without it, every NVIDIA model refused to boot (caught by reiner job 528)1dd752f54)055chit an OOM at the first prefill (cuMemAlloc1.6 GB with 5 GB free). Joined at73796fd0aafter the fix passed reiner625zzz4(192/192, 0 failed)Gates (head
73796fd0a):pure virtual(spark-server: join the scheduler before exit so teardown can't race HIP's static destructors (#106) #123).Each PR is merged
--no-fffrom 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:
4996d16f0625zzz3(GB10 boot check)4996d16f04996d16f0055c(full)73796fd0a060zz-hip-train-gate-104060z: the same full gate with the 3 GB reserve stopgap removed, so #104 has to size memory on its own73796fd0a63273796fd0aMerge order: this merges once
060zz,632and the Windows smoke pass. #105 stays stacked here and still merges cleanly onto73796fd0a.