Add fused GatedDeltaNet decode Triton kernel#18865
Open
Gasoonjia wants to merge 9 commits intogasoonjia/flashdecoding-pp-async-softmaxfrom
Open
Add fused GatedDeltaNet decode Triton kernel#18865Gasoonjia wants to merge 9 commits intogasoonjia/flashdecoding-pp-async-softmaxfrom
Gasoonjia wants to merge 9 commits intogasoonjia/flashdecoding-pp-async-softmaxfrom
Conversation
Fuse Q/K/V split, L2 normalization, head repeat, gating computation, and delta-rule recurrent state update into a single Triton kernel for decode (T=1). Replaces ~6 small AOTI-generated kernels with one, reducing GatedDeltaNet kernel time by ~62% and improving end-to-end decode throughput by ~2% (106 -> 108.5 tok/s on A100).
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/18865
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ❌ 6 New Failures, 1 Cancelled Job, 1 Unrelated FailureAs of commit f380b22 with merge base c48ea12 ( NEW FAILURES - The following jobs have failed:
CANCELLED JOB - The following job was cancelled. Please retry:
FLAKY - The following job failed but was likely due to flakiness present on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
digantdesai
reviewed
Apr 21, 2026
|
|
||
|
|
||
| # bf16 kernel vs fp32 reference tolerance. | ||
| MAX_ABS_TOL = 0.05 |
digantdesai
reviewed
Apr 21, 2026
| o_base = O_ptr + bid * stride_ob + h * stride_oh | ||
|
|
||
| # ====== Main computation ====== | ||
| if BLOCK_K >= K: |
Contributor
There was a problem hiding this comment.
Does this get traced through?
Contributor
Author
There was a problem hiding this comment.
Yes. It will be traced through in triton kernel autotune
K is 128 in Qwen 3.5 MoE case; while BLOCK_K can be autotuned in [64, 128].
digantdesai
reviewed
Apr 21, 2026
| # Qwen3.5 MoE dimensions (used across tests) | ||
| NUM_K_HEADS = 16 | ||
| NUM_V_HEADS = 32 | ||
| HEAD_K_DIM = 128 |
Contributor
There was a problem hiding this comment.
try with a smaller K to exercise the other branch
digantdesai
approved these changes
Apr 21, 2026
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.
Fuse Q/K/V split, L2 normalization, head repeat, gating computation, and delta-rule recurrent state update into a single Triton kernel for decode (T=1). Replaces ~6 small AOTI-generated kernels with one, reducing GatedDeltaNet kernel time by ~62%.