Skip to content

fix(mla): bypass fp8 qseqlen2 kernel precision issue on gfx950 - #3013

Closed
fangche123 wants to merge 2 commits into
mainfrom
chefang_mla_nhead16
Closed

fangche123 wants to merge 2 commits into
mainfrom
chefang_mla_nhead16

Conversation

@fangche123

@fangche123 fangche123 commented May 3, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

The mla_a8w8_qh16_qseqlen2_gqaratio16_ps kernel has a precision bug on gfx950 where decode error grows with batch size (max abs delta reaches 0.22 at bs=128).
Workaround: on gfx950, route fp8 decode_qlen=2 to the qseqlen4 kernel (padding 2→4) which has correct precision and equivalent performance. Other architectures (gfx942) are unaffected.

Technical Details

Test Plan

Test Result

image image

Submission Checklist

@fangche123
fangche123 requested review from a team and Copilot May 3, 2026 16:20
@github-actions

github-actions Bot commented May 3, 2026

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

  • ✅ Pre-checks (submodule verification, code formatting)
  • ✅ Aiter op tests (gfx942 + gfx950)
  • ✅ Triton tests on MI35X (only when aiter/ops/triton/** or related paths are changed)

Extended tests (opt-in via labels):

Label Tests
ci:triton-300x Run an additional Triton test job on MI300X in PRs; main branch always runs both MI35X and MI300X
ci:sglang SGLang integration tests
ci:atom ATOM benchmark (DeepSeek-R1 + GPT-OSS)
ci:vllm vLLM benchmark
ci:all All of the above

Add labels via the sidebar or gh pr edit 3013 --add-label <label>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts the MLA ASM decode kernel dispatch on gfx950 to avoid a known FP8 precision issue for max_seqlen_q == 2 by selecting the qseqlen=4 specialization instead of the qseqlen=2 specialization. It is a targeted architecture-specific workaround in the low-level MLA decode path.

Changes:

  • Update FP8 decode kernel selection for gqa_ratio == 16 so gfx950 no longer dispatches the qseqlen=2 kernel.
  • Fall back to the existing qseqlen=4 dispatch path on gfx950 for max_seqlen_q == 2.
  • Leave behavior unchanged for other architectures, including gfx942.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants