Add HIP MLA reduce kernel dispatch logic#1018
Open
ftyghome wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds an opt-in ROCm/HIP MLA decode reduction path controlled by a new environment flag, falling back to the existing mla_decode_fwd implementation when not applicable.
Changes:
- Introduces
ATOM_ENABLE_HIP_MLA_REDUCEenv toggle (default enabled). - Adds a new decode fast-path using
mla_reduce_decodeunder ROCm/fp4bmm + head-count constraints. - Retains the existing
mla_decode_fwdpath as a fallback.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| atom/utils/envs.py | Adds an environment flag to control enabling the HIP MLA reduce decode path. |
| atom/model_ops/attention_mla.py | Imports and conditionally uses mla_reduce_decode to accelerate decode on supported ROCm configurations. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| batched_gemm_a8w8_a_per_token_group_prequant_w_per_batched_tensor_quant as _aiter_triton_fp8_bmm, | ||
| ) | ||
|
|
||
| from aiter.mla_v_up_proj import mla_reduce_decode |
Comment on lines
+827
to
+830
| reduced = mla_reduce_decode( | ||
| q, | ||
| kv_buffer, | ||
| o, |
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.
Add HIP MLA reduce kernel dispatch logic. Rely on ROCm/aiter#3468.
Performance Result
(stock
kn_mla_reduce_v1_ps) to 6176 ns (ours), ~1.3×.mla_reduce_v1~4.7 µs →ours (adaptive) ~2.5 µs, ~1.9×. Correctness checked bit-faithful against a
torch reference (atol/rtol 2e-2).