Skip to content

qwen4_exp: seven fixes for long-form serving of Qwen3.8-Flash-Next on a GB10 - #23

Merged
AzeezIsh merged 25 commits into
Atlas-Inf:mainfrom
andrew-vogulkin:assist/flashnext-longform-fixes
Sep 24, 2026
Merged

AzeezIsh merged 25 commits into
Atlas-Inf:mainfrom
andrew-vogulkin:assist/flashnext-longform-fixes

Conversation

@andrew-vogulkin

@andrew-vogulkin andrew-vogulkin commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Seven fixes for serving Qwen3.8-Flash-Next (qwen4_exp) past a few thousand tokens on a single GB10, each found by running the RadixArk NVFP4 checkpoint through a long-form generation benchmark (two-round tower-defense build, 26K-token rounds, 10–18K-token review prompts) on main@4df6e609. That run needed eleven serve attempts and five distinct workarounds to complete once; with this branch the same benchmark ran end to end on default settings with no environment pins and no server errors.

# Commit Defect on main Change
1 e623e010 prompts > 8192 tokens refused twice: ATLAS_PLE_MAX_TOKENS honoured below the 8193-wide chunk; n-gram row cache a fixed 65536 slots (a chunk pins 8193 × 16 rows) row cache derived from max_batch_tokens × ngram_heads (power-of-two, floored at 65536), env stays an override; a too-low PLE cap is clamped up with a warning
2 561be215 ATLAS_QSA_MAX_TOKENS defaulted to 32768 regardless of --max-seq-len; decode died at position 32768 with a 500 ModelConfig.max_seq_len (serve-time, like max_batch_tokens); indexer capacity derives from it; env can only raise it
3 16af4d33 verify/MTP step errors set finished and the client received finish_reason="stop" — a 1,679-token truncation looked like success; the GDN QKVZ projection swallowed the cuBLASLt error before falling back to the scalar GEMM engine_error on the sequence → finish_reason="error" (new FinishReason::Error), blocking clients get the error (500); cuBLASLt failure logged with M/N/K and operand low bits
4 35028544 after a sticky CUDA error the fault latched and /health went 503, but the scheduler loop never returned to main.rs's exit path; the process held ~100 GB and 500'd for hours scheduler checks the global latch each iteration, finishes in-flight sequences as engine errors and breaks
5 f4e81291 content-loop watchdog rollback restored SSM state but never the QSA/PLE aux state → QSA: decode at pos 2864 but 2932 tokens ingested → 500 save/restore_decode_aux_snapshot on Model (reuses collect_aux_states/apply_aux_states, keyed like the SSM ring), taken with the SSM boundary snapshot; RollbackFallback::NoAuxSnapshot declines when missing — see status note below
6 86bdf303 the MTP gate compares seq_len < verify_context_limit at dispatch only; a sequence at 2049 verifies across the QSA inert bound (2051) and the next verify refuses ("QSA selection active for row 1 on the batched ms path") latch disable_mtp once seq_len + num_drafts + 1 >= limit (mtp_gate::qsa_latch::crosses_inert_bound), plus a pre-mutation guard at the batched multi-seq entry
7 97aa9fa4 continuation prefill chunks faulted CUDA_ERROR_MISALIGNED_ADDRESS (1,117-token and default 8,193-token chunks; even widths survived) hc_pre_gemm packed its scratch as raw byte products; inj_pre is lay × 8 bytes, so an odd slab put up_wt 8 bytes off a 16-byte boundary and dense_gemm_bf16_pipelined faulted. One shared 256-byte-aligned layout (spark_runtime::buffers::hc_pre_scratch_layout) now both sizes and places the sub-buffers

d32605b2 merges current main (6c5f17da); the one conflict was the nemotron serial early-return and the QSA guard both at the top of decode_multi_seq_inner (nemotron first, then the guard).

Verification

  • Every commit: cargo fmt --check, cargo clippy --workspace --tests (workspace denies clippy::all), cargo test -p spark-model --lib, cargo test -p spark-server --lib --bins (2,310 tests), plus the touched crates' unit tests. New unit tests: n-gram slot derivation, the aligned scratch layout over odd/even slabs, engine_error → "error", NoAuxSnapshot, the MTP latch table.
  • On the GB10: the 13,397-token prompt that faulted prefills at 4,096 and default 8,192 chunking; item 4 exits the process after a fault; item 6 logs mtp declined: qsa_active seq_len=2050; the benchmark round trip (9.6K + 13.9K generated tokens, a 10K-token review prompt through an 8,193-wide chunk) ran with zero server errors.
  • The D-4 attribution came from CUDA_LAUNCH_BLOCKING=1 (grid [80,9] = [10240/128, 1117/128]); compute-sanitizer was ~100× too slow to reach the failing chunk.

Status notes for reviewers

  • Item 5 is mechanically correct but not yet complete — resolved by items 8 and 9 below (the one-token lag was the token-buffer rewind, not the snapshot).
  • The benchmark gate will be red: this branch touches crates/ and carries no new records. Happy to re-measure on the GB10 once the base is settled.
  • Not included: an admission-time 400/clamp when prompt + max_tokens exceeds the indexer capacity (the mid-stream guards now name --max-seq-len).

Second batch (2026-09-04)

# Commit What Why
8 6c5b61c3 + 7db64cca Watchdog rollback re-fed the boundary token at the wrong position. rewind_buffers now takes the caller's unfed tail (0 at the content-loop / inter-tool-prose site, which runs before the step pushes its token; 1 at the fuzzy detector, which runs after) and pops every fed token from the boundary onwards, so the re-fed boundary token lands exactly where the SSM/aux snapshot expects it A fixed dropped decoded the boundary token twice at the before-push site (QSA: decode at pos N+1 but N tokens ingested; pure-attention models got a duplicate KV row). A fixed dropped + 1 discarded a real token at the after-push site (pos N but N+1 ingested)
9 7db64cca handle_content_token returns true on a rollback; the step drops the token it had just sampled (budget and content count refunded) instead of pushing it That token came from the discarded context: a phantom, never-decoded token that reached the client and put every later rollback one position off
10 953820a0 [behavior].use_sampling_preset_penalties_for_core (default true, no behaviour change for any other model); Flash-Next's MODEL.toml sets it false. Tool-calling requests keep [sampling.tools]; explicit request values always win The card's non-thinking presence_penalty = 1.5 reached every plain chat/completions request. Over a 20K-token single-file build it suppresses every token already emitted: two benchmark runs shipped dead/inert files; with presence 0 the identical engine and sampler wrote a working 51 KB game
11 61f1993b skip_lm_head_quantization() returns true for qwen4_exp (BF16 head by default; --lm-head-dtype nvfp4 still forces the packed head) The checkpoint ships lm_head in BF16 and long-form generation is the argmax-flip regime the flag's own doc describes; the 27B recipe already pins bf16
12 c120f479 --attn-proj-dtype bf16 keeps the full-attention Q/K/V/O at checkpoint BF16 (dense GEMV/GEMM arms; the BF16 Q/K/V sources are resident anyway, O keeps a copy via set_o_dense_bf16); validated enum, default unchanged ModelOpt's ignore list keeps every self_attn projection at BF16 and so does this checkpoint; Atlas requantized them to NVFP4 at load

Verification: cargo fmt --check, cargo clippy --workspace --tests, and the crate suites (atlas-kernels, atlas-core 171, spark-model 779, spark-server 2,327) at 7db64cca. New unit tests: preset_penalties_follow_the_core_opt_in_but_always_apply_to_tools, rewind_after_push_site_keeps_the_unfed_token_out_of_the_count, rewind_leaves_the_boundary_token_for_the_next_decode. On the GB10 with --content-loop-watchdog on: a forced-loop probe produced two fuzzy-detector rollbacks, and a 19K-token build produced three content-loop rollbacks with re-steer — zero indexer desyncs (before item 8 the first rollback failed).

Two observations for reviewers, not changed here:

  • The content-loop watchdog false-positives on code. It fired on a coordinate array ([[0,5],[4,5],[4,1],…, period ~6 tokens), the re-steer dropped the array, the model wrote it again, and the per-sequence cap ended a coherent 21 KB file at 8.4K tokens. Code workloads need it off or a higher --content-loop-min-repeats.
  • Throughput: ATLAS_D2H_SPIN_SYNC=1 and ATLAS_PLE_FAULT_THREADS=128 are neutral on this model (15.4 tok/s either way). The decode path is graph-vetoed model-wide (QSA host top-k, PLE host hash), with 12 D2H syncs + 36 PLE stream barriers per token; a device-side top-k and an event in place of the PLE barrier are the real levers.

Third batch (2026-09-04, from the llama.cpp gap study)

Measured on the same GB10 against llama.cpp serving the same model at 24–25 tok/s (Atlas 15–17). Graph capture was first ruled out as the cause: GGML_CUDA_DISABLE_GRAPHS=1 costs llama.cpp only ~3% (24.8/25.1 → 24.4/24.1 tok/s).

# Commit What Measured
13 69cb6625 PLE: record an event behind the gather kernel and wait on it in release_prev_pins instead of a full stream sync; stage the slot upload through pinned memory. GpuBackend gains event_create/record/synchronize_on_stream/destroy with a sync fallback neutral (14.5/15.1 tok/s vs 15.5/15.4): the PLE sits on one model layer, so this was one barrier per token, not 36
14 ad7203f5 ATLAS_MOE_DECODE_ARM=grouped routes every layer's single-token MoE through the tensor-core grouped-GEMM arm (forward_prefill(M=1)); default unchanged grouped arm 5.3 tok/s vs scalar 15.0 — three times slower at M=1; the scalar FP32-FMA gemv stays. The remaining MoE lever is a vectorised NVFP4 GEMV (llama.cpp's mul_mat_vec_q shape), after an ncu bytes-per-token floor
15 0b9ada13 qsa_select_topk: device-side block selection with torch.topk's tie-break (lower index wins), ascending block order, written straight into sel_dev — removes the per-attention-layer D2H copy + host sort + H2D (12 stream syncs per token). Behind ATLAS_QSA_DEVICE_TOPK=1; ATLAS_QSA_TOPK_VERIFY=1 runs both arms and fails on the first mismatch parity: 1,400 tokens verified, no mismatch. Speed: no change below the 2,051-token inert bound (selection not active); with a 3,882-token prompt 13.1/13.5 → 13.8/13.9 tok/s (+3–5%)

Full benchmark on this head (ATLAS5, BF16 head + --attn-proj-dtype bf16, device top-k, 4M-slot PLE cache): 23.2K tokens at 14.7 tok/s and 23.7K at 13.9, a 62 KB game that was playable out of the box with no defects found, versus one logic bug on the previous head. Decode speed is unchanged; the ~18 ms/token gap to llama.cpp is in the decode kernels (MoE GEMV, GDN recurrence, hyper-connection sites), not in host synchronisation, PLE placement or graph capture.

Fourth batch (2026-09-06): what the profile said, and the two changes it led to

nsys over 642 decoded tokens (BF16 head, NVFP4 attention, device top-k, 3.9K-token prompt, ~69 ms/token): dense_gemv_bf16 73 launches = 24 ms (42%) — 72 of them are the 36 GDN layers' in/out projections, which this loader keeps in BF16 (4.15 GB/token, bandwidth-bound); hyper-connection stage 3 (hc_pre_finish) 97 × 121 µs = 11.7 ms; MoE ≈ 8.3 ms at ~77% of achievable bandwidth (already close to its floor); ~1,000 launches/token. Profile and analytic floors: ~/claude/reports/atlas-flashnext-decode-profile-2026-09-06.md on the bench machine.

# Commit / flag What Measured (3,882-token prompt, sparse selection active)
16 ATLAS_QWEN4EXP_BF16_GDN=0 (existing loader path, no code) requantise the GDN projections to NVFP4 at load 15.0 → 18.3 tok/s. The loader comment that "GDN weight bandwidth is not what bounds decode" dates from a 2.2 tok/s configuration; today those projections are the largest term. Costs ~6 GB (KV budget 21 → 14 GB at 0.95 util)
17 e7b6af2f hc_pre_finish_x4: one warp per stream, lanes over 32 output dims — 4× the threads of the thread-per-d kernel. Each (d, s) accumulator still sums r = 0,1,… in one FP32 register (--fmad=false) and the four products fold in s order in one thread: bit-exact (greedy output hash identical to the previous binary). ATLAS_HC_FIN_X4=0 keeps the old kernel 18.3 → 20.3 tok/s
18 3fff25af hc_pre_finish: rank loop unrolled ×8 with hoisted loads, same order neutral (kept: harmless, documents the finding)
19 22321152 qsa_select_topk: scores staged in shared memory neutral on tok/s (the kernel is 0.7 ms/token)
20 0acad1c8 housekeeping for the ≤500 LoC gate: rollback.rs → rollback_rewind.rs child (rewind_buffers + apply_rollback), ple/layer.rs → seq_state.rs child (PleSeqState, pub(super) fields). No behaviour change —

