Skip to content

fix(dsv4): use vec_size=32 for dim=1024 rotate-quant kernels - #4438

Merged
valarLip merged 2 commits into
ROCm:mainfrom
XiaobingSuper:fix/dsv4-rotate-wave32
Jul 29, 2026
Merged

valarLip merged 2 commits into
ROCm:mainfrom
XiaobingSuper:fix/dsv4-rotate-wave32

Conversation

@XiaobingSuper

@XiaobingSuper XiaobingSuper commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

Problem

PR #4029 switched all dim=1024 launch sites to vec_size=16. On wave32 targets (gfx1250), 16 × 32 = 512 is not divisible by 1024, causing JIT build failure for module_dsv4_rotate_quant.

Solution

Use vec_size=32 for all dim=1024 entry points:

Target vec × warp Product
gfx1250 (wave32) 32 × 32 1024
gfx950 / MI355X (wave64) 32 × 64 2048 (÷ 1024 ✓)

Affected paths: rotate_activation, rope_rotate_activation, rope_rotate_activation_fp8quant, rmsnorm_rope_rotate_activation_fp4quant_kvcache.

Test plan

  • JIT build module_dsv4_rotate_quant on gfx1250
  • Regression on gfx950 with dim=128,512,1024

@XiaobingSuper
XiaobingSuper requested review from a team and Copilot July 29, 2026 12:27
@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:triton-300x Run an additional Triton test job on MI300X in PRs; main branch always runs both MI35X and MI300X
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: GPT-OSS-120B, DeepSeek-R1-0528, Kimi-K2.5
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 4438 --add-label <label>

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.

Pull request overview

Restores correct tile geometry for DeepSeek-V4 rotate / RoPE rotate quantization kernels at dim=1024 by selecting vec_size based on runtime WARP_SIZE (wave32 vs wave64), avoiding invalid vec_size * warp_size % dim configurations.

Changes:

  • Extend hadamard_rotate_activation_fp4quant_kernel to parameterize a logical_warp_size used in the tile geometry (m_block) static checks/computation.
  • Add a *_KERNEL_IMPL_WARP launcher macro to instantiate the kernel with explicit (vec_size, logical_warp_size) for dim=1024.
  • Update dim=1024 dispatch sites to choose vec_size=32 for wave32 (block_size==32) and keep vec_size=16 for wave64.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread csrc/kernels/dsv4_rotate_quant.cu Resolved
PR ROCm#4029 refactored inplace rotate-quant into out-of-place kernels but
unconditionally used vec_size=16 for dim=1024. On wave32 targets this
violates vec_size * warp_size % dim == 0 (16*32=512), breaking JIT build
and producing wrong tile geometry. Dispatch by runtime WARP_SIZE: wave32
uses (vec=32, logical_warp=32), wave64 keeps (vec=16, logical_warp=64).

Co-authored-by: Cursor <[email protected]>
@XiaobingSuper
XiaobingSuper force-pushed the fix/dsv4-rotate-wave32 branch from 4c7be55 to 6917d1b Compare July 29, 2026 12:47
@XiaobingSuper
XiaobingSuper marked this pull request as draft July 29, 2026 12:49
PR ROCm#4029 switched dim=1024 launch sites to vec_size=16, which breaks
wave32 targets where 16*32=512 is not divisible by 1024. Use vec_size=32
instead (32*32=1024 on gfx1250, 32*64=2048 on wave64).

Co-authored-by: Cursor <[email protected]>
@XiaobingSuper XiaobingSuper changed the title fix(dsv4): restore wave32 dim=1024 tile sizing for rotate-quant kernels ix(dsv4): use vec_size=32 for dim=1024 rotate-quant kernels Jul 29, 2026
@XiaobingSuper
XiaobingSuper marked this pull request as ready for review July 29, 2026 13:03
@XiaobingSuper XiaobingSuper changed the title ix(dsv4): use vec_size=32 for dim=1024 rotate-quant kernels fix(dsv4): use vec_size=32 for dim=1024 rotate-quant kernels Jul 29, 2026
@valarLip
valarLip merged commit 87e2ec5 into ROCm:main Jul 29, 2026
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants