Repository navigation
MI350 MLA ps mode BF16 case support mask0 - #4565
Merged
Merged
Conversation
Contributor
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR wires a new causal control through the MLA decode path to enable selecting mask0 (non-causal) variants—primarily for gfx950 persistent BF16—and updates kernel metadata CSVs and test harnesses accordingly.
Changes:
- Add a
causalkwarg toaiter.mla.mla_decode_fwdand forward it into the asm stage1 launcher / kernel heuristic selection. - Update gfx942/gfx950 MLA asm kernel registries (
mla_asm.csv) to reflectcausalrouting and add gfx950 BF16 persistent mask0 entries. - Plumb
causalthrough existing test drivers (and add a CLI toggle in the persistent test script).
Reviewed changes
Copilot reviewed 8 out of 16 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| op_tests/test_mla.py | Passes causal into mla_decode_fwd calls so decode tests can control masking behavior. |
| op_tests/test_mla_persistent.py | Threads a new causal parameter through the persistent test pipeline and adds --causal/--no-causal CLI support. |
| hsa/gfx950/mla/mla_asm.csv | Updates decode entries to causal=1 and adds BF16 persistent mask0 (non-causal) kernel rows for gfx950. |
| hsa/gfx942/mla/mla_asm.csv | Updates decode entries’ causal field to align with new dispatch expectations. |
| csrc/py_itfs_cu/asm_mla.cu | Extends the C ABI for stage1 decode with a causal parameter and uses it in kernel selection. |
| csrc/kernels/mla/metadata/v1_2_device.cuh | Makes batch_tail adjustment conditional on params.is_causal to support non-causal behavior. |
| aiter/ops/attention.py | Updates the @compile_ops signature for mla_decode_stage1_asm_fwd to include causal. |
| aiter/mla.py | Adds causal to mla_decode_fwd and forwards it into stage1 asm decode calls. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ZhangLirong-amd
approved these changes
Aug 10, 2026
4 tasks done
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.
Motivation
This PR wires a new causal control through the MLA decode path to enable selecting mask0 (non-causal) variants—primarily for gfx950 persistent BF16—and updates kernel metadata CSVs and test harnesses accordingly.
Technical Details
Add a causal kwarg to aiter.mla.mla_decode_fwd and forward it into the asm stage1 launcher / kernel heuristic selection.
Update gfx942/gfx950 MLA asm kernel registries (mla_asm.csv) to reflect causal routing and add gfx950 BF16 persistent mask0 entries.
Plumb causal through existing test drivers (and add a CLI toggle in the persistent test script).
Test Plan
python3 op_tests/test_mla_persistent.py -d bf16 -kvd bf16 -lse -n 16-128,1-4 --no-causal -b 1 16 128 -c 23 512 8192
python3 op_tests/test_mla_persistent.py -d bf16 -kvd bf16 -lse -n 16-128,1-4 -b 1 16 128 -c 23 512 8192
Test Result
dtype = fp8, mode = nocausal
Submission Checklist