Full benchmark on this head (ATLAS6, watchdog off): 21.6 / 20.3 tok/s on 20.6K-token rounds versus 14.7 / 13.9 on the previous head; llama.cpp serves the same model on this GB10 at 24–25. Quality gate for the NVFP4 GDN requantisation, one sample: the ATLAS6 game shipped with two defects (a helper called by the wrong name, an unbound level variable in the turret loop), each repaired by a literal one-change fix round, and then played through cleanly (four waves, correct gold/score/lives). The previous head's game had one defect. Not conclusive either way; the benchmark pages carry both.

Measured and not adopted: ATLAS_GDN_FUSED_NORM=1 (recurrence + gated norm fused) — no speed change and the greedy output differs, so it is not the bit-exact swap it looks like. --lm-head-dtype fp8 / nvfp4 add ~1 / ~1.5 tok/s on top of the above at the documented argmax-flip risk.

Fifth batch (2026-09-07): greedy tie-break restored to first-index-wins

# Commit What Measured
21 db0bc097 argmax_bf16.cu back to the 61f6976 kernel (first strict maximum wins); verify_pipeline_helper/argmax.rs, verify_pipeline_helper.rs and logit_processors/mod.rs back to the first-wins helper; argmax_tiebreak_contract.rs now locks first-wins on the nine bfcl-subset samples the last-wins rule flipped: 9/9 back to the 2026-09-02 outputs (main: 0/9); full gate draw 86.53 / 83.38 = the 2026-09-02 record to the digit; all ten gates PASS at this head

Why in this PR: the benchmark gate cannot pass for any engine-touching PR while main's 27B bar (83.32) was measured under first-wins and main decodes under last-wins. First-index-wins is also what llama.cpp's greedy sampler and vLLM's torch.argmax do. If the maintainers would rather keep last-wins and re-baseline the bar instead, this commit is the one to drop.

Totals — main as found vs this PR (same model, hardware, prompts)

Decode speed (tower-defense rounds, R1 / R2 tok/s):

R1 R2 vs llama.cpp (24.8)
ATLAS — main@4df6e609 as found 17.3 16.3 70%
ATLAS4/5 — BF16 head + BF16 attention 15.2 14.0 61%
ATLAS6 — this PR's head 21.6 20.3 87%

Net against main: +25% on both rounds. Against the BF16-precision configuration the profile-driven changes were measured from: +44%. Per-token cost on the 3.9K-token single-prompt A/B: 69 ms → ~49 ms.

Where it came from (single-prompt A/B, bit-exact unless noted):

Change tok/s Gain
base: BF16 head, NVFP4 attention, BF16 GDN 15.0 —
GDN projections requantised to NVFP4 (ATLAS_QWEN4EXP_BF16_GDN=0) 18.3 +22%
hc_pre_finish_x4 (e7b6af2f) 20.3 +11%
device-side QSA top-k (A1, 0b9ada13) — +3–5% while sparse selection is active
FP8 / NVFP4 lm_head 21.2 / 21.7 +4–7%, not adopted (argmax-flip risk)

Tried and not adopted: grouped MoE decode arm (3× slower), fused GDN norm (not bit-exact), 4M PLE slots + event-scoped pins (neutral, kept as harmless), D2H spin sync and PLE fault threads (neutral).

Reliability and correctness, main vs this PR:

main this PR
serve attempts to get one complete benchmark run 11 1
server errors during a benchmark HTTP 500s; engine errors laundered into finish_reason="stop" 0; engine errors surface as error / HTTP 500
prompts > 8,192 tokens refused (PLE cap off by one; 65,536-slot row cache) accepted with the default 8K chunked prefill
loop-watchdog rollback desynced the QSA indexer → 500 rewinds by fed tokens, 0 desyncs on the GPU probe (watchdog left off for code: it false-positives on coordinate arrays)
request sampling vs llama.cpp MODEL.toml presence penalty 1.5 applied silently preset penalties opt-in (use_sampling_preset_penalties_for_core), equal footing
tower-defense game dead on load playable

Cost: resident memory ~100 → ~108 GB with NVFP4 GDN, which cuts the KV budget from 21 to 14 GB at 0.95 utilisation (48K instead of 64K practical context on a 128 GB GB10).

Other models: all ten PR benchmark gates PASS at this head (records committed). bfcl-subset on Qwen3.8-27B is back at 86.53 / 83.38 after the tie-break revert; the miss it showed under main's last-wins rule reproduces on main's own binary and harness (see "PR benchmark gate" below).

Still open (the last 13% to llama.cpp): BF16 lm_head ≈ 6 ms/token, the remaining hyper-connection launches ≈ 5 ms, conv1d launched separately from the GDN recurrence ≈ 1 ms (existing fused kernels are not bit-exact), ~1,000 launches/token of gaps.

PR benchmark gate (gb10) — all ten PASS at head db0bc097 (records commit 3d922247)

Gate Subject At 0acad1c8 (last-wins, 2026-09-07) At db0bc097 (first-wins restored, 2026-09-08)
vision-fidelity Qwen3.6-35B-A3B-FP8 PASS PASS
video-fidelity Qwen3.6-27B-NVFP4 PASS PASS
decode-floor Qwen3.8-27B-NVFP4 PASS 22.1 tok/s PASS 22.7 tok/s (floor 20.5)
ttft-warm-gate / ttft-cold-gate Qwen3.6-35B-A3B-FP8 PASS PASS
ssm-state-poisoning-gate Qwen3.6-35B-A3B-FP8 PASS 12/12 PASS 12/12
concurrency-sweep Qwen3.8-27B-NVFP4 PASS c1 20.8 · c16 89.5 PASS c1 19.0 · c4 50.8 · c8 58.8 · c16 85.6 (see note)
agentic-webserver Qwen3.6-35B-A3B-FP8 PASS 10/10 PASS 10/10
bfcl-subset-echolp Qwen3.6-35B-A3B-FP8 PASS 87.95 / 87.99 PASS 87.95 / 87.99
bfcl-subset Qwen3.8-27B-NVFP4 FAIL 86.23 / 83.10 PASS 86.53 / 83.38 (bars 83.42 / 83.32) — the 2026-09-02 numbers to the digit

Two gates needed a second run at db0bc097: decode-floor's first attempt died before serving ("No memory left for KV cache") because the previous gate's server had not yet released ~3 GB — a settle-time artefact; concurrency-sweep's first attempt was INCONCLUSIVE because one of the eight natural prompts at conc 8 paraphrase-looped and the SimHash watchdog cut it at 243/320 tokens, below the sweep's 80% vacuity floor. On the re-run the same prompt was cut at 309 and every floor was met. That loop is greedy-path behaviour of this checkpoint under first-wins (the last-wins run did not hit it) — worth knowing when reading the vacuity rule.

The rest of this section is the investigation that led to the revert, kept for the record.

Gate Subject Result Note
vision-fidelity Qwen3.6-35B-A3B-FP8 PASS
video-fidelity Qwen3.6-27B-NVFP4 PASS
decode-floor Qwen3.8-27B-NVFP4 PASS 22.1 tok/s median (floor 20.5; 22.7 on 2026-09-02)
ttft-warm-gate / ttft-cold-gate Qwen3.6-35B-A3B-FP8 PASS median +0.2% / −0.6% (limit +3%)
ssm-state-poisoning-gate Qwen3.6-35B-A3B-FP8 PASS 12/12 invariant
concurrency-sweep Qwen3.8-27B-NVFP4 PASS c1 20.8, c16 89.5 tok/s
agentic-webserver Qwen3.6-35B-A3B-FP8 PASS 10/10, 5.6 s/turn
bfcl-subset-echolp Qwen3.6-35B-A3B-FP8 PASS 87.95 / 87.99 (unchanged)
bfcl-subset Qwen3.8-27B-NVFP4 FAIL 86.23 overall / 83.10 normalized vs bars 83.42 / 83.32

The bfcl-subset miss is main's, not this branch's. Three checks:

  1. main@077552182d (the sha of the committed passing record), served with the recipe's exact flags and driven by main's own harness on the same 995-sample draw, scores the identical 86.23 / 83.10 on this GB10 today.
  2. A 207-sample replay of the three subsets that lost points (parallel, parallel_multiple, simple_javascript) at temperature 0 gives byte-identical tool calls from the PR binary and main's binary (0 of 207 differ).
  3. The committed 2026-09-03-077552182d record repeats the 2026-09-02-61f69768 measurement to the digit, sm clocks included — it is a re-stamp, not a measurement of 0775521. Between 61f6976 and 0775521 the qwen3.8-27b kernel target grew from 182 to 198 PTX modules; 07755218 (nemotron-lightning) changes shared GB10 kernels the 27B compiles — prefill_paged_compute.cuh, argmax_bf16.cu, w8a16_gemv_batch4.cu, mamba2_ssm_decode.cu, the paged-sink prefills. The per-subset movement (parallel −2, parallel_multiple −1, simple_javascript −1, simple_python +1 of 995; hallucination and live subsets unchanged to two decimals) is what a few argmax flips look like.

The record is committed as measured so the gap stays visible.

Root cause, bisected (2026-09-07 evening). The 27B's greedy outputs moved because 07755218 changed the greedy tie-break contract, not because of anything numeric. kernels/gb10/common/argmax_bf16.cu went from "first strict max wins" (lowest vocabulary index on a tie) to argmax_other_better: value descending, then highest index wins; the host paths (verify_pipeline_helper/argmax.rs → argmax_last_wins_f32, logit_processors/mod.rs) were switched to the same rule. With BF16 logits at temperature 0, exact ties between top candidates are common, so the rule change flips tokens.

Test (same 27B recipe, batch 1, temperature 0) Samples that differ from the 2026-09-02 tree
main 077552182d vs 61f69768 (the tree that scored 83.38), 207-sample overlap of the three moved subsets 9
this PR vs 61f69768 9 — the same nine (PR ≡ main)
main with only argmax_bf16.cu reverted to its 61f6976 version 0 — all nine match the old tree again
main with only w8a16_gemv_batch4.cu reverted (the other accumulation-order change) 0 restored — 8 of 9 still identical to main, one sample moves to a third output (a real but tiny effect of that accumulation-order fix)

On those nine samples the old rule answers 5 correctly and the new rule 2 (e.g. simple_javascript_18: gravity 9.81 → 9.8; parallel_65 / parallel_15: the second and third parallel calls are dropped; parallel_9: 5:00 PM → 5 pm) — a 3-sample loss that is exactly the 86.53 → 86.23 overall movement on n=995. The committed 83.38 record and the 83.32 bar were measured under the old rule; main decodes under the new one and scores 83.10 on this box. So the bar for unsloth/Qwen3.8-27B-NVFP4 is stale relative to main's own greedy contract, and any PR measured today inherits the miss. Two ways out, both upstream: re-measure and lower the bfcl-subset bars for this checkpoint under the last-wins rule (main itself: 86.23 / 83.10), or revisit the tie rule. Nothing in this PR touches it.

Long-horizon agentic check on this head (2026-09-09, four hours, 98K context)

Seven-phase, test-driven build of an idle RPG in Rust + Yew/wasm on the ATLAS6 serve pins with --max-seq-len 98304, one Atlas session, native tool calling (qwen3_coder parser), driven by a harness with an orientation packet, a read budget, a scope fence with logged overrides and an independent verify after every phase. Report with every prompt, transcript, trace, harness verification and crate snapshot: https://andrei.monkeycode.io/bench/rpg-atlas/ (this supersedes the 2026-09-08 six-phase run, whose harness lessons went into this one).

