Repository navigation
[HIP] [JIT] Reland gfx950 prefill FP8 MQA logits with gfx950 arch guard - #8507
Conversation
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.
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: Reviews: |
WAITING ON AUTHORPR Self-ReviewRevision 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
Edit the Missing or invalid answers
Shadow mode reports what would block but keeps the status successful. Set |
…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]>
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]>
…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]>
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]>
…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]>
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]>
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_f8f6f4v_permlane32_swap_b32(inline asm)So any build with
GPU_ARCHS="gfx942;gfx950"failed while compiling the gfx942 device code: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.yamlprebuilds onlygfx950on pull requests unless theci:mi300xlabel is set. The #7183 PR run logged[SKIP] 1218 jobs for gfx942. This PR carriesci:mi300xso the gfx942 compile runs here.Changes
fp8_mqa_logitsfiles are byte-identical toa027406b.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 asiq2r_gemm_gfx950.cu.swap32_reduce2is 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 clearRuntimeErroron 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:hipcc --offload-arch=gfx942fails with the error above.hipcc --offload-arch=gfx942 --offload-arch=gfx950succeeds (host + both device passes).--cuda-device-only -Soutput for gfx950 is identical before and after the guard. The only differing symbol is__hip_cuid_*, a hash of the source text.GPU_ARCHS="gfx942;gfx950":build.ninjacarries both--offload-arch. Thenpython3 op_tests/test_fp8_mqa_logits.py --num-heads 32 --head-dim 128on MI355X ran all 150 cases, with exit 0 and err 0.RuntimeErrorpath applies.