Skip to content

strix-hip: F16 m128 twin on every shape (drop the 40M N·K cut) — Flash-Next prefill -3% - #249

Merged
AzeezIsh merged 2 commits into
mainfrom
perf/hip-f16-m128-no-cut
Oct 29, 2026
Merged

AzeezIsh merged 2 commits into
mainfrom
perf/hip-f16-m128-no-cut

Conversation

@AzeezIsh

Copy link
Copy Markdown
Contributor

strix-hip: F16 m128 twin on every shape (drop the 40M N·K cut)

m128_for_shape routed w4a16_gemm_t_m128 launches with N·K < 40M to the BF16 base kernel. That cut was fitted from six shapes on the double-buffered twin (strix job 146), where the base won the small weights. Since the single-LDS + B-reuse twin (#235) the twin wins at every shape. Default cut → 0; ATLAS_F16_M128_MIN_NK=40000000 restores the old behaviour.

Kernel (strix s104, M=2048, base vs twin in one process, three alternating rounds)

shape base TF/s twin TF/s
FNext attn q 12288×2560 (was base) 20.7–22.4 27.7–28.9
27B qkv 5120×5120 (was base) 21.9–22.4 28.2–28.7
FNext out 2560×6144 (was base) 19.6–21.8 25.4–28.0
FNext kv 1024×2560 (was base) 18.2–18.5 22.6–22.9
27B gate/up, 27B down, FNext qkvz (already twin) 18.0–23.1 27.1–29.6

End to end

  • Flash-Next NVFP4 (framework f82, main build, env A/B, interleaved ×3): −3% cold TTFT at 1.9k / 7.4k / 12.5k in every round (7.4k: 8.80 / 8.84 / 8.83 → 8.53 / 8.60 / 8.57 s; 835 → 860 tok/s).
  • Qwen3.6-27B-NVFP4 (framework f85, interleaved ×3): no change. Probes identical, timings equal to the hundredth; its small projections don't route through this path.
  • Qwen3.8-27B-NVFP4: unaffected. Its NVFP4 shapes are all ≥ 40M and its attention projections are FP8.

Accuracy

The twin's F16 dequant of E2M1 × E4M3 is exact, while the base rounds every weight to BF16, so Flash-Next's outputs change (its 2k / 10k probes diverge, as any non-identical change does past the QSA bound).

  • Flash-Next gate (framework f80, the gate tc2 shipped on): needles 12/12 both arms; dense ppl 9.6654 → 9.6383 (ratio 0.9972); above-bound 5.2465 → 5.2466 (1.0000).
  • Qwen3.6-27B (strix s105): ppl bit-exact (11.9872 → 11.9872, 8.1045 → 8.1045), needles 12/12.

Aside: s105's own sequential timing on the ROG Flow Z13 read this change as −9 to −25% on Qwen3.6-27B. f85 shows the computation is bit-identical there, so that was tablet throttling. Non-interleaved timing on that box isn't evidence.

🤖 Generated with Claude Code

AzeezIsh and others added 2 commits October 29, 2026 06:31
The 40M cut was fitted on the double-buffered twin, where the BF16 base
won the small weights. Since the single-LDS + B-reuse twin (#235) the twin
wins at every measured shape, 1.22-1.39x (strix s104, M=2048, three
alternating rounds), so the default cut is now 0.

Flash-Next NVFP4 prefill is -3% at 1.9k / 7.4k / 12.5k (framework f82,
interleaved x3). The twin's F16 dequant is exact where the base rounds each
weight to BF16, so outputs change. The f80 gate cleared that: ppl dense
9.6654 -> 9.6383, above-bound 1.0000, needles 12/12. Qwen3.6-27B, whose
5120x5120 qkv crosses the old cut, has its own gate (s105). Qwen3.8-27B is
unchanged: its NVFP4 shapes are all above 40M.

ATLAS_F16_M128_MIN_NK=40000000 restores the old behaviour.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…hape)

The test encoded the old 40M cut's verdicts. With the cut at 0 (s104: the
single-LDS twin wins at all seven measured shapes), every shape keeps the
twin. Other handles still pass through.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@AzeezIsh
AzeezIsh merged commit e9491be into main Oct 29, 2026
25 of 26 checks passed
@AzeezIsh
AzeezIsh deleted the perf/hip-f16-m128-no-cut branch October 30, 2026 05:31
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