Phase Steps / wall Tokens in / out Decode tok/s median / long-gen TTFT median / max Harness-verified outcome
1 math + skeleton 25 / 32 min 413K / 15.9K 20.8 / 21.7 55 s / 81 s compiles, wiring clean, 12 tests (9 pass); one read instead of 9–14
2 interfaces + tests 15 / 45 min 495K / 17.5K 19.1 / 21.2 134 s / 170 s TDD gate met: 44 tests collected, 33 red on todo!()
3 battle 7 / 41 min 291K / 23.2K 18.5 / 19.9 136 s / 251 s one 12,155-token write, regenerated; 6 compile errors left
4 shop/events/save 17 / 39 min 574K / 2.6K 19.2 / 20.8 138 s / 161 s spent on battle.rs via 5 logged overrides; still not compiling
5 Yew UI 15 / 20 min 339K / 3.9K 20.6 / 21.9 68 s / 102 s same errors; loop detector masked <tool_call> once; harness bug → forced summary
6 mechanics integration 19 / 30 min 482K / 4.3K 19.7 / 22.0 77 s / 128 s compiles native + wasm32 after 11 steps; 17/44 pass; no UI
7 testing 14 / 35 min 466K / 3.0K 19.1 / 19.6 122 s / 256 s 1 real bug + 1 constant fixed; 19/44 pass; no dist

Engine findings:

  • 118 requests over four hours of phase time, 3.06M tokens in / 70.5K out, no engine error at 98K context, every request finished with stop. --tool-max-tokens / --max-inter-tool-prose stayed at 32768 and never fired (largest generation 12,155 tokens, the largest of both runs, at 19.9 tok/s).
  • Decode 18.5–20.8 tok/s median per phase at 20–50K tokens of carried context; long generations 19.6–22.0. Prefill is the agentic cost: TTFT 55 s median at ~20K, 122–138 s at 35–50K, worst 256 s — ≈330–380 tok/s effective prefill with 8K chunks.
  • New: the chat-level loop detector judged three similar read_file calls a loop (score 0.725, run_length 3) and hard-masked the <tool_call> token for one turn, producing a prose turn and an empty turn. For agentic serving set ATLAS_LOOP_NO_SUPPRESS=1. Not seen in the previous run.
  • Model behaviour that decided the run (not engine): the previous run's three failure modes (read-everything, hidden modules, balance-test attractor) did not recur; compile-error gravity replaced them — phase 3's 990-line module blocked phases 4–5 (one lifetime fix cascaded into 12 errors and was reverted) until a fresh-context phase 6 fixed it in 11 steps. Honesty held in all seven summaries.

Continuation on the same head (2026-09-09/10, 10 h + 8 h, harness v4)

The crate above was continued with harness v4 (compile gate → fresh-context repair rounds, 16K-char write cap + append, git-backed revert, region-only reads) for ten hours, then eight more. Report with every prompt, transcript, trace, verification and per-round crate: https://andrei.monkeycode.io/bench/rpg-atlas-10h/ — the game, hand-wired by the reviewer after the run (labelled): https://andrei.monkeycode.io/bench/rpg-atlas-10h/game/

Rounds / round time / requests 21 measured / 987 min / 576
Tokens in / out 14.9M / 117K
Decode tok/s median per round 17.6–20.6 (flat across 19 h; long generations 19–22)
TTFT median per round 39 s at 6–16K context → 218 s at 46–50K; worst 301 s at 56K
Engine errors / non-stop finishes 0 / 0 (ATLAS_LOOP_NO_SUPPRESS=1; loop detector did not interfere)
Model's end state core 41/44 tests, self-driving tick engine, rendering wasm build; interface not wired
After reviewer hand-finish (~45 min, interface layer + 2 loop fixes) playable: timer x1–x8, shop, save/load, hooks; 42/45 tests

Engine takeaway: decode is context-independent on this stack; prefill is the agent's cost model — rounds at 8–30K tokens ran 20–90 s per step and built the game, phases at 45–56K ran 3–5 min per step and wrote nothing. Keep agent turns under ~25K tokens, or serve with a larger prefill chunk than 8192 if memory allows.

Tested serve configurations (Atlas + Qwen3.8-Flash-Next, DGX Spark GB10)

Every benchmark round used the same line, with the head, env pins and extra flags per iteration below. Prod (llama-flashnext) is stopped first — 128 GB unified memory is one pool.

ATLAS_PLE_MAX_TOKENS=8212 <env pins> ./target/release/spark serve \
  --model-from-path ~/models/radixark-fn-nvfp4 --model-name qwen --kernel-target qwen3.8-flash-next \
  --bind 127.0.0.1 --port 8001 --max-seq-len <SEQ> --max-num-seqs 1 --max-batch-size 1 \
  --gpu-memory-utilization 0.95 --fast-load-prefetch-shards --max-prefill-tokens 8192 \
  --request-timeout 3600 <extra flags>
Config Head Env pins --max-seq-len Extra flags Request sampling pins Result (R1 / R2 tok/s) Game
ATLAS 4df6e609 (main) ATLAS_QSA_MAX_TOKENS=65536 ATLAS_PLE_CACHE_SLOTS=524288 ATLAS_PLE_MAX_TOKENS=20500 49152 --max-prefill-tokens 20480 --content-loop-watchdog false none (Atlas model preset applies: presence 1.5, top_k 20) 17.3 / 16.3; the only line that survived 11 attempts (single-chunk prefill sized to the whole prompt) ATLAS
ATLAS2 97aa9fa4 — (PLE cap derived from --max-prefill-tokens: 8212) 65536 --content-loop-watchdog false none 17.3 / 16.7; default 8K chunked prefill, zero server errors ATLAS2
ATLAS3 cb6b1a59 — 65536 --content-loop-watchdog false presence_penalty 0 · top_k 40 · min_p 0.05 17.0 / 16.0; sampling equalised with llama.cpp ATLAS3
ATLAS4 7db64cca — 65536 --attn-proj-dtype bf16 (BF16 lm_head is the new default) same pins watchdog ON first: R1 cut to 8.4K tokens by three false-positive rollbacks on a coordinate array; published run with --content-loop-watchdog false: 15.2 / 14.0 ATLAS4
ATLAS5 0b9ada13 ATLAS_QSA_DEVICE_TOPK=1 ATLAS_PLE_CACHE_SLOTS=4194304 65536 --attn-proj-dtype bf16 --content-loop-watchdog false same pins 14.7 / 13.9; device-side QSA selection, 4M-slot PLE row cache, event-scoped pin release ATLAS5
ATLAS6 e7b6af2f (fix rounds at 22321152) ATLAS_QWEN4EXP_BF16_GDN=0 ATLAS_QSA_DEVICE_TOPK=1 ATLAS_PLE_CACHE_SLOTS=4194304 49152 --lm-head-dtype bf16 --attn-proj-dtype nvfp4 --content-loop-watchdog false same pins 21.6 / 20.3; NVFP4 GDN projections (+6 GB, hence 48K ctx), x4 hyper-connection kernel ATLAS6

Common to all: temperature 0.7 · top_p 0.8 · max_tokens 26,624 · chat_template_kwargs.enable_thinking=false. From ATLAS3 on, presence_penalty 0 · top_k 40 · min_p 0.05 are pinned in the request so the MODEL.toml non-thinking preset (presence 1.5) does not apply — what llama.cpp had been getting all along (see use_sampling_preset_penalties_for_core).

Single-prompt A/B variations (3,882-token prompt, 1,200-token greedy generations, watchdog off, --max-seq-len 49152, --max-prefill-tokens 8192; no game built):

Variation Env Flags tok/s Verdict
precision: BF16 head + BF16 attention ATLAS_QSA_DEVICE_TOPK=1 ATLAS_PLE_CACHE_SLOTS=4194304 --attn-proj-dtype bf16 13.8 each BF16 choice ≈ −5–6%
precision: BF16 head + NVFP4 attention same --lm-head-dtype bf16 --attn-proj-dtype nvfp4 15.0 the ATLAS6 base
precision: NVFP4 head + BF16 attention same --lm-head-dtype nvfp4 --attn-proj-dtype bf16 14.7
precision: NVFP4 head + NVFP4 attention same --lm-head-dtype nvfp4 --attn-proj-dtype nvfp4 15.6 fastest, argmax-flip risk in the head
GDN projections NVFP4 + ATLAS_QWEN4EXP_BF16_GDN=0 --lm-head-dtype bf16 --attn-proj-dtype nvfp4 18.3 adopted (ATLAS6)
+ hc_pre_finish_x4 (e7b6af2) same same 20.3 adopted; ATLAS_HC_FIN_X4=0 restores the old kernel
+ FP8 lm_head same --lm-head-dtype fp8 --attn-proj-dtype nvfp4 21.2 not adopted (precision)
+ NVFP4 lm_head same --lm-head-dtype nvfp4 --attn-proj-dtype nvfp4 21.7 not adopted (precision)
GDN fused norm + ATLAS_GDN_FUSED_NORM=1 same as ATLAS6 20.1 (neutral) rejected: greedy output differs
MoE grouped decode arm (A2) + ATLAS_MOE_DECODE_ARM=grouped --attn-proj-dtype bf16 5.3 3× slower than the scalar arm; scalar stays
device top-k on/off (A1) ATLAS_QSA_DEVICE_TOPK=1 vs unset --attn-proj-dtype bf16 +3–5% with sparse selection active adopted
4M PLE slots + event pins (A3) ATLAS_PLE_CACHE_SLOTS=4194304 --attn-proj-dtype bf16 14.5 / 15.1 (neutral) kept (harmless)
D2H spin sync / PLE fault threads ATLAS_D2H_SPIN_SYNC=1 · ATLAS_PLE_FAULT_THREADS=128 --attn-proj-dtype bf16 neutral not adopted
decode CUDA graphs on/off (llama.cpp, for reference) — llama-server graphs on/off 24.8/25.1 vs 24.4/24.1 ≈3%

Reference, the prod engine on the same box:

LLAMA_ATTN_ROT_DISABLE=1 llama-server --host 0.0.0.0 --port 8000 --alias qwen -ngl 999 --jinja -fa on \
  -m Qwen3.8-Flash-Next-UD-Q4_K_XL-00001-of-00004.gguf --override-tensor 'per_layer_token_embd=CPU' \
  -c 131072 -ctk q8_0 -ctv q8_0 --parallel 1        # llama.cpp PR #27742 build, container llama-flashnext

Decision log — ATLAS6 (2026-09-06)

Full log for every round, ATLAS → ATLAS6, with commits, files and measured impact: https://andrei.monkeycode.io/bench/decisions/

Decision: measure instead of estimate. Two source-level investigations and three executed items (device-side QSA selection, PLE event/pinned staging, MoE arm selector) had moved decode by at most a few percent, and a graph on/off measurement on llama.cpp (24.8/25.1 → 24.4/24.1 tok/s with GGML_CUDA_DISABLE_GRAPHS=1) had ruled out capture. So: one nsys window over 642 decoded tokens (BF16 head, NVFP4 attention, device top-k, 3,882-token prompt, ~69 ms/token).

What the profile said

  • dense_gemv_bf16: 73 launches/token, 24 ms (42%). One is the BF16 lm_head; 72 are the 36 GDN layers' in/out projections, which the loader keeps in BF16 — 4.15 GB/token, bandwidth-bound at that precision.
  • Hyper-connection stage 3 hc_pre_finish: 97 × 121 µs = 11.7 ms; with hc_pre_down/hc_pre_stage/hc_post ≈ 17.5 ms (27%) for ~1.25 GB of weights whose floor is ~5.4 ms.
  • MoE (moe_expert_gate_up_shared + silu_down_shared + top-k/blend): ≈ 8.3 ms for 1.46 GB ≈ 77% of achievable bandwidth — already near its floor, so the vectorised-GEMV proposal was dropped.
  • ~1,000 launches/token; everything else under 1.5 ms each.

Changes made, in the order they were measured (each speed at the 3,882-token prompt, sparse selection active; each engine change proven bit-exact by a greedy 160-token output hash against the previous binary before its speed was recorded)

