Skip to content

strix-hip Flash-Next: port the fused GDN decode kernels (cluster-free) + BATCH_SMALL above MAX_BATCH 1 (C4 +5.6%, C8 +4.7%) - #300

Merged
AzeezIsh merged 2 commits into
mainfrom
perf/hip-gdn-decode-fused
Oct 31, 2026
Merged

AzeezIsh merged 2 commits into
mainfrom
perf/hip-gdn-decode-fused

Conversation

@AzeezIsh

Copy link
Copy Markdown
Contributor

qwen4exp_gdn_decode_fused (ATLAS_QWEN4EXP_DECODE_FUSE) and qwen4exp_gdn_decode_fused_rows (ATLAS_QWEN4EXP_BATCH_SMALL) group the three value heads of a key head into a thread-block cluster. The cluster barrier orders the shared q/k conv-window store after every block's read. gfx1151 has no clusters, and qwen4exp_decode_fuse.cu never built for strix-hip, so both switches silently kept the per-row four-kernel chain:

  • framework f130 / f159: BATCH_SMALL measured "neutral", but that was the fallback
  • framework f154: gated_delta_rule_decode_f32 ran 73,476 launches, 7.4% of a C8 step

Port (kernels/strix-hip/qwen3.8-flash-next/nvfp4/qwen4exp_decode_fuse.cu):

  • one block of 3 × 128 threads is the cluster: sub-block s owns value head blockIdx.x * 3 + s
  • the cluster barrier is __syncthreads
  • every shared array a gb10 block owns is indexed by s (a device function's static __shared__ is one instance per block, so the helpers take it explicitly)
  • each thread runs the gb10 thread's operations in the same order
  • launchers pick (nv / 3, rows) × 384 under cfg(atlas_hip)
  • verify / defer / commit cluster kernels stay gb10-only; their lookups resolve to 0 as before
  • moe_blend_hc_post copied unchanged

Recipe: serve-amd.sh sets ATLAS_QWEN4EXP_BATCH_SMALL=1 above MAX_BATCH 1, next to BATCH_FAST. Explicit values win.

A/B (framework f160, main-298 385d465 vs 11f49ad, Flash-Next NVFP4, MAX_BATCH 8, lane on, AR, Gufo protocol ×2):

C1 C4 C8
main 12.8 / 12.8 34.1 / 33.9 38.3 / 38.1
BATCH_SMALL=1 12.8 / 12.8 35.8 / 36.0 40.0 / 40.0
DECODE_FUSE=1 MASK=1 13.1 / 13.1 34.1 / 34.0 38.2 / 38.2
  • Fused-GDN lookup failures 0; faults 0.
  • Solo replies identical to main 8/8 for both arms; solo-vs-C8 identity 5/8 on all three.
  • DECODE_FUSE is not made a default here; its MAX_BATCH 1 (FP8 GDN + MTP) check, f161, is queued.

🤖 Generated with Claude Code

AzeezIsh and others added 2 commits October 31, 2026 17:38
…r gb10 cluster)

qwen4exp_gdn_decode_fused (ATLAS_QWEN4EXP_DECODE_FUSE) and
qwen4exp_gdn_decode_fused_rows (ATLAS_QWEN4EXP_BATCH_SMALL) group the
three value heads of a key head into a thread-block cluster. The
cluster barrier orders the shared q/k conv-window store after every
block's read. gfx1151 has no clusters, and the gb10 file never built
for strix-hip, so both switches silently kept the per-row four-kernel
chain:
- framework f130 / f159: BATCH_SMALL "neutral" was the fallback
- framework f154: gated_delta_rule_decode_f32 ran 73,476 launches,
  7.4% of a C8 step

Here one block of 3 x 128 threads is the cluster:
- sub-block s owns value head blockIdx.x * 3 + s
- the cluster barrier is __syncthreads
- every shared array a gb10 block owns is indexed by s; the helpers
  take it explicitly, since a device function's static __shared__ is one
  instance per block
- each thread runs the gb10 thread's operations in the same order
The launchers pick (nv / 3, rows) x 384 under cfg(atlas_hip). The
verify / defer / commit cluster kernels stay gb10-only, and their
lookups keep resolving to 0 as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…C4 +5.6%, C8 +4.7%)

Now that the fused-rows GDN kernel exists on strix-hip, turn the small-
kernel batching on wherever the exact lane already is (MAX_BATCH > 1).
Framework f160 (main-298 vs this branch, AR, x2): C4 34.0 -> 35.9,
C8 38.2 -> 40.0 tok/s, C1 12.8 = 12.8. Solo text identical 8/8,
solo-vs-C8 identity 5/8 on both, 0 faults. Explicit values win.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@AzeezIsh
AzeezIsh merged commit de0ac8e into main Oct 31, 2026
24 of 25 checks passed
@AzeezIsh

Copy link
Copy Markdown
Contributor Author

Follow-up, framework f161 (MAX_BATCH 1 recipe, FP8 GDN on, ×2): DECODE_FUSE=1 MASK=1 AR C1 15.2 → 15.65 (+3%), solo text 8/8; MTP (1 draft) 24.1 → 23.65 (−1.8%), solo text 7/8. So the fused single-token step is not output-preserving once MTP is on (inference: the verify path takes the gb10-only verify kernels' per-token fallback, which this fused step doesn't match). Leaving DECODE_FUSE off by default on hip.

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