[Kernel] Honor leading strides in CUTLASS 3.x scaled_mm - #55537
[Kernel] Honor leading strides in CUTLASS 3.x scaled_mm#55537jackLei0901 wants to merge 1 commit into
Conversation
Use runtime tensor leading strides for A, B, and output instead of assuming packed layouts. Extend regression coverage for independently padded views. Assisted-by: OpenAI Codex <codex@openai.com> Signed-off-by: jackLei0901 <42642542+jackLei0901@users.noreply.github.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 SummarySummary by CodeRabbit
WalkthroughThe CUTLASS 3.x GEMM caller now uses runtime leading strides for input and output tensors. A parameterized regression test covers strided views of A, B, and the output tensor through the raw scaled matrix multiplication operator. ChangesCUTLASS stride propagation
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to CUTLASS 3.x scaled matrix multiplication now correctly honors supported padded tensor views while retaining packed-layout behavior. Coverage includes independently padded inputs and output, with no current merge-blocking risk identified. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 1 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Fix CUTLASS 3.x scaled GEMM addressing for aligned sliced or padded tensor
views by forwarding their actual leading strides instead of reconstructing
tightly packed strides from shape alone.
The operator entry point already accepts row-major A/output and column-major B
with padded leading dimensions. The C3x caller discarded that metadata, which
silently read or wrote incorrect addresses. This fixes A, B, C, and D leading
strides without adding tensor copies; packed inputs retain the same stride
values as before.
Fixes #55534.
Regression coverage
The former combined subset test is split into independent padded-A, padded-B,
and padded-output cases. Keeping the other operands packed in each case makes
the failed stride contract explicit.
Validation
Environment: NVIDIA H800 PCIe (SM90), CUDA 13.0, PyTorch 2.13.0+cu130.
Model evaluations are not applicable: this is a low-level kernel addressing
fix, and the focused numerical comparison covers the affected output contract.
Duplicate-work check
I searched open PRs by issue number and by
CUTLASS scaled_mm leading strideand
cutlass_gemm_caller stride. No open PR addresses this bug. The keywordresults #33651 and #41834 concern different kernel/backend changes.
AI assistance disclosure
AI assistance was used to help inspect the CUTLASS/PyTorch stride contract,
prepare the patch and tests, and organize the validation evidence. I reviewed
the changed lines and validation results before submission.