Step Change Files Speed
0 baseline: BF16 head / NVFP4 attention / BF16 GDN, device top-k, 4M-slot PLE cache — 15.0 / 14.9 tok/s
1 ATLAS_QWEN4EXP_BF16_GDN=0 — requantise the GDN projections to NVFP4 through the loader path that already existed (qwen4_exp.rs:237; its note that GDN bandwidth "is not what bounds decode" dates from a 2.2 tok/s configuration) none (flag); costs ~6 GB, context 64K → 48K at 0.95 util 18.3 / 18.3
2 3fff25af hc_pre_finish: rank loop unrolled ×8 with hoisted loads, same accumulation order kernels/gb10/qwen3.8-flash-next/nvfp4/hyper_connection.cu 17.8 / 18.3 (neutral: the kernel is thread-starved, not load-starved)
3 e7b6af2f hc_pre_finish_x4: one warp per hyper-connection stream, lanes over 32 output dims (4× the threads); each (d, s) accumulator still sums r = 0,1,… in one FP32 register under --fmad=false, the four products fold in s order in one thread — this splits the four independent accumulators across warps, not one accumulator across lanes, which is the reassociation the kernel's note had rejected. ATLAS_HC_FIN_X4=0 reverts hyper_connection.cu, crates/spark-model/src/layers/ops/hyper_connection_lowrank.rs, hyper_connection_lowrank_gemm.rs 20.3 / 20.1; greedy hash identical
4 22321152 qsa_select_topk: block scores staged in shared memory qsa_indexer.cu 20.1 / 20.3 (neutral); greedy hash identical

Measured and rejected: ATLAS_GDN_FUSED_NORM=1 (recurrence + gated norm fused) — 20.1 / 20.4, no gain, and the greedy output differs, so it is not the bit-exact swap it looks like. ATLAS_D2H_SPIN_SYNC=1, ATLAS_PLE_FAULT_THREADS=128 — neutral. FP8 / NVFP4 lm_head — +1 / +1.5 tok/s on top of step 3 at the documented argmax-flip risk; not adopted. The precision halves separately at this context: head BF16 + attention NVFP4 15.0, head NVFP4 + attention BF16 14.7, both NVFP4 15.6, both BF16 13.8.

Full benchmark on e7b6af2f (ATLAS6, watchdog off): 20.6K-token rounds at 21.6 / 20.3 tok/s (previous head 14.7 / 13.9). Game: shipped with two defects — a helper called by the wrong name at reset, an unbound level variable in the turret loop — each fixed by a literal one-change round; a console-error round in between echoed the file unchanged. Then four waves cleared with correct gold, score and lives. One sample, so the NVFP4 GDN requantisation's quality gate is neither passed nor failed (the previous head's game had one defect).

Left on the table, from the same profile: BF16 lm_head ≈ 6 ms/token (precision decision), hc_pre_down and the remaining hyper-connection launches ≈ 5 ms, conv1d launched separately from the GDN recurrence ≈ 1 ms (the existing fused kernels are not bit-exact), ~1,000 launches/token of gaps. llama.cpp on the same GB10: 24–25 tok/s.

🤖 Generated with Claude Code

Decision log — tie-break revert (2026-09-07)

# Change Files Evidence
1 db0bc097 restore first-index-wins greedy tie-break kernels/gb10/common/argmax_bf16.cu, scheduler/verify_pipeline_helper{.rs,/argmax.rs}, scheduler/logit_processors/mod.rs, atlas-kernels/tests/argmax_tiebreak_contract.rs bisect: v7 tree vs main differ on 9/207 replayed BFCL samples; main with only the kernel reverted → 9/9 restored, with only w8a16_gemv_batch4.cu reverted → 0/9; PR+revert → 9/9; old rule 5/9 correct vs 2/9

andrew-vogulkin and others added 13 commits September 4, 2026 03:58
…LE_MAX_TOKENS up to the floor

Two independent caps refused every prompt past 8192 tokens on a default
serve of Qwen3.8-Flash-Next. The prefill chunk is max_batch_tokens =
prefill_budget + max_batch_size = 8193 wide, but the n-gram row cache was a
fixed 65536 slots (sized for 2048 x 16 heads), so an 8193-token chunk pinned
131,088 rows and the cache bailed with "every one of 65536 slots is pinned
by the batch in flight". Derive the default from max_batch_tokens x
ngram_heads (rounded up to a power of two, floored at 65536; ~84 MB at the
default chunk) and keep ATLAS_PLE_CACHE_SLOTS as the override; the load
line now prints where the number came from.

