Skip to content

spark-model: DFlash2 lm_head batchm-GEMV + verify m≤16 ladder + serve launchers - #60

Merged
AzeezIsh merged 4 commits into
mainfrom
fix/dflash2-batchm-gemv-main
Sep 24, 2026
Merged

AzeezIsh merged 4 commits into
mainfrom
fix/dflash2-batchm-gemv-main

Conversation

@AzeezIsh

Copy link
Copy Markdown
Contributor

Summary

  • dflash_head: route the eager drafter γ-row lm_head projection through w4a16_gemv_batchm instead of the M64-tile w4a16_gemm / dense_gemm_bf16_pipelined path — the single kernel that rocprof attributed ~75% of propose time to on gfx1151 (~164ms/step, grid ≈ 2×248320 vocab)
  • layers: extend the w4a16 batched-GEMV verify ladder to m=9..16 (w4a16_gemv_batch16 fallback, mirroring the established narrow→batch16 pattern in mtp_head/lm_head_batched/ssm_batched) so γ=8 verify at n=9 rows stops falling back to tile-GEMM/prefill paths
  • Add the fingerprinted DFlash2 serve launchers: scripts/strix/dflash2/serve_dflash2.sh (Linux) and scripts/strix-windows/win_serve_dflash2.ps1 (ASCII-only for Windows PowerShell 5.1)
  • Port-doc re-measurement notes

These commits are already merged into integration/nvidia-lane-2026-09-20 (c8b88c6) and both Strix port branches; this PR lands the same pieces on main.

Measured (AzeezStrix gfx1151, binary sha e3343a66, same-harness A/B)

arm before → after propose_med verify_med
DFlash2 γ=4 11.39 → 22.71 tok/s 190.8 → 24.1ms 120.3ms
DFlash2 γ=8 9.80 → 15.65 tok/s 228.7 → 60.4ms 255.4ms
MTP K4 control 21.31 → 22.01 — —

Windows (winbox, γ=4): 28.5 tok/s server-attested, mean_na 2.68. GB10 container smoke on sha-c8b88c6: γ=8, 344/400 accepted.

Concurrency sweep on GB10 (c8b88c6, γ=8, ATLAS_DFLASH_OPTION_B=1, ISL 512)

27.3 / 37.2 / 47.9 / 47.5 agg tok/s at C1/C4/C8/C16 — beats the #52 reference table (25.2/33.6/40.2/42.1) at every cell; scaling saturates after C8.

Test plan

  • cargo fmt --all -- --check, cargo check -p spark-model -p spark-server (clean on this branch)
  • Strix Linux + Windows E2E serve on these commits
  • GB10 image (sha-c8b88c6) container smoke incl. DFlash request
  • CUDA-host build + single_gpu_suite slice

Generated with Devin

AzeezIsh and others added 4 commits September 23, 2026 23:18
…GEMV

The eager forward_block tail sent the gamma-row vocab projection through
the M64-tile w4a16_gemm: at M=gamma=8 the tile pads 8 real rows to 64, so
~7/8 of its MMA work is dead — on gfx1151 rocprof shows ~164 ms/step for
this single launch, ~75% of the ~220 ms propose. The batched tail already
picks w4a16_gemv_batch{4,8,16}; the eager path now mirrors it, keeping
w4a16_gemm as the fallback for gamma>16 or a missing tier. The BF16-head
arms go through drafter_dense_gemm so they pick up the small-M
dense_gemv_bf16_batchm policy instead of the 128-row pipelined tile.
Batched DFlash verify (C>=2, or gamma>8) pushes n=9..16 rows through the
attention o_proj and dense FFN, but both ladders capped at the narrow
batchm family's M=8 and fell through to the tile-GEMM prefill path — the
~156 GB/s cliff the batchm family exists to avoid. Give DenseFfnLayer and
Qwen3AttentionLayer a w4a16_gemv_batch16 fallback handle — the same
"narrow tier first, else batch16" rule mtp_head::lm_head_batch_kernel and
lm_head_batched already implement — and widen the multi_seq FFN arm to
4..=16. The fused QKV tile GEMM stays at n>8: the k/v N=1024 shapes are
the worst-utilised GEMV shapes in the model and the fused weight is what
the arm was built for.
rocprof pinned the dominant propose cost on the drafter lm_head
(M64-tile w4a16_gemm, ~75% of propose). With 947619a/7bd99f314
the same-harness numbers move g8 9.80->15.65, g4 11.39->22.71
(parity with the MTP K4 control at 22.01); verify K=9 292.4->255.4 ms.
serve_dflash2.sh + win_serve_dflash2.ps1 land the fingerprinted serve
profile (Option-B env, ssm slots, slai policy) as runnable launchers;
the ps1 is ASCII-only for Windows PowerShell 5.1.

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

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant