Repository navigation
[Bugfix][ROCm] Use a zero default for masked scales in the MXFP8 GEMM - #59454
Merged
Merged
Conversation
…k32 GEMM Signed-off-by: Mehmet Cagri Kaymak <mehmet.kaymak@amd.com>
cagrikymk
requested review from
dllehr-amd,
shen-shanshan and
tjtanaa
as code owners
September 30, 2026 15:13
|
✅ @cagrikymk, CI is now available for this PR.
|
Fangzhou-Ai
approved these changes
Sep 30, 2026
Contributor
Author
|
/ci run |
|
✅ Triggered Buildkite CI #92235 for commit |
Contributor
Author
|
/ci retry |
|
✅ Triggered Buildkite CI #92281 for commit |
Fangzhou-Ai
approved these changes
Oct 1, 2026
michael-gpu
pushed a commit
to practical-inference/vllm-ampere-extended
that referenced
this pull request
Oct 20, 2026
…vllm-project#59454) Signed-off-by: Mehmet Cagri Kaymak <mehmet.kaymak@amd.com>
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.
Purpose
This fix changes masked scale data from 127 (value 1.0 for e8m0) to 0 (value 2^(-127). This change is benign in terms of accuracy as the main value side already loads corresponding lanes for mfma as 0. So, scales get multiplied by 0 and has no accuracy effect.
When other=127, triton 3.8.0+gitc0a142ff leads to reading stale LDS data for the lanes corresponding to the masked scales due to a compiler bug. This bug is fixed on upstream triton but this fix resolves stale data reading issue for both compiler versions.
With other=127 and triton 3.8.0+gitc0a142ff, if LDS addresses corresponding to the masked lanes have "NaN", this leads to the result and produce inaccurate results. This is a rare case but it can still happen in practice. Reproduction relies on what LDS contains from previous runs.
This is a cleaner solution as hardware can already handle writing 0s to the masked lanes almost for free compared to writing any other value.
As a side effect, it also reduces total instruction count:
Main is upstream triton/main.
3.8.0 is triton 3.8.0+gitc0a142ff.
Instruction counts that differ between the builds (whole kernel)
s_mov_b32s_xor_b64s_and_saveexec_b64s_or_b64s_andn2_saveexec_b64ds_write_b32v_mov_b32_e32s_cbranch_execzv_cndmask_b32_e64s_waitcntv_lshlrev_b16_e32v_or_b32_sdwav_perm_b32s_cbranch_execnzs_movk_i32v_bfrev_b32_e32v_lshl_or_b32v_or_b32_e32s_barriers_load_dwords_nops_or_saveexec_b64v_add_u32_e32v_cmp_lt_i32_e64v_cndmask_b32_e32s_ashr_i32s_bfe_i32s_branchs_load_dwordx2s_lshl_b32v_add3_u32v_and_or_b32v_ashrrev_i32_e32v_cmp_eq_u32_e64v_cmp_le_i32_e64v_lshl_add_u32v_lshrrev_b32_e32v_mad_u64_u32v_mul_lo_u32v_or3_b32Performance is unchanged for triton 3.8.0+gitc0a142ff.
Performance: DeepSeek-V4.1-Flash shapes
aiter
gemm_afp8wfp8(v0.1.24, shipped configs, Triton 3.8.0) on one MI355X. Time per call in us, from HIP-graph replay with weights cold in cache, median of 5-7 replays. Each cell: without fix / withother=0;*marks a point that returns NaN without the fix after the 0xFF LDS fill.Test Plan
Existing tests pass for test_rocm_mxfp8_linear.py
Test Result
Tests pass.
No similar PR exists as of writing this.
Claude is used to collect benchmarks and assembly analysis.