An ATLAS_PLE_MAX_TOKENS override below the derived floor was honoured after
a warning and then refused the first wide prefill as a 500; it is now
clamped up to the floor with the same warning.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
ATLAS_QSA_MAX_TOKENS defaulted to 32768 regardless of the served context,
so a --max-seq-len 65536 serve of Qwen3.8-Flash-Next died mid-stream the
moment a sequence reached position 32768 ("QSA: pos 32768 >=
ATLAS_QSA_MAX_TOKENS"), discarding 14.5K generated tokens.

ModelConfig now carries max_seq_len the same way it carries
max_batch_tokens (serve-time, serde-skipped), serve sets it from
--max-seq-len, and QsaIndexer::new sizes its per-sequence key caches from
it. The env var remains an override that can only raise the capacity; a
lower value is clamped up with a warning, and the two bounds guards name
the flag that actually controls them. A config built outside serve keeps
the historical 32768.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…"; log cuBLASLt fallbacks

Every verify/MTP step handled an engine failure with `a.finished = true`,
so the response layer reported a normal completion: on Qwen3.8-Flash-Next a
speculative verify that hit an active QSA selection at position 2,051
ended a 1,679-token answer with a clean "stop". The client could not tell
the truncation from success.

ActiveSeq now records the cause (`engine_error`, set at every such site;
`abort_on_engine_error` for the k3 step where the stamp pushed the file
past the LoC cap). finish_sequence reports "error" — a new FinishReason
variant on the wire — and a blocking client receives the error itself, so
the request fails as a 500 instead of a completion with a strange reason.

The GDN QKVZ projection also swallowed the cuBLASLt error before falling
back to the scalar dense_gemm; that fallback is the kernel that faulted
with CUDA_ERROR_MISALIGNED_ADDRESS on continuation prefill chunks. It now
logs the cuBLASLt failure with M/N/K and the operands' low address bits and
debug-asserts their alignment, so the next fault names its operand.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
After a sticky CUDA error (CUDA_ERROR_MISALIGNED_ADDRESS in a continuation
prefill chunk on Qwen3.8-Flash-Next) the fault latch fired, /health went
503 and main.rs was ready to exit EXIT_GPU_FAULT — but the scheduler loop
never returned control to it. The process kept the port open, answered
/tokenize, 500'd every completion and held ~100 GB for hours until it was
killed by hand.

Check the global latch at the top of every scheduler iteration: mark the
in-flight sequences as engine errors (they finish with reason "error"
through the existing drain) and break, so the exit path that already
exists runs. /health needs no change: it already reports the latched
fault (api::tests::health_fault).

Co-Authored-By: Claude Fable 5.1 <[email protected]>
The content-loop watchdog's rollback restored the SSM recurrent state
from the decode ring and lowered seq_len, but nothing rewound the QSA
indexer cursor or the PLE n-gram history: on Qwen3.8-Flash-Next the very
next decode failed "QSA: decode at pos 2864 but 2932 tokens ingested — the
indexer cache lost sync" and the request died with a 500. The only aux
rewind in the tree was the speculative-verify commit hook; the watchdog
path never touched aux state.

Mirror the SSM treatment with the audited snapshot path instead of a new
arithmetic rewind: the model gains save/restore_decode_aux_snapshot
(byte-exact blobs from collect_aux_states/apply_aux_states, keyed by the
same (slot, ring_slot) as the SSM ring) and requires_aux_state.
snapshot_boundary_if_ssm saves both or drops the ring entry;
rollback_to_boundary restores both, and declines with the new
RollbackFallback::NoAuxSnapshot — a stream-safe hard stop — when the aux
companion is missing or fails to restore.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
The MTP lane's gate declines a batch only when a sequence is ALREADY at or
past verify_context_limit (the QSA inert bound, 2051 on this card). A
sequence admitted just below it gets a verify that ingests num_drafts + 1
rows across the bound, and the next verify runs with selection active on
the batched multi-seq path, which refuses it — on Qwen3.8-Flash-Next with
--speculative --num-drafts 1 every long answer died at position 2051.

Latch a.disable_mtp one step early (seq_len + num_drafts + 1 >= limit),
logged once per sequence; the serial lane handles active selection. The
batched multi-seq entry also refuses before any QSA ingest when a row is
already past the bound, so a future caller cannot mutate state before the
late check fires.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…e GEMM

Chunked prefill of Qwen3.8-Flash-Next faulted with
CUDA_ERROR_MISALIGNED_ADDRESS on continuation chunks — a 1,117-token last
chunk, or the default 8,193-wide chunk — while 1,074 / 1,862 / 4,092-token
chunks were fine. Under CUDA_LAUNCH_BLOCKING the faulting launch is
dense_gemm_bf16_pipelined with grid [80, 9] = [10240/128, 1117/128]: the
`up_pre = low x up_wt^T` GEMM in hc_pre_gemm.

Its scratch was packed as raw byte products: `inj_pre` is `lay * hc_mult *
2` = `lay * 8` bytes, so for an odd slab `up_wt` started 8 bytes off a
16-byte boundary and the kernel's vector loads faulted. Even slabs happened
to align, which made the fault look random (and had the earlier
odd-chunk-width theory half right).

Place the sub-buffers with one shared layout function in spark-runtime
(256-byte aligned) and size the region from the same function, so sizing
and placement cannot disagree. Unit test covers odd and even slabs
including the historical 1,117. Verified on the GB10: the 13,397-token
prompt prefills at both 4,096 and the default 8,192 chunking.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Resolves the one conflict in multi_seq/mod.rs: main's nemotron serial
early-return runs first, then the QSA pre-mutation guard from this branch.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Atlas fills request fields a client leaves unset from the selected
MODEL.toml [sampling.*] category. For penalties this happened
unconditionally, so Qwen3.8-Flash-Next's card presence_penalty = 1.5
(tuned for short chat turns) reached every plain chat/completions
request. On a 20K-token single-file build it suppresses every token
already emitted and the engine shipped dead/inert files; with presence 0
the identical engine and sampler wrote a working 51 KB game.

New [behavior] key use_sampling_preset_penalties_for_core (default true,
so no other model changes). Tool-calling requests always keep the
[sampling.tools] penalties; explicit request values always win.
Flash-Next's MODEL.toml opts out.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
The checkpoint ships lm_head in BF16 and Atlas requantized it to NVFP4
at load. The 27B recipe already pins --lm-head-dtype bf16 for exact
argmax; long-form single-file generation on Flash-Next is the same
regime. --lm-head-dtype nvfp4 still forces the packed head.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Watchdog rollbacks fire from logits processing, after decode(last_token)
pushed that token, so seq.tokens holds every generated token including
the boundary token. apply_rollback re-points last_token at the boundary
token and the next step decodes it again, but rewind_buffers popped only
the dropped tokens: the boundary token was decoded twice, one position
past the SSM/aux snapshot (taken before it was fed). Pure-attention
models got a duplicate KV row; hybrid models with the QSA indexer failed
with 'QSA: decode at pos 6050 but 6049 tokens ingested' after the aux
restore landed. Pop dropped + 1.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…int precision

The NVFP4 loader arm runtime-quantizes BF16-shipped attention
projections to NVFP4 even though ModelOpt's own ignore list keeps every
self_attn projection at BF16 (the qwen4_exp checkpoint does). The BF16
Q/K/V sources are already resident for the dense fallbacks; with the
flag the layer gets no NVFP4 Q/K/V (dense GEMV/GEMM arms run) and keeps
a BF16 O copy via set_o_dense_bf16. Serve-time config field, validated
enum, default unchanged.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@andrew-vogulkin
andrew-vogulkin force-pushed the assist/flashnext-longform-fixes branch 2 times, most recently from c120f47 to 953820a Compare September 4, 2026 06:28
andrew-vogulkin and others added 8 commits September 4, 2026 13:29
Co-Authored-By: Claude Fable 5.1 <[email protected]>
…iscarded context

Two watchdog sites roll back at different points of the step. The
content-loop / inter-tool-prose handler runs BEFORE the step pushes its
sampled token, so seq.tokens holds every generated token; the fuzzy
detector runs AFTER the push, so the newest output token is not decoded
yet. A fixed pop count is wrong at one of them: popping dropped decoded
the boundary token twice at the before-push site ('QSA: decode at pos
N+1 but N tokens ingested'), popping dropped+1 discarded a real token at
the after-push site ('pos N but N+1 ingested', seen once the first fix
landed). rewind_buffers now takes the unfed tail (0 / 1) and pops every
fed token from the boundary onwards, which lands the re-fed boundary
token exactly where the SSM/aux snapshot expects it.

The before-push site also kept appending the token it had just sampled
from the discarded context: a phantom, never-decoded token that reached
the client and put every later rollback one position off.
handle_content_token now returns true on a rollback, refunds that
token's budget and content count, and the step drops it.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
The single PLE layer released the previous gather's row pins behind a full
stream synchronize once per token and uploaded the resolved slot list from
a pageable Vec. Record an event behind the gather kernel and wait on that;
stage the slot list through a pinned buffer rewritten only after that wait.
GpuBackend gains thin event wrappers with a stream-sync fallback.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…oE through the grouped-GEMM arm

A/B lever from the llama.cpp gap study: the scalar FP32-FMA decode arm vs the
tensor-core grouped-GEMM arm (forward_prefill M=1) for all 48 layers. Default
unchanged (scalar). Measured on the GB10: grouped 5.3 tok/s vs scalar 15.0.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
… host-parity check

decode_select copied the block scores device-to-host (a stream sync per
attention layer per token), sorted on the host and uploaded the selection.
qsa_select_topk does the selection on the device with torch.topk's
tie-break (lower index wins), in ascending block order, straight into
sel_dev; n_sel never depended on the scores. Default stays on the host arm;
ATLAS_QSA_TOPK_VERIFY=1 runs both and fails on the first mismatch.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…ccumulation order

nsys on the GB10 (C=1, 3.9K ctx) had this kernel at 121 us x 97 launches =
11.7 ms of a 69 ms token, ~54 GB/s on 6.5 MB of up_w: latency-bound, one
dependent load+FMA per rank step per stream, and nvcc does not pipeline the
runtime-bound loop. Unroll r by 8 with the 32 loads hoisted ahead of the 32
accumulations. Every accumulator still sums r = 0,1,2,... in that order into
one FP32 register (--fmad=false), so the output is bit-for-bit unchanged;
this is scheduling, not the reassociation the kernel's note rejected.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…cal accumulation order

Stage 3 of the hyper-connection decode collapse is capped at H = 2560
threads per token (thread-per-d walking four dependent rank-320 chains):
nsys measured 121 us x 97 launches = 11.7 ms of a 69 ms token. Give each
of the four INDEPENDENT stream accumulators its own warp, lanes over 32
consecutive dims, so a token spans 80 blocks x 4 warps; the per-(d, s)
sum still runs r = 0,1,... in one FP32 register (--fmad=false) and the
four products still fold in s order in one thread, so the output is
bit-for-bit the previous kernel's. ATLAS_HC_FIN_X4=0 keeps the old path.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
The rank loop read every score from global memory complete times; nsys
had the kernel at ~71 us x 12 launches per token. One staged copy
(16 KB for the 4096-block cap) and NaN folded to -inf once.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@andrew-vogulkin
andrew-vogulkin force-pushed the assist/flashnext-longform-fixes branch from 9e7d03c to 98a297e Compare September 6, 2026 09:52
rollback.rs (511) -> rollback_rewind.rs child: rewind_buffers +
apply_rollback (pure token-buffer rewind + ActiveSeq glue), re-exported.
ple/layer.rs (501) -> seq_state.rs child: PleSeqState with pub(super)
fields, re-exported. No behaviour change.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@andrew-vogulkin
andrew-vogulkin force-pushed the assist/flashnext-longform-fixes branch from 98a297e to 0acad1c Compare September 6, 2026 09:56
andrew-vogulkin and others added 3 commits September 7, 2026 18:38
Measured with the same params as main's records (2026-09-03-077552182d):
vision/video fidelity, decode-floor (22.1 tok/s), warm/cold TTFT, SSM
state poisoning, concurrency sweep, agentic webserver and bfcl-subset-echolp
all PASS.

bfcl-subset FAILS at 86.23 overall / 83.10 normalized (bars 83.42 / 83.32).
This is not this branch: main@077552182d served with the recipe's flags and
driven by main's own harness scores the identical 86.23 / 83.10 on this
GB10 today, and a 207-sample replay of the subsets that moved (parallel,
parallel_multiple, simple_javascript) gives byte-identical tool calls from
the two binaries. The committed 0775521 record repeats the 61f6976
measurement (2026-09-02) to the digit, including sm clocks; between that
tree and 0775521 the qwen3.8-27b kernel target grew from 182 to 198
modules (0775521 touches prefill_paged_compute.cuh, argmax_bf16.cu,
w8a16_gemv_batch4.cu, mamba2_ssm_decode.cu and the paged-sink prefills).
The record is committed as measured so the gap is visible.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…aths)

0775521 switched the greedy tie-break from "first strict maximum wins" to
"value descending, then higher vocabulary index" in argmax_bf16.cu and moved
the host verify argmax and the greedy logit processor to the same last-wins
rule. With BF16 logits at temperature 0 exact ties are common, so the rule
change moves tokens: on the bfcl-subset gate draw for unsloth/Qwen3.8-27B-
NVFP4 it flipped 9 of 207 replayed answers, cost 3 correct ones, and took
the checkpoint from 86.53/83.38 to 86.23/83.10 (bars 83.42/83.32) — main
itself fails its own committed record under the new rule. Reverting only the
kernel on top of main restored all nine samples; reverting the other
accumulation-order change in the same commit restored none.

First-index-wins is also what llama.cpp's greedy sampler and vLLM's
torch.argmax do, so it is the rule the recorded baselines and the other
engines share. This restores:
  * kernels/gb10/common/argmax_bf16.cu — the 61f6976 kernel, verbatim
  * scheduler/verify_pipeline_helper/argmax.rs — argmax_first_wins
  * scheduler/verify_pipeline_helper.rs, logit_processors/mod.rs — call the
    first-wins helper (spark_runtime::sampler::argmax_first_wins_f32)
  * atlas-kernels/tests/argmax_tiebreak_contract.rs — now locks the
    first-wins rule instead of the last-wins comparator

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Same params as main's records. With first-index-wins tie-breaking restored
(db0bc09), bfcl-subset is back at 86.53 overall / 83.38 normalized on the
full 995-sample draw — the 2026-09-02 numbers to the digit (bars 83.42 /
83.32). bfcl-subset-echolp 87.95 / 87.99, decode-floor and the TTFT, SSM,
fidelity and agentic gates unchanged.

Two gates needed a second run at this head and the records are from those:
decode-floor's first attempt died before serving ("No memory left for KV
cache") because the previous gate's server had not yet released ~3 GB — a
settle-time artefact, not a measurement; concurrency-sweep's first attempt
was INCONCLUSIVE because one of the eight natural prompts at conc 8
paraphrase-looped and the SimHash watchdog cut it at 243/320 tokens (below
the 80% vacuity floor). On the re-run the same prompt was cut at 309 and
every floor was met (C1 19.0 · C4 50.8 · C8 58.8 · C16 85.6 tok/s). The
loop is greedy-path behaviour of this checkpoint under first-wins; the
last-wins run on 2026-09-07 did not hit it. Worth knowing when reading the
sweep's vacuity rule.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@andrew-vogulkin
andrew-vogulkin force-pushed the assist/flashnext-longform-fixes branch from 38b7565 to 3d92224 Compare September 8, 2026 07:34
@AzeezIsh

AzeezIsh commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Review + hardware test report (GB10, gx10-e3a3)

Tested the PR head 3d922247 in a clean worktree on the GB10 against the RadixArk NVFP4 checkpoint (~/code/radixark-nvfp4). One real defect found and fixed; fixes pushed to review/pr23-fixes on the main repo (cannot push to the PR head from here — no write on the fork).

Environment / fingerprint

  • Build: PR head 3d922247, ATLAS_TARGET_HW=gb10 ATLAS_TARGET_MODEL=qwen3.8-flash-next ATLAS_TARGET_QUANT=nvfp4, cargo 1.93.1, CUDA 13.0, sm_121, 193 kernel modules
  • Serve: spark serve --model-from-path /home/azeez/code/radixark-nvfp4 --model-name qwen --kernel-target qwen3.8-flash-next --bind 127.0.0.1 --port 8001 --max-seq-len 49152 --max-num-seqs 1 --max-batch-size 1 --gpu-memory-utilization 0.95 --fast-load-prefetch-shards --max-prefill-tokens 8192 --request-timeout 3600 --lm-head-dtype bf16 --attn-proj-dtype nvfp4 with ATLAS_QWEN4EXP_BF16_GDN=0, ATLAS_QSA_DEVICE_TOPK=1, ATLAS_PLE_CACHE_SLOTS=4194304; watchdog/spec flags varied per run
  • Resident memory after load: ~118 GB (consistent with the PR's ~108 GB + cache figures)

Verified on hardware

Change Result
Chunked prefill past 8,192 (hc_pre scratch alignment + PLE cap) 30,651-token prompt through 8,193-wide chunks: clean stop, no CUDA_ERROR_MISALIGNED_ADDRESS, coherent output
QSA capacity from --max-seq-len QSA: indexer capacity 49152 tokens (max_seq_len=49152) ×12 indexers
PLE floor clamp ATLAS_PLE_MAX_TOKENS=4096 → warn + "clamped UP", 16K prefill fine
MTP/QSA inert-bound latch mtp declined: qsa_active seq_len=16664 num_drafts=1 lim=2051; serial decode continues past the bound
Device-side QSA top-k ATLAS_QSA_TOPK_VERIFY=1 host-vs-device compare on every decode step (~500+ steps × 12 indexers at 16K ctx): zero mismatches
Watchdog rollback, plain decode Two successful rollbacks (rolled back to boundary, re-steering dropped=91, ×2), continued decoding, then CapReached hard stop — no desync at ~16.7K ctx with 12 active indexers
MTP engagement mean_na=0.885 tok_step=1.885, 34.9 tok/s on a short-prompt run
Decode throughput 21.6 tok/s at 30.7K ctx (in the PR's reported band)
cargo fmt / clippy --workspace --tests / unit tests all clean (spark-server 2,328; spark-model 781; kernels/core/runtime ~300)

Defect found and fixed — rollback desync still reachable under --speculative

rollback_to_boundary gates the snapshot-aware search on has_ssm_layers() && ring.is_enabled(). Under --speculative the decode ring is skipped at model init ("SSM decode-rollback ring: SKIPPED (speculative decode active)"), so a qwen4_exp sequence takes the plain any-boundary search, finds a boundary, and rewinds seq.tokens + KV — but the 12 QSA indexers keep their post-loop ingested counts. The next decode dies on QSA: decode at pos 17116 but 17208 tokens ingested → request 500s.

Reproduced twice on the PR head (16.7K-token prompt, watchdog fired at content_tokens=453, dropped=91 → desync on the very next decode). The NoAuxSnapshot guard added in this PR only runs inside if let Some(slot), so it can't fire when the ring is off.

Fix (14cbecf3): decline with RollbackFallback::NoAuxSnapshot when model.requires_aux_state() && ssm_slot.is_none() — before any buffer mutation. Verified live: same workload now logs ending response early (rollback declined) reason=NoAuxSnapshot and finishes cleanly instead of 500ing.

Defect completed — engine_error coverage gaps

The plumbing covered the single-seq verify steps, mtp_step and the loop-level fault latch, but the same abort→finished→"stop" laundering still applied to ~28 sites: all nine error exits in verify_dflash_batch_step.rs, the batched K=4 verify and K=4 verdict commits, batched MTP bootstrap decode/sample, the self-spec and ngram-spec steps in spec_step.rs, and the per-token EP broadcast in verify_k2_step.rs (the cmd broadcast two lines above it already latched engine_error). Fixed mechanically in 77e0f96c — compile/clippy/fmt clean; not independently runtime-triggered (each is the same a.engine_error = Some(...) pattern the PR uses elsewhere).

Review notes (not patched — worth a look)

  1. Kernel merge keeps lower lane, not lower index. In argmax_bf16.cu/argmax_fp32/argmax_bf16_batch*, equal values resolve to s_val[tid] — i.e. the lowest lane holding the max. When equal maxima sit in different lanes with the lower index in the higher lane (e.g. max at index 1029 [lane 5] and 2050 [lane 2] with stride 1024), the kernel returns 2050 while host argmax_first_wins_f32 returns 1029. Byte-identical to the 61f69768 record kernel, so not a regression — but the new docs claim "byte-identical to n sequential calls / same as torch.argmax", which isn't strictly true. Either add || (s_val[tid+s] == s_val[tid] && s_idx[tid+s] < s_idx[tid]) to the merges or soften the claim.
  2. Residual host last-wins paths (pre-existing, not introduced here). sample_impl.rs's temperature <= 0.0 branch still uses argmax_last_wins_f32, and sample_step.rs's suppress-ids greedy branch uses max_by (last-wins). This matches the record tree — the revert is faithful — but the plain temperature: 0 request path (non-spec, or MTP bootstrap sampling) can still diverge from the now-first-wins verify/kernel on exact ties. Worth documenting in the PR so a future reader doesn't think the whole engine is first-wins.
  3. Boundary-dense loops evict eligible snapshots. With an 8-slot ring, a loop whose repeated unit ends in a boundary token (e.g. checkpoint pass;\n) records a snapshot per line and evicts every out-of-min_keep snapshot before the watchdog fires — observed NoSsmSnapshot declines where a rollback could otherwise have succeeded. Consider recording snapshots only every Kth boundary, or skipping records that would land inside the protected tail.
  4. Latch is permanent. crosses_inert_bound latches disable_mtp for the rest of the sequence — correct and conservative, but a sequence crossing the bound mid-generation loses spec entirely rather than falling back to a per-seq verify lane. Fine as designed; flagging as a known trade-off.
  5. Aux snapshot cost. save_decode_aux_snapshot does a full gpu.synchronize + D2H of ingested × hd × 2 bytes per aux layer per boundary token (~25 MB/layer at 98K ctx × 12 indexers). Bounded by ring slots, but heavy at high context — visible in logs as occasional multi-ms hitches at boundary tokens.
  6. Nits: _seq_lens in multi_seq/mod.rs is now used (rename to seq_lens); PleLayer's gather_done event and slots_staging are never destroyed (bounded, process-lifetime).

Verdict

The PR does what it claims on the paths it targets — every headline fix reproduced clean on the GB10. The two commits on review/pr23-fixes close the speculative-decode hole in the rollback story and finish the engine_error propagation the PR started. Suggest landing those plus deciding on notes 1–3 before merge.

@AzeezIsh

Copy link
Copy Markdown
Contributor

Complete gate re-run on the fix head 77e0f96c (review/pr23-fixes, commit e6cf5600): all ten required gates PASS on GB10.

Gate Result
ttft-warm / ttft-cold PASS (−0.5% / −0.2% median vs baseline)
ssm-state-poisoning PASS (12/12 byte-identical replays)
vision / video fidelity PASS (14 cells + 3/3 probes / 7/7 legs)
decode-floor PASS (22.8 tok/s vs 20.5 floor, accept_len 2.67)
concurrency-sweep PASS (C1 18.9 → C16 88.3 tok/s)
agentic-webserver PASS (10/10, 5.73s/turn ≤ 8.5s)
bfcl-subset PASS (86.53 / 83.38 — identical draw to the db0bc097 record)
bfcl-subset-echolp PASS (88.05 / 88.08)

So the review fixes (rollback NoAuxSnapshot decline + engine_error coverage) introduce zero measurable regression — the bfcl draw is bit-identical. All records ran --serve-override gpu_memory_utilization=0.92 (pinned 0.85 budgets OOM this 119.6 GB box); provenance recorded in each record.

AzeezIsh added a commit that referenced this pull request Sep 11, 2026
… on the inherited argmax regression

Full suite re-measured on the review-fix head (per-sequence DFlash
raw-argmax gate + dflash_head clippy cleanup). gx10-e3a3, NVIDIA GB10
119.6 GB, driver 580.126.09, CUDA 13.0. decode-floor ran
--serve-override gpu_memory_utilization=0.92 and bfcl-subset 0.75 —
recorded in provenance — because the pinned budgets were sized for a
121.7 GB box.

bfcl-subset draws 86.23/83.10 for the third time in a row (9bafa47,
683a0db, 323a7e1): the last-index-wins argmax regression inherited
from 0775521, fixed by #23/db0bc097 — not a dflash2
defect. echolp on the 35B subject passes 87.85/87.90.
@AzeezIsh

AzeezIsh commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up: --ngram-speculative on Flash-Next — was broken end-to-end, now fixed + extended to llama.cpp semantics

Tested on GB10 at eaecc79a.

Bugs found and fixed (all in --ngram-speculative + QSA models)

  1. QSA indexer desync on reject — the ngram reject arm used start_rollback_and_checkpoint_async (SSM-only). The verify ingests all K rows into the QSA indexer + PLE carry; on reject the aux state never rewound → next verify died with decode at pos N but N+1 tokens ingested. Now commits through commit_accepted_prefix (rewinds aux by k - num_accepted), same as the K=2 MTP path.
  2. Off-by-one proposal context (pre-existing — this path never actually worked): propose(&a.seq.tokens) searched a context ending at the pre-emission token because a.last_token is sampled-but-not-pushed. Every draft predicted the token the target just emitted → ~100% reject (confirmed: drafts=[X] always equaled the previous step's v0). Now proposes on tokens + [last_token].
  3. Missing QSA inert-bound gate — the ngram dispatch didn't check verify_ctx_limit; any request crossing ~2051 would die on VerifyUnsupportedWithActiveQsa. Added the same decline-to-serial check the MTP lane uses, plus a pending-draft drain (drafts are never forwarded, so dropping needs no rewind).

llama.cpp-style upgrades

  • Dynamic n-gram table (hash → next-token counts, ngram_mod-style) learned on every observed token — works on patterns that only exist in generated text, not just prompt repeats.
  • Multi-token draft chains — prompt-lookup continuation + iterative table extension; chain width clamps to model.verify_max_drafts() (this model's mHC caps at K=2 — decode_verify_graphed_k4 correctly errors "no batched MoE arm for K=4").
  • SSD persistence — the dynamic table auto-saves to <hf-cache>/atlas-ngram/<model>.bin on shutdown and every 8k observations, warm-loads at boot. Verified: 707 keys persisted and reloaded.

Measured

Flash-Next NVFP4, 400-token essay completion, greedy:

Mode tok/s notes
serial 18.8 —
ngram (fixed) 25.3 (+34%) ~93% draft acceptance

Zero draft-weight memory — the MTP draft module can't even fit this box at 0.85 util, so ngram is the only spec path that serves Flash-Next at tighter memory budgets.

review/pr23-fixes @ eaecc79a: bf90d6dc (QSA commit fix) + 2d4c720a (chains/cache/SSD + off-by-one + gate) + eaecc79a (fmt/clippy). 7 ngram unit tests pass; build + clippy clean.

@AzeezIsh

Copy link
Copy Markdown
Contributor

N-gram A/B results + two more fixes (post-fix heads, review/pr23-fixes @ 892c5d00)

Flash-Next NVFP4 on GB10, paired serial-vs-ngram on identical requests:

Request Serial N-gram Delta
Greedy essay (temp 0, 400 tok) 18.7 tok/s 25.5 tok/s +36%
Sampled story (temp 0.8 / top-p 0.9, 300 tok) 18.8 tok/s 18.8 tok/s 0% (lane declined)

Acceptance on the greedy arm is ~93% — the dynamic table learns generated-text patterns within the first few steps (prompt-lookup alone never sees them).

Two more bugs fixed after the first report

  • Bootstrap hard-argmaxed (argmax_on_device) — every bootstrap token collapsed to greedy for requests with temperature/penalties/grammar, the same bug class as the DFlash process-wide raw-argmax gate. Now routes through process_seq_logits (full pipeline: penalties, grammar, sampling). Verify-emitted tokens also carry per-token top_logprobs now, matching the K-paths.
  • Proposer lookup was O(len² · max_match) — scanned every start × every n per step (~250M compares at seq_len 8k, i.e. the "free" CPU proposer would cost more than the decode itself at long context). Now a 2-gram→positions index, incrementally maintained; candidates extend backward newest-first. Also caught by a new regression test: a verify reject pops + refills the tail, so length alone can't detect a rewrite — the index fingerprints the indexed prefix and rebuilds on mismatch.
  • Sampled requests now decline the lane — under sampling the verify pick is drawn from the sampled distribution, so deterministic drafts can only match by coincidence; measured −4% before the gate, exact serial parity after.

All 9 ngram unit tests pass; clippy clean; zero new CLI flags/env vars.

@AzeezIsh

Copy link
Copy Markdown
Contributor

bfcl-subset FAIL on the nvidia subject — the promised re-run landed, and it fails.

Records committed on review/pr21-fixes (.benchmarks/bfcl-subset/2026-09-12-0bf70e9f13.json) and review/pr23-fixes. Three consecutive runs, identical signature:

run tree spec overall normalized
run-1789206159965049753 pr21 @ 0bf70e9 MTP (recipe default) 85.13 76.60
run-1789263813340128511 pr23 @ 9da215a MTP 85.13 76.60
run-1789290824981666674 pr23 @ 9da215a n-gram 85.03 76.53

Bars: committed min 83.82/83.72 (noise 0.4 → effective 83.42/83.32). Prior unsloth records on the same recipe and draw scored norm 82.2–83.4 (09-03 → 09-11, marginal band). These are the first-ever nvidia bfcl-subset records on this box.

Category split vs the 08-14 dgx1 baseline (84.12 norm): hallucination 84.85 → 55.11 (live_irrelevance 47.73, irrelevance 62.50) while simple_java 45.16→67.74 and simple_javascript 29.03→74.19 improved — the suspected-2026-08 template defect partially healed; the new drop is the model emitting tool calls when it should abstain.

Classification: not a PR regression — identical on both branches; n-gram vs MTP differ only in noise. Candidate mechanisms, in order: (a) nvidia checkpoint abstention behavior (mixed-precision hf_quant_config ≠ unsloth flat NVFP4); (b) checkpoint chat_template / generation_config vs the recipe expectations; (c) box + build-vintage drift vs the dgx1 baseline.

Decisive bisect (queued for the next GPU window): one bfcl-subset leg on --checkpoint unsloth/Qwen3.8-27B-NVFP4 on the current head (~3.5 h). ~83 isolates the checkpoint; ~76.6 indicts the code.

@AzeezIsh

Copy link
Copy Markdown
Contributor

2026-09-15 update — nvidia Flash-Next line (feat/flashnext-nvidia @ 45f5b355, off review/pr23-fixes)

Full record: docs/porting/QWEN38_NVIDIA_PORT_LOG_2026-09-15.md on review/pr21-fixes @ 7dec982e1 (§B, §D). Run-record ids are in the file.

bfcl-subset FAIL on the nvidia 27B is resolved — recipe disable_thinking pin, not this PR; thinking-on gate run PASS 87.94 / 88.24 (see #21).

nvidia/Qwen3.8-Flash-Next-NVFP4 serves on Atlas (loader work 9923d498/dbe6f7d2, MODEL.toml → nvidia): ST-995 83.52 / 82.45 at both the 0.95/16K and the corrected 0.88/32K profile (run-1789433036569430053, run-1789501991840065669); agentic-webserver 50/50 webserver_ok, 816 turns, 32 multi-chunk prompts to 25K, 0 CUDA faults (run-1789474170004681458; Σwall 19,351 s → perf FAIL at 23.7 s/turn serial).

The host OOM (024) decomposed: GB10 memory is unified, so --gpu-memory-utilization is also the host's ceiling — at 0.93 the box sat at 0.87 GB MemAvailable after 25 turns; at 0.95 the OOM killer fired. On top of the pledge the serve's RssAnon grew 2 → 9.8 GB over the 5.4 h agentic run. Bisected (8 legs, fresh serves): growth ∝ context depth, halved with ATLAS_SSM_DECODE_RING=0, stops on prefix-cache hits ⇒ aux-state snapshots — QsaIndexer::snapshot_aux / PleLayer::snapshot_aux allocate a fresh host Vec of ingested×hd×2 bytes per indexer (12 × 4.6 MB at 18K) at every boundary token (decode ring) and every Marconi checkpoint; the churn fragments glibc arenas. Fix 45f5b355: caller-owned, capacity-retaining buffers for both paths and restore-under-lock instead of .cloned() (bytes unchanged; 6 new unit tests). Verified: ring-on now ≡ ring-off (7.9 vs 7.8 MB/1K tok; was 9.5 vs 4.9); the residual matches the retained-by-design 16-slot Marconi aux footprint (~1.3 GB at 27K). End-to-end agentic rerun on the fixed binary is queued (043's profile, mem-traced). Keeping those blobs on device — which would also delete the per-boundary-token synchronize+D2H hitch from review note 5 — is the remaining lever.

--ngram-speculative on the nvidia pack: engages, accepts ~nothing. KL harness (5 prompts) and a positive-control essay (PR shape, 400 out, RUST_LOG=debug): drafts are proposed (26 → 145 debug lines as the table warms) but na=0 almost everywhere; tok_step 1.000, wall = serial. The +36 % measured on RadixArk does not reproduce here under this fingerprint — needs a look at what the dynamic table learns on this checkpoint. Also: the K=2 verify path with rejected drafts is not output-neutral (2/5 prompts diverge at ties).

32K cap / PLE-chunk coupling from the external agent report are both already handled on this line (qsa.rs clamps to --max-seq-len; 9c1ca517 loops PLE over ATLAS_PLE_CHUNK spans). Their misaligned-address fault (D2H at layer 0 of a continuation chunk after a checkpoint save) did not reproduce in our 819-prefill / 32-continuation-chunk agentic run — different chunk size (16K vs 8K) and depth, so two observations, not an A/B; the launch-blocking localization method from #21 applies to it unchanged.

Batched concurrency on the pack (bs4): C1 17.5–18.5 → C4 35–37 agg tok/s, outputs identical across lanes.

AzeezIsh added a commit that referenced this pull request Sep 16, 2026
…ew note 1)

`argmax_bf16.cu`'s header claims the batched kernel is "byte-identical by
construction" to n sequential calls because the tree reduction "prefers the
lower tid". It does not follow: the strided scan keeps the first strict max
WITHIN a lane's stride class, and the merge was `>` only, so equal maxima in
different lanes resolve to the lower LANE. With stride 1024 and the max at
index 1029 (lane 5) and 2050 (lane 2), the kernel returns 2050 while the host
`argmax_first_wins_f32` — and every committed BFCL record — returns 1029.

That is a serial-vs-verify divergence on exact ties, in the same class as the
tie-break rule the 2026-09-03 incident was about: BF16 logits tie often at
temperature 0, and the tie rule alone moved Qwen3.8-27B's BFCL normalized
score 83.38 -> 83.10 before it was reverted.

All four merges now take an equal value from the higher lane when its index is
lower:

* `argmax_bf16`, `argmax_bf16_batch` — the plain `>` clause.
* `argmax_bf16_batch_lp` — the online-softmax merge keeps its `else`
  accumulation (the sum is scale-invariant to which side supplies the index)
  and only fixes the index.
* `argmax_fp32` — same clause.

The header claim is corrected to say what the merge now earns rather than what
the reduction was assumed to imply.

`argmax_tiebreak_contract.rs` gains a guard for the clause at every merge site
with a negative control, so a revert to `>` cannot pass silently — the
existing test only pinned the scans' strict comparison, which is exactly why
this gap survived it.

★ NOT verified on hardware. The .cu change is compiled by CI's
`nvcc -> PTX (all gb10 targets)` job, but its EFFECT on accuracy is not
measurable without a GB10: a tie-rule change moved this gate's score by 0.28
once already. A BFCL leg is queued to measure it before this is trusted; the
committed floors (83.12 / 82.05) carry 0.4 of margin for exactly this.

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

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
AzeezIsh added a commit that referenced this pull request Sep 16, 2026
Records what was closed and what was left, with the mechanism named in each
case:

* note 1 (kernel argmax lane-vs-index) — FIXED in f49be47, with the
  accuracy measurement explicitly NOT done: the same class of change moved
  this gate 83.38 -> 83.10 once already, so job 125 measures it before it is
  trusted.
* note 2 (residual last-wins paths) — documented at both sites.
* note 3 (boundary-dense snapshot eviction) — open, and named as a policy
  trade in the rollback watchdog rather than a bug, with the two candidate
  cures and why neither is verifiable without hardware.
* note 4 (top_logprobs) — the review's question answered precisely: serial
  reports POST-penalty (it extracts after `process_position_logits` folded
  penalties in place) and every verify lane including n-gram reports
  PRE-penalty (it re-reads the raw GPU buffer). So the n-gram lane does match
  the other verify lanes and all of them differ from serial. The contained
  fix is written out, with the two trade-offs that make it a decision rather
  than a patch.

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

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
AzeezIsh added a commit that referenced this pull request Sep 16, 2026
…ew note 1)

`argmax_bf16.cu`'s header claims the batched kernel is "byte-identical by
construction" to n sequential calls because the tree reduction "prefers the
lower tid". It does not follow: the strided scan keeps the first strict max
WITHIN a lane's stride class, and the merge was `>` only, so equal maxima in
different lanes resolve to the lower LANE. With stride 1024 and the max at
index 1029 (lane 5) and 2050 (lane 2), the kernel returns 2050 while the host
`argmax_first_wins_f32` — and every committed BFCL record — returns 1029.

That is a serial-vs-verify divergence on exact ties, in the same class as the
tie-break rule the 2026-09-03 incident was about: BF16 logits tie often at
temperature 0, and the tie rule alone moved Qwen3.8-27B's BFCL normalized
score 83.38 -> 83.10 before it was reverted.

All four merges now take an equal value from the higher lane when its index is
lower:

* `argmax_bf16`, `argmax_bf16_batch` — the plain `>` clause.
* `argmax_bf16_batch_lp` — the online-softmax merge keeps its `else`
  accumulation (the sum is scale-invariant to which side supplies the index)
  and only fixes the index.
* `argmax_fp32` — same clause.

The header claim is corrected to say what the merge now earns rather than what
the reduction was assumed to imply.

`argmax_tiebreak_contract.rs` gains a guard for the clause at every merge site
with a negative control, so a revert to `>` cannot pass silently — the
existing test only pinned the scans' strict comparison, which is exactly why
this gap survived it.

★ NOT verified on hardware. The .cu change is compiled by CI's
`nvcc -> PTX (all gb10 targets)` job, but its EFFECT on accuracy is not
measurable without a GB10: a tie-rule change moved this gate's score by 0.28
once already. A BFCL leg is queued to measure it before this is trusted; the
committed floors (83.12 / 82.05) carry 0.4 of margin for exactly this.

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

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
AzeezIsh added a commit that referenced this pull request Sep 16, 2026
…w note 2)

The #23 review asked for this to be written down so a future reader does not
assume the whole engine is first-wins. It is not:

* `sample_step.rs`'s suppress-ids greedy branch and its penalty-aware MTP
  sibling both use `max_by`, which returns the LAST of several equal maxima;
* the verify kernels resolve ties to the lowest LANE (note 1, now fixed to the
  lowest index) and the host `argmax_first_wins_f32` to the lowest index.

Both sites are left as-is — they match the record tree, and changing them
would move every committed accuracy number — with a comment naming the rule
and the divergence.

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

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
AzeezIsh added a commit that referenced this pull request Sep 16, 2026
…note 6)

Review note 6: the underscore said "unused", but the pre-mutation inert-bound
guard reads it, so the name was lying. Renamed at its four sites.

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

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
AzeezIsh added a commit that referenced this pull request Sep 16, 2026
Records what was closed and what was left, with the mechanism named in each
case:

* note 1 (kernel argmax lane-vs-index) — FIXED in f49be47, with the
  accuracy measurement explicitly NOT done: the same class of change moved
  this gate 83.38 -> 83.10 once already, so job 125 measures it before it is
  trusted.
* note 2 (residual last-wins paths) — documented at both sites.
* note 3 (boundary-dense snapshot eviction) — open, and named as a policy
  trade in the rollback watchdog rather than a bug, with the two candidate
  cures and why neither is verifiable without hardware.
* note 4 (top_logprobs) — the review's question answered precisely: serial
  reports POST-penalty (it extracts after `process_position_logits` folded
  penalties in place) and every verify lane including n-gram reports
  PRE-penalty (it re-reads the raw GPU buffer). So the n-gram lane does match
  the other verify lanes and all of them differ from serial. The contained
  fix is written out, with the two trade-offs that make it a decision rather
  than a patch.

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

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
AzeezIsh added a commit that referenced this pull request Sep 16, 2026
…bfcl-subset fails on the inherited argmax regression

Records produced by `spark benchmark run <gate> --pull-request-gate` on
gx10-e3a3 (NVIDIA GB10, 119.6 GB, driver 580.126.09, CUDA 13.0). Two
environment notes on this box:

* The pinned qwen3.8 serve recipes are sized to dgx2's 121.7 GB. On this
  119.6 GB box the committed footprint exceeds the pinned budget
  (59.8 GB Atlas-own + 43.0 GB reserve vs 101.7 GB at 0.85), so
  decode-floor and bfcl-subset ran with --serve-override
  gpu_memory_utilization=0.92/0.75 — recorded inside each record.
* ttft-cold/ttft-warm had no prior baseline on this box; they record as
  info and become the reiner baselines.

bfcl-subset: FAIL at normalized 83.10 vs baseline 83.32 (overall 86.23).
This is the last-index-wins argmax regression inherited from 0775521 —
identical numbers to what #23 documents and db0bc09
fixes — not a dflash2 defect. Re-run after the argmax revert lands.

agentic-webserver and bfcl-subset-echolp not run on this box (their
subjects are the 3.6 checkpoints; download completed but runs were
declined pending a 3.8-scoped bench call).
AzeezIsh added a commit that referenced this pull request Sep 16, 2026
… on the inherited argmax regression

Full suite re-measured on the review-fix head (per-sequence DFlash
raw-argmax gate + dflash_head clippy cleanup). gx10-e3a3, NVIDIA GB10
119.6 GB, driver 580.126.09, CUDA 13.0. decode-floor ran
--serve-override gpu_memory_utilization=0.92 and bfcl-subset 0.75 —
recorded in provenance — because the pinned budgets were sized for a
121.7 GB box.

bfcl-subset draws 86.23/83.10 for the third time in a row (9bafa47,
683a0db, 323a7e1): the last-index-wins argmax regression inherited
from 0775521, fixed by #23/db0bc097 — not a dflash2
defect. echolp on the 35B subject passes 87.85/87.90.
AzeezIsh added a commit that referenced this pull request Sep 16, 2026
…fx1151 port, HDIM=128 Option-B fix (#33)

* feat(dflash2): add Qwen3.8-27B DFlash2 speculative decoding support

- Add DFlash2 dynamic grouped causal convolution kernel and layer wrapping
  for attention and MLP sublayers.
- Add bilinear candidate selector scoring top-k draft candidates with
  predecessor/successor codebook embeddings and projected hidden states.
- Support incoai/Qwen3.8-27B-DFlash2 drafter architecture and weight loader.
- Fix SSM pool MTP ladder allocation for γ=8 verify slots via full-width reservation.
- Configure MODEL.toml pairing for Qwen3.8-27B with DFlash2.

* perf(dflash2): fused on-device bilinear candidate selector kernel

Eliminates the 4MB D2H sync and 1.74M float CPU top-k bubble scan in
Dflash2CandidateSelector. Moves candidate selection into a fused GPU
kernel dflash2_candidate_selector that executes warp-level top-4 reduction,
context dot-product scoring, and greedy draft advancement in <0.05ms
directly in GPU shared memory.

* feat(bench): add MLPerf edge agentic performance leg (2.5h) runner and template

* spark-server: accept single-quoted --default-chat-template-kwargs

Windows .cmd/.bat launchers can't escape inner double quotes, so the
natural Windows spelling --default-chat-template-kwargs
'{"enable_thinking":true}' arrives at argv with the single quotes
literal (CommandLineToArgvW has no POSIX single-quote semantics) and the
flag failed fail-fast JSON parsing. Strip one wrapping '...' layer
before serde_json::from_str. No valid kwargs JSON begins/ends with ', so
valid inputs are unaffected and typo fail-fast is preserved.

Recipe fixture updated to carry the quoted spelling so the recipe ->
serve_args path exercises the strip end-to-end.

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

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

* bench: gate records for 9bafa47 on reiner — 5 pass, 2 baseline-info, bfcl-subset fails on the inherited argmax regression

Records produced by `spark benchmark run <gate> --pull-request-gate` on
gx10-e3a3 (NVIDIA GB10, 119.6 GB, driver 580.126.09, CUDA 13.0). Two
environment notes on this box:

* The pinned qwen3.8 serve recipes are sized to dgx2's 121.7 GB. On this
  119.6 GB box the committed footprint exceeds the pinned budget
  (59.8 GB Atlas-own + 43.0 GB reserve vs 101.7 GB at 0.85), so
  decode-floor and bfcl-subset ran with --serve-override
  gpu_memory_utilization=0.92/0.75 — recorded inside each record.
* ttft-cold/ttft-warm had no prior baseline on this box; they record as
  info and become the reiner baselines.

bfcl-subset: FAIL at normalized 83.10 vs baseline 83.32 (overall 86.23).
This is the last-index-wins argmax regression inherited from 0775521 —
identical numbers to what #23 documents and db0bc09
fixes — not a dflash2 defect. Re-run after the argmax revert lands.

agentic-webserver and bfcl-subset-echolp not run on this box (their
subjects are the 3.6 checkpoints; download completed but runs were
declined pending a 3.8-scoped bench call).

* spark-model: clippy cleanup in dflash_head (div_ceil, doc list indent, needless borrow)

Pre-existing lints in the dflash2 bring-up, flagged by clippy 1.93 deny-all.

* scheduler: gate DFlash raw-argmax verify per sequence, not process-wide

The --dflash flag made raw-argmax verify apply to EVERY sequence. For sequences whose effective verify pick is not the raw argmax — presence/frequency/repetition penalties, LZ/DRY, grammar, or tool-call EOS suppression — the emitted stream silently followed the unpenalized argmax instead of the request's distribution. This target's non-thinking preset carries presence_penalty=1.5, so it was the common case, not an edge.

Now dflash_seq_uses_raw_argmax requires the process flag AND a neutral-greedy sequence (PenaltyGate::Neutral, no grammar, no require_tool_call). Other sequences fall back to the existing pipeline verify, matching what MTP does for the same request. Measured on GB10: identical prompts diverged vs serial only while penalties were active; byte-identical once zeroed.

Matches SGLang's reference dflash_worker_v2 semantics: verify logits get per-request adjustments (apply_dflash_verify_logits_adjustments) before acceptance; argmax accept-prefix is the greedy arm only.

* bench: gate records for 323a7e1 on reiner — 9 pass, bfcl-subset fails on the inherited argmax regression

Full suite re-measured on the review-fix head (per-sequence DFlash
raw-argmax gate + dflash_head clippy cleanup). gx10-e3a3, NVIDIA GB10
119.6 GB, driver 580.126.09, CUDA 13.0. decode-floor ran
--serve-override gpu_memory_utilization=0.92 and bfcl-subset 0.75 —
recorded in provenance — because the pinned budgets were sized for a
121.7 GB box.

bfcl-subset draws 86.23/83.10 for the third time in a row (9bafa47,
683a0db, 323a7e1): the last-index-wins argmax regression inherited
from 0775521, fixed by #23/db0bc097 — not a dflash2
defect. echolp on the 35B subject passes 87.85/87.90.

* greedy: restore first-index-wins argmax tie-breaking (kernel + host paths)

0775521 switched the greedy tie-break from "first strict maximum wins" to
"value descending, then higher vocabulary index" in argmax_bf16.cu and moved
the host verify argmax and the greedy logit processor to the same last-wins
rule. With BF16 logits at temperature 0 exact ties are common, so the rule
change moves tokens: on the bfcl-subset gate draw for unsloth/Qwen3.8-27B-
NVFP4 it flipped 9 of 207 replayed answers, cost 3 correct ones, and took
the checkpoint from 86.53/83.38 to 86.23/83.10 (bars 83.42/83.32) — main
itself fails its own committed record under the new rule. Reverting only the
kernel on top of main restored all nine samples; reverting the other
accumulation-order change in the same commit restored none.

First-index-wins is also what llama.cpp's greedy sampler and vLLM's
torch.argmax do, so it is the rule the recorded baselines and the other
engines share. This restores:
  * kernels/gb10/common/argmax_bf16.cu — the 61f6976 kernel, verbatim
  * scheduler/verify_pipeline_helper/argmax.rs — argmax_first_wins
  * scheduler/verify_pipeline_helper.rs, logit_processors/mod.rs — call the
    first-wins helper (spark_runtime::sampler::argmax_first_wins_f32)
  * atlas-kernels/tests/argmax_tiebreak_contract.rs — now locks the
    first-wins rule instead of the last-wins comparator

Co-Authored-By: Claude Fable 5.1 <[email protected]>

* bench: gate records for 0bf70e9 on reiner — 9 pass; bfcl-subset FAIL 76.60 norm on nvidia subject

* spark-server: resolve --dflash-gamma from MODEL.toml when the flag is absent

The clap default (16) shadowed the target's `[dflash] gamma`, so every
recipe-driven `--dflash` serve ran γ=16 regardless of MODEL.toml — the
serve_args doc comment already admitted the fallback was unreachable.
Precedence now mirrors --num-drafts: flag → MODEL.toml → engine default
16, logged once at boot with its source. qwen3.8-27b's `gamma = 8` is the
measured Option-B optimum on this box (γ=8 ~22 tok/s vs γ=16 17.8, job 026)
and sidesteps the γ=16 second-sequence status-700 fault (job 040 bisect).

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

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

* kernels: copy DFlash2 + sink paged-attention kernels to strix-hip

Verbatim ports from kernels/gb10/common: dense_gemv_bf16_batchm,
dflash_batch_anchor_add, dflash_batch_markov, dflash2_conv,
dflash2_candidate_selector, and the three ATLAS_ATTN_SINKS paged
wrappers (sink / indirect_sink / batched_sink). The wrappers'
LOAD_KV_TILE already matches the strix atlas_cp16 idiom.

* atlas-kernels: extend argmax tie-break contract test to strix-hip

strix-hip/common/argmax_bf16.cu already implements first-index-wins
(it is byte-identical to the post-revert gb10 kernel); the contract
test now reads both per-hardware copies so the rule cannot silently
regress on either target.

* kernels: port batched/indirect/rope-override/sink support to strix-hip prefill header

Mirrors the four gb10 features the DFlash2 sink wrappers need, in both
the BR=32 kernel and the clamped _64 entry:
- non-const kv_len/q_offset; PREFILL_BATCHED gains cu_seqlens/kv_lens
  (fixing a pre-existing arity mismatch: ops::prefill_attention_paged_batched
  already passes them) plus the PREFILL_BATCHED_INDIRECT_ARGS
  batch_indirect_args parameter;
- VARLEN per-stream geometry (q_base_b, q_len_eff) and the indirect
  kv_len/q_offset override; q_batch_off now derives from q_base_b;
- q_rope_pos (batch_indirect_args[b*3+2], Q_ROPE_POS_OVERRIDE, default
  q_offset) feeding the softmax mask row and the sliding-window
  kv_block_lo loop bound;
- ATLAS_ATTN_SINKS epilogue: sink logit joins the denominator in
  smem_ml, acc_o rescaled via smem_resc on the PV C-fragment map.
Default-path codegen is unchanged: with no new macros defined the only
deltas are parameter const-ness and the q_len->q_len_eff rename
(q_rope_pos == q_offset there).

* strix: wire DFlash2 into MODEL.toml + serve-amd.sh

kernels/strix-hip/qwen3.8-27b/MODEL.toml gains the [dflash] section
(incoai/Qwen3.8-27B-DFlash2, gamma 8, window 4096, mask 248070, layers
[5,19,33,47,61]) now that the strix-hip tree carries the kernels; the
SCALE strix MODEL.toml keeps DFlash absent with a pointer to strix-hip.
serve-amd.sh adds DFLASH=1 (--dflash --draft-model, optional
DFLASH_GAMMA), mutually exclusive with the MTP --speculative args.

* kernels: register the strix-hip sink-prefill module renames

Dispatch asks for prefill_paged_sink / prefill_paged_indirect_sink
(the same [modules] renames gb10 declares); without them the new
wrappers registered under their raw inferspark_ stems and the DFlash
drafter load failed the startup kernel audit.

* strix: size the default GPU_UTIL for the DFlash2 drafter

The KV budget is computed before the ~5 GB drafter allocates, so the
0.88 default OOM'd the DFlash serve on gfx1151 (cuMemAlloc status 2,
4.2 GB free at a 635 MB request). Default to 0.80 when DFLASH=1;
explicit GPU_UTIL still wins.

* kernels: HDIM=128 builds of the DFlash sink paged-attention kernels

DFlash2 drafters run head_dim=128 (incoai config), but the sink
wrappers include prefill_paged_compute.cuh at the default HDIM=256:
the tile loaders' HDIM/8-chunk rows and the HDIM/16 QK contraction
then read the neighbouring head's data into every score. Adds the
_h128 variants (identical source, #define HDIM 128 before the
header include) on gb10 and strix-hip, with the prefill_paged_*_h128
module renames matching the existing convention. The batched variant
keeps its raw stem like its sibling.

* atlas-kernels: allow the 3.8-trained DFlash2 drafter in the qwen3.8 target test

The merge of main's target_resolution test asserted [dflash] absent on
qwen3.8-27b, but PR21 legitimately added incoai/Qwen3.8-27B-DFlash2 — a
drafter trained on 3.8 hidden states. The test now permits exactly that
draft_model and still rejects the 3.6-trained one.

* dflash: select paged sink attention kernels by drafter head_dim

The drafter KV cache is head_dim=128, but Option B dispatched the
HDIM=256 sink builds: tile loaders iterate HDIM/8 chunks per row and
the QK loop contracts HDIM/16 steps, so each row's dims 128..255 were
the neighbouring head's data contaminating every score — the likely
source of the Option-B acceptance drop. paged_sink_modules_for_head_dim
maps head_dim onto the _h128 builds (128) or the original names (256)
and bails otherwise; prefill_attn_dflash_fp8 stays HDIM-256-only
(flagged in-code). The acceptance effect is measured in the Strix
A/B matrix (strix:~/dp4a-ab/out/dflash-ab-*, this branch).

* dflash: route M<=8 drafter BF16 projections through the batched GEMV on gfx1151

Every drafter projection at decode runs at M=gamma rows (gamma <= 8), but
dense_gemm_bf16_pipelined is a 128-row M-tile WMMA GEMM — ~94% padded MMA
work on gfx1151's ~2-3.5 TFLOPS BF16 WMMA, which is why Option-B propose
measured ~358 ms/step on Strix (dflash-h128-20260915T1546Z). The
bandwidth-bound dense_gemv_bf16_batchm kernel (MAX_M 8) already covers
every gamma the drafter uses.

New drafter_dense_gemm() on BlockDiffusionDraftHead picks the batched
GEMV when m in 1..=8 and the arm is enabled (default ON under
cfg!(atlas_scale), OFF on NVIDIA; ATLAS_DFLASH_SMALL_M_GEMV=1|0
overrides). conv::prepare and selector::select_candidates now take a
gemm closure instead of a KernelHandle so callers choose the arm; the
legacy non-paged path passes a pipelined-GEMM closure unchanged.
precompute_ctx_kv routes both ctx GEMMs through it (prefill-time n is
large and falls through to the GEMM automatically). Both arms
accumulate in FP32 but are not bit-identical.

* strix: default the DFlash2 serve to the paged Option-B drafter path

* ci: keep dflash forward_block_layer under the 500-LoC cap

* docs(strix): DFlash2 speculative decoding on gfx1151 — port, measurements, known gaps

* strix: expose the SSM checkpoint interval as SSM_CKPT_INTERVAL

* docs(strix): record the DFlash2 ST-995 golden-draw result

* scripts(strix): DFlash2 A/B, leg and concurrency runners

* docs(strix): record the GB10 DFlash2 batched-concurrency gap

Job 132 concurrency-sweep (nvidia/Qwen3.8-27B-NVFP4, dflash=true +
Option-B, gamma=8, bs16, util 0.70): all cells ran clean but aggregate
throughput is flat ~24-25.6 tok/s at C1-C16 vs MTP 20.9->85.2 scaling.
Documented as known gap / future work in the porting log and committed
both gate records (concurrency-sweep + agentic-webserver).

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

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

---------

Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Andrei Vogulkin <[email protected]>
Co-authored-by: Claude Fable 5.1 <[email protected]>
@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 17, 2026
AzeezIsh added a commit that referenced this pull request Sep 24, 2026
qwen4_exp: land #23 (review branch) + nvidia/Qwen3.8-Flash-Next-NVFP4 pack, PLE scratch bound, aux-snapshot buffer reuse
@AzeezIsh
AzeezIsh merged commit 3d92224 into Atlas-Inf:main Sep 24, 2026
52 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-rebase Conflicts with main — its green checks are NOT real (GitHub skips merge-commit workflows)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants