fix stride check error in fused_qk_norm_group_quant#2637
Merged
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 fused_qk_rmsnorm_group_quant to correctly support non-contiguous (but last-dimension-contiguous) Q/K/residual inputs by replacing overly strict contiguity checks with stride-based validation, and it fixes scale indexing for transpose_scale by passing explicit row/column strides into the kernel.
Changes:
- Relax input/output layout requirements from fully contiguous to
stride(1)==1with sane leading-dimension stride checks. - Make
q_out_scalewrites use explicit(row_stride, col_stride)sotranspose_scaleis handled via correct addressing rather than shape-only assumptions. - Update the op test to generate realistic strided Q/K/residual views via
torch.split, exercising the new stride checks.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
csrc/kernels/fused_qk_rmsnorm_group_quant.cu |
Replaces .is_contiguous() gating with stride-based checks and threads scale strides into the kernel to fix transpose_scale addressing. |
op_tests/test_fused_qk_rmsnorm_group_quant.py |
Constructs strided Q/K/residual inputs (via split-views) and adjusts scale buffer allocation for transpose_scale testing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
valarLip
approved these changes
Apr 7, 2026
yzhou103
added a commit
that referenced
this pull request
Apr 8, 2026
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