Repository navigation
Conversation
- 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.
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.
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>
Measured on GB10 (
|
| Prompt class | Serial tok/s | DFlash2 tok/s | Speedup | mean_na | tok_step |
|---|---|---|---|---|---|
| code (LCS) | 13.0 | 26.2 | 2.0x | 8.885 | 9.885 |
| JSON | 13.3 | 34.2 | 2.6x | 7.500 | 8.500 |
| short prose | 13.2 | 14.8 | 1.1x | 2.706 | 3.706 |
| recall list | 13.3 | 29.9 | 2.2x | 6.167 | 7.167 |
Median ~2.0x serial decode; per-step acceptance 0–47% with bursts to 59% — broadly consistent with the PR's 1.8x claim and the independent SGLang evidence (3.95 tok/step at D=16; here γ=15 verify, up to 8.9 accepted/step). Earlier mixed code+prose request: 11.7 tok/s with the arbiter keeping spec on only 20% of steps — the gate correctly sheds spec when acceptance collapses.
Gate records run on this head
concurrency-sweepPASS (4/4 cells; C1 21.1 / C4 48.0 / C8 60.0 / C16 89.5 tok/s)decode-floorPASS — 22.2 tok/s, accept_len 2.64 (needed--serve-override gpu_memory_utilization=0.92: the pinned recipe is sized for a 121.7 GB box and OOMs at 0.85 on this 119.6 GB one — 59.8 committed + 43.0 reserve > 101.7 budget)bfcl-subsetFAIL — normalized 83.10 < 83.32 (overall 86.23). This is the inherited last-index-wins argmax regression from07755218, digit-for-digit what PR qwen4_exp: seven fixes for long-form serving of Qwen3.8-Flash-Next on a GB10 #23 documented anddb0bc097fixes — not a dflash2 defect. Expect PASS once that revert lands/merges.
Two findings worth addressing
-
DFlash verify bypasses the sampling pipeline.
step_verify_dflashusesverified_argmaxdirectly whendflash_verify_raw_argmaxis set, so presence/frequency/repetition penalties (and any temp>0 semantics) never reach the emitted stream — the non-thinking preset for this model shipspresence_penalty=1.5. Reproduced: identical temp-0 requests diverge vs serial only while penalties are active; with penalties zeroed, 2/4 prompts are byte-identical and the other 2 differ at single near-tie positions (verify-row argmax vs decode argmax — same tie-break class PR qwen4_exp: seven fixes for long-form serving of Qwen3.8-Flash-Next on a GB10 #23'sdb0bc097addresses; kernel merges keep lower-lane not lower-index). The verify itself is honest —accepted ⟺ draft == target argmax— but under penalized/sampled requests the emitted distribution isn't the one the request asked for. Consider gating the raw-argmax path totemperature<=0 && !penalties_active, or routingverifiedthroughverify_pick_all_with_pipelineotherwise (the pipeline branch already exists, just unreachable when the lever is set). -
Boot memory ceiling on this box.
--dflashat--gpu-memory-utilization 0.85+max-batch-size 4dies in drafter build (cuMemAllocOOM, 646 MB free).0.78+ bs=1 is comfortable — worth a note in the PR body or the serve docs since the gate recipes pin 0.85.
Minor: --dflash --enable-prefix-caching prints a community-reported SM12.x correctness warning — surfaced cleanly at boot, good.
|
Follow-up — Same 4-prompt probe (temp 0, penalties zeroed, bs1): 24.1 / 24.6 / 11.3 / 26.4 tok/s, mean_na 2.1–8.4 — same envelope as the unsloth pack (26.2/34.2/14.8/29.9). Both packs serve equivalently; note BENCH.toml's gate entries only register |
…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).
|
Review follow-up — two commits pushed to
Neither adds flags/env vars — behavior-only. |
…r and concurrency-sweep pass, bfcl-subset fails on the inherited argmax regression Re-measured at the post-ee15431a head after the earlier 9bafa47 records were invalidated by the serve.rs change. Same box (gx10-e3a3, GB10, 119.6 GB): decode-floor 22.3 tok/s (floor 20.5, util override 0.92 recorded), concurrency-sweep 4/4 cells, bfcl-subset FAIL 86.23/83.10 — byte-for-byte the same draw as the 9bafa47 record, i.e. the last-index-wins argmax regression inherited from 0775521 that #23/db0bc097 fixes. Not a dflash2 defect; re-run after the revert lands.
|
Live verification of |
|
Complete gate re-run on the fix head
The verify-gate fix ( |
Update:
|
|
bfcl-subset FAIL on the nvidia subject — the promised re-run landed, and it fails. Records committed on
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 Decisive bisect (queued for the next GPU window): one bfcl-subset leg on |
|
Heads-up: #33 stacks |
2026-09-15 update —
|
…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]>
|
Closing as superseded: this PR's DFlash2 work landed on Post-merge verification of the landed code (main @ |
Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Summary
This PR adds complete support for DFlash2 block-diffusion speculative decoding on Qwen3.8-27B ($\gamma=8$ , =7$ verify drafts).
unsloth/Qwen3.8-27B-NVFP4target paired withincoai/Qwen3.8-27B-DFlash2drafter,Changes
dflash2_conv.cuimplementing 2-tap grouped dynamic causal convolution with dynamic kernel deltas generated via per-layerkernel_projection.Dflash2Convpre- and post-attention/MLP inforward_block_layer.rsandforward_block_layer_paged.rs.Dflash2CandidateSelectorscoring draft token candidates using unary logits, projected hidden states, and predecessor/successor codebook embeddings.ssm_pool.rs) to allocate uniform full-width intermediates when =\gamma=8$, avoiding fallback to ladder caps.kernels/gb10/qwen3.8-27b/MODEL.tomlwith[dflash]configuration.Verification & Performance
spark-modelDFlash unit tests passing;cargo fmtverified.