Repository navigation
Conversation
…nches by the device wave size On ROCm, WARP_SIZE is the wave size of the code object being compiled: 32 in the device pass for gfx1250/gfx1201, but always 64 in the host pass. The MoE TopK softmax/sigmoid launchers derived VPT, the template instantiation and block_dim from it, so on wave32 targets they launched the wave64 configuration of a wave32 kernel (abort / launch failure on gfx1201). kvcacheio transfer sized its blocks the same way. - utils.h: sgl_launch_warp_size(), SGL_DISPATCH_WARP_SIZE and sgl_wave_matches_target<WAVE>. - TopK softmax/sigmoid: template kernels on the wave size and dispatch on the device wave size; the non-matching instantiation is a trap stub, so gfx942/gfx950 device code is unchanged. - kvcacheio: use the device wave size for threads_per_block on ROCm. - setup_rocm.py: add gfx1201. - docs: Radeon RDNA4 / gfx1201 section in amd_gpu.mdx.
Shan2L
requested review from
BBuf,
FlamingoPg,
HaiShaw,
JustinTong0323,
ispobock,
merrymercy,
sogalin,
wisclmy0611,
yizhang2077 and
zijiexia
as code owners
October 11, 2026 11:31
This was referenced Oct 11, 2026
Draft
This was referenced Oct 11, 2026
This branch has not been deployed
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.
Motivation
sgl-kernelcannot be built for Radeon RDNA4 GPUs (gfx1201: Radeon AI PRO R9700 / R9600D, RX 9070 series): the target is not in thesetup_rocm.pyallowlist. Adding it to the list is not enough. The MoE TopK routing kernels then fail at launch:test_moe_topk_softmax.pyFatal Python error: Aborted(core dump)test_moe_topk_sigmoid.pytorch.AcceleratorError: HIP error: unspecified launch failureRoot cause: on ROCm,
WARP_SIZEis the wave size of the code object being compiled. It is 32 in the device pass for gfx1250 / gfx1201, but it is always 64 in the host pass. The TopK host launchers derive the per-thread work (VPT), the template instantiation, andblock_dimfromWARP_SIZE. For wave32 targets the host therefore launches the wave64 configuration of a kernel that was compiled for wave32.gfx1250, which is already in the allowlist, has the same host/device mismatch.kvcacheio/transfer.cualso sizes its blocks with the host-sideWARP_SIZE.Modifications
include/utils.h:WARP_SIZEmeans on ROCm.sgl_launch_warp_size(), the runtime wave size of the current device (from the cachedat::cudadevice properties).SGL_DISPATCH_WARP_SIZE(...), which runs a lambda withconstexpr int kWarpSizeset to 32 or 64.sgl_wave_matches_target<WAVE>, which is true whenWAVEmatches the code object being compiled.WARP_SIZE/ 32, with no behavior change.moe_topk_softmax_kernels.cu,moe_topk_sigmoid_kernels.cu:topkGating{Softmax,Sigmoid}andTopkConstantsare templated on the wave size, and the launchers dispatch on the device's wave size.kvcacheio/transfer.cu: on ROCm,threads_per_blockusessgl_launch_warp_size().setup_rocm.py: addsgfx1201tosupported_targets, with comments on wave size, FP8 format (OCP E4M3), and LDS budget.docs/.../amd_gpu.mdx: adds a "Radeon RDNA4 / gfx1201 (experimental)" section covering build, wave-size rules for kernel authors, and serving notes.Other wave-size uses were checked and need no change:
moe_align: the host only over-provisions threads, and the ROCm path is independent of wave size.topk.hipanddeepseek_v4_topk.cu: wave handling is device-side only.dsv4_norm_rope: already writes E4M3FN on gfx12.Wave64 targets are unchanged
sgl-kernelwas built frommainand from this PR for each target (AMDGPU_TARGET=<arch>, GPUs hidden), and the disassembled code objects were compared kernel by kernel, ignoring only addresses and symbol names:On gfx942 / gfx950 the device code is therefore unchanged. The runtime cost is one cached device-property lookup per TopK / KV-transfer launch. On gfx1250 the device code is also unchanged, but the host now launches the wave32 configuration it was compiled for; I have no gfx1250 hardware to test this on.
Accuracy Tests
Kernel unit tests on R9700 (gfx1201), PyTorch 2.11.0+rocm10.0.0:
test_moe_topk_softmax.pytest_moe_topk_sigmoid.pyhipErrorLaunchFailuretest_moe_align.pytest_topk.pytest_kvcacheio.pytest_activation.pytest_dsv4_norm_rope.pyLLM end to end (exercises
sgl_kernel.topk_softmax):SGLANG_USE_AITER=0 --attention-backend triton --disable-custom-all-reduce.RuntimeError: topk_softmax launch error: unspecified launch failure.Diffusion smoke: MiniMax-H3 (Ref2AV) with TP2 on 2x R9700 and
--attention-backend torch_sdpa, using the custom all-reduce fix from #43676, completes 2 denoising steps and writes the video.Roadmap: gfx1201 SageAttention / Sol-Attn in SGLang Diffusion
This PR is the first step toward fast MiniMax-H3 (and other DiT) serving on Radeon gfx1201 with SGLang Diffusion. Today, on gfx1201:
SAGE_ATTNandSOL_ATTNare rejected on ROCm, because they call CUDA-only packages.AITER_SAGEruns, but it uses the aiter Tritonfav3_sagekernel. That kernel takes 12.4 s per MiniMax-H3 attention call, which makes it 3.25x slower end to end than BF16 SDPA (688.3 vs 211.6 s per DiT step).Two gfx1201 attention ops are being upstreamed to AITER as a four-part series:
gfx1201_sage_attention: INT8 QK^T, FP8 PV, FP32 accumulation; a HIP kernel plus a hand-scheduled code object. It is [HIP] [JIT] [Build] gfx1201: SageAttention forward (INT8 QK, FP8 PV) ROCm/aiter#6390 plus a follow-up.gfx1201_sol_attention: Sol-Attn block routing with the same arguments as NVlabssol_attn; also HIP plus a code object.With these ops plugged into stock LightX2V, MiniMax-H3 ref2av (TP2, 2x R9700, 768x1344, 362 frames, 29 steps) measures:
fav3_sage(today'sAITER_SAGE)gfx1201_sage_attentiongfx1201_sol_attention(Sol config)Planned SGLang changes, in order:
sgl-kernelbuilds and runs correctly on gfx1201 (wave32).expandable_segments.AITER_SAGE: dispatch togfx1201_sage_attentionon gfx1201, keeping the existingfav3_sagepath on other archs. This lands after the AITER Sage parts are merged.SOL_ATTN: accept it on ROCm throughgfx1201_sol_attention, withAITER_SAGEas the dense guard. This lands after the AITER Sol parts are merged.Steps 3 and 4 are opt-in and only change behavior on gfx1201. The CUDA and gfx94x/gfx95x paths stay unchanged.
Checklist
amd_gpu.mdx).CI States
Latest PR Test (Base): ❌ Run #38135876973
Latest PR Test (Extra): ❌ Run #38135876782
Latest PR Test (AMD ROCm 10): ❌ Run #38135876885