Update some HIP kernels support different warp_size(topksoftmax/grouptopk, cache, sample)#2599
Merged
Update some HIP kernels support different warp_size(topksoftmax/grouptopk, cache, sample)#2599
Conversation
Contributor
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates several HIP kernels and helpers to better handle GPUs with different warp (wavefront) sizes by replacing hard-coded 64 assumptions with WARP_SIZE / runtime queries, and tightening architecture gating for certain asm paths.
Changes:
- Make topk-softmax (including grouped topk) kernels compute warp-related launch/reduction behavior using
WARP_SIZE/get_warp_size_func()instead of assuming wave64. - Update cache reshape+quant kernels and sampling kernels to remove hard-coded warp-size template parameters and use shared warp-size helpers.
- Gate MoE asm topk-softmax usage/tests to specific gfx targets (
gfx942,gfx950).
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| op_tests/test_moeTopkSoftmax.py | Skips asm path except on gfx942/gfx950 to match supported targets. |
| csrc/kernels/topk_softmax_kernels.cu | Makes launch bounds and load vectorization more warp-size aware; adjusts BYTES_PER_LDG selection. |
| csrc/kernels/topk_softmax_kernels_group.cu | Reworks reductions to use shared wave_reduce and makes defaults depend on WARP_SIZE. |
| csrc/kernels/sample_kernels.cu | Removes fixed warp-size template parameters to rely on shared warp utilities. |
| csrc/kernels/moe_fused_gate.cu | Computes rows-per-warp/CTA from WARP_SIZE inside the kernel for portability. |
| csrc/kernels/cache_kernels.cu | Uses WARP_SIZE in per-token-quant reshape kernel indexing and adjusts launch sizing. |
| csrc/include/hip_reduce.h | Changes default warp-size template parameters to use WARP_SIZE. |
| csrc/include/aiter_hip_common.h | Adds warning about using WARP_SIZE as a host-side constexpr. |
| aiter/fused_moe.py | Restricts asm fused_topk usage to gfx942/gfx950. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
valarLip
approved these changes
Apr 4, 2026
3 tasks
yzhou103
pushed a commit
that referenced
this pull request
Apr 8, 2026
…topk, cache, sample) (#2599) * update topk_softmax * update hip group topk * rm warpsize in sample_kernels.cu * update cache.cu * update * update2
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
Technical Details
Test Plan
Test Result
Submission Checklist