Repository navigation
[FlyDSL][GDN] gfx942 fused decode, MTP verify and prefill front end for Qwen3.8 - #11
Merged
apinge merged 6 commits intoNov 20, 2026
Merged
Conversation
- fused_qkvzba_conv1d_gated_delta_rule_decode_flydsl: one launch per GDN decode layer, starting from the in_proj outputs: qkvz/ba unpack + width-4 causal conv update + gating + q/k l2norm + gated delta recurrence. Writes o [B, 1, HV, V] plus a contiguous z, or applies the gated RMSNorm itself. State loads are issued first and use nt load/store; K reductions use DPP; the q/k conv state shared by HV/HK workgroups is written back by the last reader (self-resetting arrival counter, CUDA-graph safe). - fused_recurrent_gated_delta_rule_packed_decode_flydsl: the recurrence alone, drop-in for the Triton fused_recurrent_gated_delta_rule_packed_decode. - flydsl_gdn_prefill_front: varlen causal conv + SiLU + q/k/v split + q/k l2norm read straight from the in_proj output (replaces cat + conv + split + 2x l2norm); bf16 product rounding matches the Triton kernels. - op_tests/test_flydsl_gdn_decode_prefill.py: torch reference + perf table.
…s (BK=64, BV=128) The generic list caps BK/BV at 64 on 64 KB-LDS parts, which splits V and recomputes q.k^T per V tile. On MI308X the Qwen3.8 GDN prefill shapes run 30-35% faster with BV=128, BK=64, 4 warps, 1 stage (bit-identical output).
The decode kernels read bf16 activations, fp32 A_log and bf16/fp32 dt_bias; assert this (and HV % H == 0) instead of silently misreading other dtypes. Create the decode arrival counter outside CUDA graph capture only, sized for 64K (token, k-head) pairs.
- chunk_fwd_kernel_o_opt_vk: keep the generic autotune list and only add the full-V (BK=64, BV=128, 1 stage) config on 64 KB-LDS GPUs; autotune picks it on MI308X (same 421 / 207 us at TP2 / TP4). - decode kernel: drop the unused in-kernel gated RMSNorm and the fixed knobs (num_warps, state dtype, waves_per_eu). The generated code of both entry points is unchanged apart from kernarg offsets. - op_test: cover the packed (Triton drop-in) entry point instead of the removed norm mode.
yicyang
marked this pull request as ready for review
November 18, 2026 07:39
Uses arch_info.get_arch(); other GPUs keep the original config list.
fused_qkvzba_conv1d_gated_delta_rule_verify_flydsl replaces sglang's verify chain (qkvz/ba unpack + causal_conv1d_update + fused_sigmoid_gating_delta_rule_update) with one kernel: T draft tokens per request, per-step intermediate SSM states and conv windows, conv state shifted in place, SSM state read only.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
gfx942 kernels for the Qwen3.8-Flash-Next GDN (linear attention) layers, used by the companion sglang PR (apinge/sglang, qwen4_v0.5.21).
Used through the sglang flags
--linear-attn-decode-backend aiter,--linear-attn-verify-backend aiterand--linear-attn-prefill-backend aiter. Thechunk_oconfig is added on gfx942 only; other GPUs keep the original autotune list.End to end, MI308X: QPS +8.0% / +7.6% at TP2 and +6.6% / +6.9% at TP4 (c8 / c12), MTP off; +5.3% / +5.2% at TP2 with MTP on. gsm8k unchanged.
Decode
causal_conv1d_update+ Tritonfused_recurrent_gated_delta_rule_packed_decodefused_qkvzba_conv1d_gated_delta_rule_decode_flydsl, 1 kernelcausal_conv1d_update+ Tritonfused_sigmoid_gating_delta_rule_updatefused_qkvzba_conv1d_gated_delta_rule_verify_flydsl, 1 kernelfused_recurrent_gated_delta_rule_packed_decodefused_recurrent_gated_delta_rule_packed_decode_flydsl, same argumentsPrefill
causal_conv1d_fwd+ Triton qkv split + Tritonl2norm_fwdx2flydsl_gdn_prefill_front, 1 kernelchunk_fwd_kernel_o_opt_vk, autotune capped at BK/BV=64 on gfx942Numerics follow the Triton kernels they replace:
chunk_fwd_ois bit-identical;Test:
python op_tests/test_flydsl_gdn_decode_prefill.py, all pass.