[TRITON] Add Positional Encoding (PE) support to Triton MHA kernels#1203
Merged
[TRITON] Add Positional Encoding (PE) support to Triton MHA kernels#1203
Conversation
The tests are working fine with an older Triton compiler (from Aug-13, commit a9d79a6f3be95ddfa1ac4097470477eb3c71a151).
…nels Targeting only `mha_onekernel_bwd` implementation for now.
WARNING: Not tested!
* fix `do` shape in test * fix unbound local variable in kernel
Please uncomment `@pytest.mark.skip` to run PE tests.
It seems `@triton.jit`ed functions can't return `None`.
BLOCK_M2 128 => 32 num_warps 4 => 8 num_stages 1 => 3
This reverts commit 68d8e6f23c2ee902d711271ac2d51990955d78e5.
Triton compiler from training container: triton-lang/triton@711e2a9
This reverts commit 67cc3cac81caea66ee7bab4ce1a445ac9f25dc29.
* bwd PE support only for power of 2 heads * remove fp8 support from bwd PE * add non-causal support to bwd PE * enable dropout in test
* can tune for MI300X too * correct bf16 data type * run unit test just for target shape
remove hardcoded shape and hardcoded fused bwd kernel
* add help on -d and -dv options * fix TFLOPS computation * fix GB/s computation
vgokhale
approved these changes
Oct 16, 2025
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.
This PR replicates the PR to the main for the WIP branch to be used in vllm
Reference PR for more information: #1184