Skip to content

[HIP] [JIT] Reland gfx950 prefill FP8 MQA logits with gfx950 arch guard - #8507

Merged
zufayu merged 2 commits into
mainfrom
fix/fp8-mqa-logits-gfx950-guard
Nov 24, 2026
Merged

zufayu merged 2 commits into
mainfrom
fix/fp8-mqa-logits-gfx950-guard

Conversation

@amd-ruitang3

Copy link
Copy Markdown
Contributor

Re-lands #7183 (reverted in #8504) with the multi-arch build fix.

cc @sumin-hong (author of #7183): your kernel is restored unchanged. The only addition is an arch guard, explained below. Thanks to @zufayu for reporting the breakage.

What happened

#7183 merged with no arch guard on the kernel. The kernel body uses gfx950-only instructions:

  • __builtin_amdgcn_mfma_scale_f32_32x32x64_f8f6f4
  • v_permlane32_swap_b32 (inline asm)

So any build with GPU_ARCHS="gfx942;gfx950" failed while compiling the gfx942 device code:

csrc/kernels/fp8_mqa_logits.cu:271:13: error: '__builtin_amdgcn_mfma_scale_f32_32x32x64_f8f6f4' needs target feature gfx950-insts

This broke downstream dual-arch builds, and it also broke the post-merge Aiter Test prebuild on main (run 45126852469).

PR CI didn't catch it because aiter-test.yaml prebuilds only gfx950 on pull requests unless the ci:mi300x label is set. The #7183 PR run logged [SKIP] 1218 jobs for gfx942. This PR carries ci:mi300x so the gfx942 compile runs here.

Changes

  • Commit 1: reapplies [HIP] [JIT] Add gfx950 prefill FP8 MQA logits #7183 as-is (reverts [HIP] [JIT] Revert " Add gfx950 prefill FP8 MQA logits" #8504). The fp8_mqa_logits files are byte-identical to a027406b.
  • Commit 2: the fix.
    • csrc/kernels/fp8_mqa_logits.cu: the kernel body is compiled only under #if defined(__gfx950__), with __builtin_trap() otherwise. This is the same pattern as iq2r_gemm_gfx950.cu. swap32_reduce2 is a template and is no longer instantiated for other archs, so its asm needs no separate guard.
    • aiter/ops/fp8_mqa_logits.py: fp8_mqa_logits() raises a clear RuntimeError on non-gfx950 devices instead of launching the trap stub. is_supported() is unchanged.

Validation

Run in rocm/atom-dev:latest (ROCm 7.2) on MI355X:

  • Repro before the fix: hipcc --offload-arch=gfx942 fails with the error above.
  • After the fix: hipcc --offload-arch=gfx942 --offload-arch=gfx950 succeeds (host + both device passes).
  • gfx950 code unchanged: --cuda-device-only -S output for gfx950 is identical before and after the guard. The only differing symbol is __hip_cuid_*, a hash of the source text.
  • JIT build with GPU_ARCHS="gfx942;gfx950": build.ninja carries both --offload-arch. Then python3 op_tests/test_fp8_mqa_logits.py --num-heads 32 --head-dim 128 on MI355X ran all 150 cases, with exit 0 and err 0.
  • Not run on a gfx942 GPU. There, only the Python-side RuntimeError path applies.

This reverts commit cf16a55 (#8504),
restoring the operator from #7183 by @sumin-hong unchanged. The build fix
follows in the next commit.
The kernel uses __builtin_amdgcn_mfma_scale_f32_32x32x64_f8f6f4 and
v_permlane32_swap_b32, which exist only on gfx950, so building with
GPU_ARCHS="gfx942;gfx950" failed with "needs target feature gfx950-insts".

Compile the kernel body only for __gfx950__ and trap elsewhere, as the
other gfx950-only kernels do. fp8_mqa_logits() now raises on other archs
instead of launching the stub.
@amd-ruitang3
amd-ruitang3 requested a review from a team November 23, 2026 14:35
@amd-ruitang3 amd-ruitang3 added ci:mi300x Run MI300X standard and OPUS CI on PRs HIP JIT labels Nov 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

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

Extended tests (opt-in via labels):

Label Tests
ci:mi300x Run Aiter standard tests on MI300X in PRs; main branch always runs them
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 Radeon R9700 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 8507 --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.

Reviews:
A reviewer is usually assigned within one working day after the PR is ready for review (see Code Review Process). If nobody has responded for about a week, mention the area contact listed in CONTACTS.md. Want to help review? See REVIEWERS.md.

@aiter-bot

Copy link
Copy Markdown

WAITING ON AUTHOR

PR Self-Review

Revision 86eea3b9c867 · mode shadow

Waiting for the PR author. The readiness report will appear after the self-review answers are complete for this revision.

Questions to answer in the PR description

  1. What behavior does this PR change, and why is the existing behavior insufficient?
  2. What did you validate, and what remains unverified? Include commands, hardware/configuration and results.
  3. Which architecture, dtype and shape boundaries select the changed kernel path, and what invariant prevents unsupported inputs from reaching it?
  4. For every changed op_tests/ file, what behavior does it cover and why is it not redundant? Write None if no op test changed.

Edit the PR Self-Review section in the PR description. Include the current revision SHA; this comment refreshes automatically.

Missing or invalid answers

  • FAIL — missing ### Reviewed revision in the PR description
  • FAIL — missing ### Behavior and intent in the PR description
  • FAIL — missing ### Validation and unverified scope in the PR description
  • FAIL — missing ### PR-specific question in the PR description
  • FAIL — missing ### Changed op tests in the PR description
  • FAIL — Reviewed revision must contain at least the first 7 characters of the current head SHA
  • FAIL — Behavior and intent has no substantive answer
  • FAIL — Validation and unverified scope has no substantive answer
  • FAIL — PR-specific question has no substantive answer
  • FAIL — changed op test not explained in Changed op tests: op_tests/test_fp8_mqa_logits.py
  • FAIL — Changed op tests must explain why each changed op test is necessary and non-redundant

Shadow mode reports what would block but keeps the status successful. Set AITER_PR_SELF_REVIEW_MODE=enforce only after reviewing real false positives.

@zufayu
zufayu merged commit 1fda02b into main Nov 24, 2026
169 of 180 checks passed
@zufayu
zufayu deleted the fix/fp8-mqa-logits-gfx950-guard branch November 24, 2026 03:20
minhpham-duc added a commit to moreh-dev/rocm-aiter that referenced this pull request Nov 24, 2026
…ilds

The kernel uses __builtin_amdgcn_mfma_scale_f32_32x32x64_f8f6f4,
v_permlane32_swap_b32 and 16-byte buffer-to-LDS loads, which exist only
on gfx950, so building with GPU_ARCHS="gfx942;gfx950" failed with
"needs target feature gfx950-insts".

Compile the kernel body (and swap32_hi) only for __gfx950__ and trap
elsewhere, as ROCm#8507 does for fp8_mqa_logits. fp8_paged_mqa_logits() now
raises on other archs instead of launching the stub.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
minhpham-duc added a commit to moreh-dev/rocm-aiter that referenced this pull request Nov 25, 2026
scan_kernel and the exact-fallback recompute (recompute_wes, used by
fb_compute and fallback_kernel) use
__builtin_amdgcn_mfma_scale_f32_32x32x64_f8f6f4 and v_permlane32_swap_b32,
which exist only on gfx950, so building with GPU_ARCHS="gfx942;gfx950"
failed with "needs target feature gfx950-insts".

Compile those kernel bodies (and recompute_wes) only for __gfx950__ and
trap elsewhere, as ROCm#8507 does for fp8_mqa_logits; the other kernels are
portable and unchanged. fp8_mqa_topk() now raises on other archs instead
of launching the stubs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
minhpham-duc added a commit to moreh-dev/rocm-aiter that referenced this pull request Nov 25, 2026
…ilds

The kernel uses __builtin_amdgcn_mfma_scale_f32_32x32x64_f8f6f4,
v_permlane32_swap_b32 and 16-byte buffer-to-LDS loads, which exist only
on gfx950, so building with GPU_ARCHS="gfx942;gfx950" failed with
"needs target feature gfx950-insts".

Compile the kernel body (and swap32_hi) only for __gfx950__ and trap
elsewhere, as ROCm#8507 does for fp8_mqa_logits. fp8_paged_mqa_logits() now
raises on other archs instead of launching the stub.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
minhpham-duc added a commit to moreh-dev/rocm-aiter that referenced this pull request Nov 25, 2026
scan_kernel and the exact-fallback recompute (recompute_wes, used by
fb_compute and fallback_kernel) use
__builtin_amdgcn_mfma_scale_f32_32x32x64_f8f6f4 and v_permlane32_swap_b32,
which exist only on gfx950, so building with GPU_ARCHS="gfx942;gfx950"
failed with "needs target feature gfx950-insts".

Compile those kernel bodies (and recompute_wes) only for __gfx950__ and
trap elsewhere, as ROCm#8507 does for fp8_mqa_logits; the other kernels are
portable and unchanged. fp8_mqa_topk() now raises on other archs instead
of launching the stubs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
minhpham-duc added a commit to moreh-dev/rocm-aiter that referenced this pull request Nov 27, 2026
…ilds

The kernel uses __builtin_amdgcn_mfma_scale_f32_32x32x64_f8f6f4,
v_permlane32_swap_b32 and 16-byte buffer-to-LDS loads, which exist only
on gfx950, so building with GPU_ARCHS="gfx942;gfx950" failed with
"needs target feature gfx950-insts".

Compile the kernel body (and swap32_hi) only for __gfx950__ and trap
elsewhere, as ROCm#8507 does for fp8_mqa_logits. fp8_paged_mqa_logits() now
raises on other archs instead of launching the stub.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
minhpham-duc added a commit to moreh-dev/rocm-aiter that referenced this pull request Nov 27, 2026
scan_kernel and the exact-fallback recompute (recompute_wes, used by
fb_compute and fallback_kernel) use
__builtin_amdgcn_mfma_scale_f32_32x32x64_f8f6f4 and v_permlane32_swap_b32,
which exist only on gfx950, so building with GPU_ARCHS="gfx942;gfx950"
failed with "needs target feature gfx950-insts".

Compile those kernel bodies (and recompute_wes) only for __gfx950__ and
trap elsewhere, as ROCm#8507 does for fp8_mqa_logits; the other kernels are
portable and unchanged. fp8_mqa_topk() now raises on other archs instead
of launching the stubs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:mi300x Run MI300X standard and OPUS CI on PRs HIP JIT

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants