Skip to content

kernels(gb10): restore the certified v1 dense_gemv_bf16 that #9 overwrote - #39

Closed
AzeezIsh wants to merge 1 commit into
mainfrom
fix/gb10-restore-dense-gemv-bf16-v1
Closed

AzeezIsh wants to merge 1 commit into
mainfrom
fix/gb10-restore-dense-gemv-bf16-v1

Conversation

@AzeezIsh

Copy link
Copy Markdown
Contributor

Summary

  • PR Qwen3.8-27B on Strix Halo (gfx1151) — Windows leg #9 (f2ec96d5c, Strix Halo Windows leg) replaced kernels/gb10/common/dense_gemv_bf16.cu with the gfx1151 "v2" kernel (blob 805c07ecf → 779f60c02) while its header states the certified NVIDIA target was untouched. The symlink it replaced was strix-hip's, which pointed at gb10 — so the gb10 kernel itself changed.
  • v2 is not bit-identical to v1 on gb10, contrary to its comment: v1 partitions each output's K range over 64 threads (BLOCK_SIZE 256 / N_PER_BLOCK 4, stride 64, two-warp shuffle + smem add); v2 over 32 (stride 32, one warp). Different per-thread product subsets ⇒ different FP32 accumulation ⇒ BF16 output flips at near-ties.
  • Flash-Next dispatches this kernel on its BF16 lm_head and all 36 GDN projections (qwen3_ssm/init.rs, impl_a1.rs, ops/qwen4exp.rs), and other kernels carry a documented "bit-identical to dense_gemv_bf16 at M=1" contract (qwen3_attention/decode/attention_forward.rs:762, multi_seq/qkv.rs:159).
  • This restores only the gb10 file to its pre-Qwen3.8-27B on Strix Halo (gfx1151) — Windows leg #9 content. strix-hip keeps its v2 copy; strix/ (symlink into gb10) returns to its pre-Qwen3.8-27B on Strix Halo (gfx1151) — Windows leg #9 state.

Evidence

Same box (gx10-e3a3), same serve profile (util 0.88 / 32K / prefill 16K, prefix caching, --ngram-speculative inert ⇒ serial), same golden ST-995 draw on nvidia/Qwen3.8-Flash-Next-NVFP4:

head engine delta overall / normalized record
45f5b355 + argmax tie-break — 83.52 / 82.45 run-1789591710115920743 (09-16)
1cec99896 (feat/flashnext-nvidia tip) + merge of main incl. #9 83.42 / 81.40 run-1789856554862860168 (09-19)

Twelve subsets moved by 1–2 samples each, in both directions (irrelevance −4.16, parallel +4.03, simple_javascript +3.22, simple_java −3.22, …) — the signature of near-tie flips, not a category regression. Normalized fell 0.65 under the committed 82.05 floor. a8742a036 (MIXED_PRECISION vote) is ruled out: both serves log Standard for every attention layer.

The nvidia 27B pack (FP8 attention, NVFP4 MLP/head) does not route through this kernel on its decode path, so the 27B records at 9264bf4ec are not expected to move.

Test plan

  • git hash-object = 805c07ecf60891973299014286137583439c6237 (pre-Qwen3.8-27B on Strix Halo (gfx1151) — Windows leg #9 blob); header SM121 (GB10), N_PER_BLOCK 4
  • typos, git diff --check, scripts/check_kernel_shadows.py OK, cargo test -p atlas-kernels 10/10
  • GB10: ST-995 re-run at feat/flashnext-nvidia @ 0513921e5 (this commit cherry-picked) — expect the 83.52 / 82.45 trajectory back; queued as fnext-head-bfcl
  • GB10: decode-floor + concurrency-sweep (27B) at the same head — expect unchanged

Generated with Devin

…rote

PR #9 (Strix Halo Windows leg, f2ec96d) replaced kernels/gb10/common/
dense_gemv_bf16.cu with the gfx1151 "v2" kernel while its own header says
"the gb10 symlink is replaced by this copy so the certified NVIDIA target
is untouched". The gb10 blob changed (805c07e -> 779f60c); the symlink
that was replaced was strix-hip's, pointing AT gb10.

v2 is not bit-identical to v1 on gb10, contrary to its comment: v1 splits
each output's K range over 64 threads (BLOCK_SIZE 256 / N_PER_BLOCK 4,
stride 64, two-warp shuffle + smem add); v2 over 32 (stride 32, one warp).
Each thread therefore accumulates a different subset of products in FP32,
and the final BF16 rounding differs at near-ties. Flash-Next dispatches
this kernel on its BF16 lm_head and on all 36 GDN projections
(qwen3_ssm/init.rs, impl_a1.rs, ops/qwen4exp.rs), and several kernels
document a "bit-identical to dense_gemv_bf16 at M=1" contract
(qwen3_attention/decode/attention_forward.rs:762, multi_seq/qkv.rs:159).

Observed: nvidia/Qwen3.8-Flash-Next-NVFP4 ST-995 (golden draw, n=995,
temp 0, serial) on the same serve profile and box: 83.52/82.45 at
45f5b35+tiebreak (run-1789591710115920743) vs 83.42/81.40 at 1cec998,
whose only engine delta is the merge of main incl. #9
(run-1789856554862860168); twelve subsets moved by 1-2 samples each in
both directions, the signature of near-tie flips, not of a category
regression. Restoring v1 on gb10 only; strix-hip keeps its v2 copy.

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

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

Copy link
Copy Markdown
Contributor Author

Measured: the restore does not bring the 83.52 / 82.45 trajectory back — attribution withdrawn

ST-995 on nvidia/Qwen3.8-Flash-Next-NVFP4, same box, same serve profile (util 0.88 / 32K / prefill 16K / prefix caching / --ngram-speculative inert ⇒ serial):

head gb10 dense_gemv_bf16 overall / normalized hallucination cat. record
45f5b355+tiebreak v1 83.52 / 82.45 85.98 run-1789591710115920743
1cec99896 (+ main incl. #9) v2 83.42 / 81.40 82.20 run-1789856554862860168
0513921e5 (+ #38, this restore) v1 83.22 / 80.61 ~79.4 run-1789874357981295211

So the claim in the description that v2 caused the 82.45 → 81.40 move is not supported: putting v1 back moved the number again, further down. What the three points do establish:

  • the trajectory is sensitive to accumulation order at the ~1-point-normalized level (1cec99896 → 0513921e5 differs by this kernel swap plus spark-model: size DFlash SSM verify pools uniformly at K-1 #38, which is a no-op for Flash-Next: dflash_capture_layers is empty and num_intermediates == num_drafts + 1);
  • the movement is not symmetric noise across subsets: live_irrelevance 88.64 → 85.23 → 79.55 while parallel/simple_javascript rose — the model calls tools slightly more often on abstention prompts. Whether that is tie-noise with a consistent sign or a real regression elsewhere in the main merge cannot be decided from three points.

A tie-noise probe is queued (same binary and profile, only --max-prefill-tokens 4096, which re-chunks every prompt > 4K and nothing else). Within ±0.3 of 80.61 ⇒ the slide is real and needs a bisect through the main merge; ~±1 ⇒ the metric's noise floor is ~1 point and the committed 0.4 is miscalibrated.

What this PR still is: a restore of the certified GB10 kernel that #9 replaced without a measurement and contrary to its own header. That stands on its own; it is not an accuracy fix, and the description's "Evidence" section should be read with this comment. The 27B gates are unaffected as predicted (decode-floor 660/660/660 → 660 — that one is a streaming-watchdog false positive on code, separate fix coming; concurrency-sweep PASS C1 20.8 · C4 46.4 · C8 60.0 · C16 89.5).

AzeezIsh added a commit that referenced this pull request Sep 21, 2026
…ypothesis leg)

Restores the NVIDIA bodies of `w4a16_gemv_qg` and `w4a16_gemv_qkvz` to their
45f5b35 text (blob 1d80c55): the per-element `acc += a*lut[nibble]*scale`
k8 loop. The Strix merges (f2ec96d / c467b90 via e4417a8) rewrote them
onto the shared `w4a16_gemv_partial` accumulation (per-group partial, then
`fmaf(scale, part, acc)`), which is a different FP32 summation order. The
gfx1151 side keeps the partial helper under `__HIP_PLATFORM_AMD__` (the
strix-hip file is a symlink to this one). `w4a16_gemv`, `_sw`, `_logits` and
the batch tiers were already on the helper at 45f5b35 and are untouched.

These two kernels are the fused GDN q/g and q/k/v/z serial-decode projections
of Flash-Next, so this is a candidate for the ST-995 drift 82.45 -> 81.40
(45f5b35 -> 1cec998); with dense_gemv_bf16 restored in #39 it is the last
gb10 M=1 kernel on that path whose NVIDIA arithmetic changed in the segment.
Unmeasured until the ST-995 leg at this head reports; reverted if the score
does not move.

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

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

Copy link
Copy Markdown
Contributor Author

Already on feat/flashnext-nvidia (0513921e5); lands with #35. Measured note stands: restoring v1 alone did not recover the ST-995 floor (83.22 / 80.61 at that head, reproduced exactly by job 181) — the remaining candidate on the serial path is the fused QG/QKVZ GEMV rewrite, now under test as cfb03a953 on the same branch.

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