Skip to content

[ASM] Fix gfx950 GQA16 MTP softmax initialization - #6606

Merged
zufayu merged 2 commits into
mainfrom
chefang/gfx950-pa-mtp-init-co
Oct 21, 2026
Merged

zufayu merged 2 commits into
mainfrom
chefang/gfx950-pa-mtp-init-co

Conversation

@fangche123

@fangche123 fangche123 commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Update eight gfx950 GQA16 MTP code objects for BF16/FP16 queries, per-token FP8/INT8 KV, and mask=0/1.

Initialize the missing running-max state for qlen=3 and qlen=4, matching poc_kl_merg source fix f271c7f3ff322ae4d47110b731b8e6db93a3ff52. Preserve kernel metadata and resource settings.

Validation on gfx950:

  • 16/16 independent-process first-call and repeat checks passed.
  • 2,592 paired cases: current 2,488 passed vs baseline 2,327; 161 newly passing cases and zero newly failing cases.
  • Current binaries produced no NaN/Inf or unstable cases, compared with 16 nonfinite and 171 unstable baseline cases.
  • 104 existing FP8 precision-threshold failures remain in both versions; this is not full precision certification.

The separate mixed-batch qlen=1 issue is outside this change.

Motivation

Fix NaNs and unstable outputs caused by uninitialized running-max state
in GQA16 MTP kernels for query lengths 3 and 4.

Update the gfx950 code objects to include the SP3 initialization fix.

Technical Details

  • Initialize _v_FA_Max[2] for qlen=3.
  • Initialize _v_FA_Max[2] and _v_FA_Max[3] for qlen=4.
  • Update eight gfx950 COs covering BF16/FP16 queries,
    per-token FP8/INT8 KV, and mask=0/1.
  • Preserve kernel ABI, AMDGPU metadata, and resource settings.

Test Plan

  • Explicitly load each updated CO on gfx950.
  • Test qlen=3/4 in independent processes without target-kernel warmup.
  • Check repeated calls for finite and bitwise-stable outputs.
  • Compare old and updated COs across qlen=2/3/4,
    selected KV lengths from 4 to 513, and multiple batch/head configurations.
  • Use uniform inputs with two seeds and normal-distribution stress inputs.
  • Compare against dequantized FP32 attention using atol=rtol=0.01,
    allowing at most 5% mismatched elements.

Test Result

Independent-process checks: 16/16 passed.

Metric Baseline Updated
Paired cases passed 2327/2592 2488/2592
Cases with NaN/Inf 16 0
Cases with unstable repeated outputs 171 0
  • 161 newly passing cases; zero newly failing cases.
  • All tested INT8 configurations passed.
  • 104 existing FP8 precision-threshold failures remain in both versions.
    These are finite and stable with the updated COs.
  • qlen=1/mixed-qlen batches and performance are outside this validation.

Submission Checklist

Update eight gfx950 GQA16 MTP code objects for BF16/FP16 queries, per-token FP8/INT8 KV, and mask=0/1.

Initialize the missing running-max state for qlen=3 and qlen=4, matching poc_kl_merg source fix f271c7f3ff322ae4d47110b731b8e6db93a3ff52. Preserve kernel metadata and resource settings.

Validation on gfx950:
- 16/16 independent-process first-call and repeat checks passed.
- 2,592 paired cases: current 2,488 passed vs baseline 2,327; 161 newly passing cases and zero newly failing cases.
- Current binaries produced no NaN/Inf or unstable cases, compared with 16 nonfinite and 171 unstable baseline cases.
- 104 existing FP8 precision-threshold failures remain in both versions; this is not full precision certification.

The separate mixed-batch qlen=1 issue is outside this change.
@fangche123
fangche123 requested review from a team and a balanced review from Copilot October 16, 2026 03:14

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.

Copilot wasn't able to review any files in this pull request. Check if the Files changed in this pull request are included in default exclusions.

@github-actions

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:gfx1250-ffm-triton Run the five-shard gfx1250 FFM Triton test suite
ci:triton-300x Run an additional Triton test job on MI300X in PRs (added automatically when gfx942 configs change); main branch always runs both MI35X and MI300X
ci:triton-355 Run the full Triton test suite on MI35X, not only the tests the change affects
ci:windows Windows JIT op smoke test on the gfx1201 ROCm runner
ci:multi-gpu Aiter multi-GPU tests on the 8-GPU runner
ci:sglang SGLang integration tests: DeepSeek-R1-MXFP4 accuracy, Qwen 3.5 accuracy
ci:atom ATOM benchmark: DeepSeek-R1-0528, GPT-OSS-120B
ci:atom_full ATOM accuracy suite for PR and main models from ATOM models_accuracy.json
ci:vllm vLLM benchmark: DeepSeek-V4-Pro, MiniMax-M3-MXFP4
ci:all All standard extended tests (excludes ci:atom_full)

Only add ci:atom_full for FlyDSL or Triton upgrades.
Add labels via the sidebar or gh pr edit 6606 --add-label <label>

One backend per PR:
A PR changes one kernel backend: [Triton/Gluon] (Triton and Gluon count as one), [HIP], [ASM], [CK], [OPUS] or [FlyDSL]. If the title ends up with two backend tags, split the PR -- as stacked pull requests when one part cannot merge without the other.

PR title tags & labels:
Component tags ([Triton/Gluon], [HIP], [CK], [ASM], ...) are added to the PR title and as PR labels automatically from the changed files and re-synced on every push — change-type tags like [fix]/[Perf], op tags like [MLA], and human labels (ci:*) are left untouched. Add the no-auto-title label to stop the title rewrites; labels stay in sync either way.

@github-actions github-actions Bot added the ASM label Oct 16, 2026
Update the four BF16/FP16 and per-token FP8/INT8 mask1 code objects to initialize causal-mask state for qlen=1 rows in mixed-qlen batches. Mask0 binaries are unchanged.

Validation on gfx950: 1,632 paired cases improved from 1,432 to 1,576 passes, with 144 newly passing cases and zero new failures. Nonfinite cases decreased from 152 to zero; fixed outputs were repeat-stable. All 8 public API scenarios passed and 1,224 unaffected controls remained bitwise identical.

The 56 remaining FP8 precision-threshold failures also fail before this fix. AMDGPU metadata is unchanged. Only the four validated gfx950 mask1 COs are included.
Copilot AI balanced review requested due to automatic review settings October 16, 2026 06:24

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.

Copilot wasn't able to review any files in this pull request. Check if the Files changed in this pull request are included in default exclusions.

@zufayu
zufayu merged commit 2f24aad into main Oct 21, 2026
@zufayu
zufayu deleted the chefang/gfx950-pa-mtp-init-co branch October 21, 2026 02:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants