fix(cute_dsl): migrate off APIs removed in nvidia-cutlass-dsl 4.6 (keeps 4.5.x compat) - #3922
Conversation
cutlass-dsl 4.6.0 removed the long-deprecated cute.make_fragment (use cute.make_rmem_tensor) and cute.core.ThrMma (use cute.ThrMma). Since requirements.txt floats on >=4.5.0, any fresh install now resolves to 4.6.0 and the blk128 sparse-attention and SM120 b12x GEMM paths raise AttributeError at trace time. Both replacement names already exist in 4.5.0/4.5.1/4.5.2 (verified against the v4.5.x tags and a live 4.5.2 install), so this is a pure rename with no version guard needed and no requirements change: the same code now works on 4.5.x and 4.6.x. - cute.make_fragment( -> cute.make_rmem_tensor( (18 sites, 4 files) - cute.core.ThrMma -> cute.ThrMma (13 sites, 2 files) Verified: a make_rmem_tensor smoke kernel traces, compiles and runs correctly on SM100 under both cutlass-dsl 4.5.2 and 4.6.0; repo-wide grep for the removed spellings is clean (flashinfer/, tests/, benchmarks/). AI-assisted (Claude Code). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughCuTe DSL temporaries are migrated from fragments to RMEM tensors across sparse attention, GQA packing, utility reductions, and dense GEMM predicates. MMA annotations use ChangesCuTe RMEM migration
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Code Review
This pull request refactors the codebase by replacing cute.core.ThrMma with cute.ThrMma and updating calls from cute.make_fragment to cute.make_rmem_tensor across several files. The review feedback highlights two important issues in flash_fwd_sm100.py: an unused tensor allocation that represents dead code and should be removed, and a redundant outer tensor allocation that is immediately overwritten inside a loop, which can be optimized to avoid unnecessary register pressure.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| cute.make_rmem_tensor(tSrScale_t2r_shape, Float32) | ||
| # q_stage=1 correction loop |
There was a problem hiding this comment.
The allocation cute.make_rmem_tensor(tSrScale_t2r_shape, Float32) is completely unused and represents dead code. Removing it cleans up the implementation and avoids any potential confusion.
| cute.make_rmem_tensor(tSrScale_t2r_shape, Float32) | |
| # q_stage=1 correction loop | |
| # q_stage=1 correction loop |
There was a problem hiding this comment.
Fixed in cb7ec1b. Pulling this thread revealed the flagged line was the last reference into a whole vestigial tmem scale-load scaffold (tStScale_layout / tStScales / tScScale / thr_tmem_load_vec and a discarded list-comprehension of partition_S calls), so the entire reference-less chain is removed (−26 lines), not just this line — all trace-time-pure layout math, no copies/barriers touched. Note this dead code predates this PR (it was equally dead as cute.make_fragment). Re-verified on SM100: VSA suite 30 passed / 9 skipped under both cutlass-dsl 4.5.2 and 4.6.1, identical to pre-cleanup.
| tOrO_frg = cute.make_rmem_tensor((tOrO_t2r_shape, frg_count), self.pv_acc_dtype) | ||
| for i in cutlass.range_constexpr(frg_count): | ||
| tOrO_frg = cute.make_fragment(tOrO_t2r_shape, self.pv_acc_dtype) | ||
| tOrO_frg = cute.make_rmem_tensor(tOrO_t2r_shape, self.pv_acc_dtype) |
There was a problem hiding this comment.
The outer allocation of tOrO_frg with shape (tOrO_t2r_shape, frg_count) is immediately overwritten inside the loop with a smaller shape tOrO_t2r_shape. This wastes register allocation and increases register pressure unnecessarily. Allocating tOrO_frg outside the loop with the correct shape tOrO_t2r_shape and reusing it inside the loop avoids redundant allocations.
tOrO_frg = cute.make_rmem_tensor(tOrO_t2r_shape, self.pv_acc_dtype)\n for i in cutlass.range_constexpr(frg_count):There was a problem hiding this comment.
Fixed in cb7ec1b by deleting the dead outer allocation (it was rebound on the first loop iteration before any use, so removal is a no-op on the generated kernel). Deliberately NOT hoisting the in-loop allocation out as suggested: that changes fragment lifetime/reuse semantics in a hot correction loop for no verified gain, and this PR aims to stay behavior-preserving. Also pre-existing before this PR's rename. Re-verified on SM100: 30 passed / 9 skipped under both 4.5.2 and 4.6.1.
|
Ran this branch on SM120 (RTX PRO 6000, CUDA 13): tests/moe/test_b12x_fused_moe.py is 142/142 under nvidia-cutlass-dsl 4.5.2 and 4.6.0, and the mm_fp4 b12x n=k=128 slice (96 cases) passes identically on both, so the b12x half holds up on real hardware -- the blk128 sparse files are SM100-only so I couldn't exercise those. One catch for the 4.6 story: the 4.6.0 DSL's kwargs-wrapper path needs apache-tvm-ffi>=0.1.11, and on 0.1.6 (still allowed by flashinfer's >=0.1.6,<0.2 floor; the 4.6.0 wheels don't declare a tvm-ffi dep themselves) the whole moe suite dies at the first kernel build with |
|
Thanks @waynehacking8 for the SM120 verification — that covered exactly the half we couldn't reach. We've now run the other half plus an old-arch sweep on our dev box (A100 / L40S / H100 / SM100-Blackwell), this time against 4.6.1: SM100 — VSA blk128 suite (
SM80 / SM89 / SM90 — norm suite under 4.6.1 (
Two observations from the 4.6.1 runs:
Verification on our side is complete: 4.5.x and 4.6.x are both green with this branch on SM80/89/90/100 (+ SM120 from the report above). 🤖 Generated with Claude Code |
…ction warp Review flagged an unused cute.make_rmem_tensor call and a shadowed outer tOrO_frg allocation. Both predate the 4.6 rename (they were equally dead as cute.make_fragment). The unused allocation was the last reference into a vestigial tmem scale-load scaffold (tStScale_layout / tStScales / tScScale / thr_tmem_load_vec chain), so the whole reference-less chain is removed rather than just the flagged line; every deleted symbol has zero remaining uses in the enclosing scope (ruff F841-clean). Trace-time-pure deletions only — no copies, barriers, or arch ops removed. Re-verified on SM100: tests/attention/test_vsa_block_sparse.py is 30 passed / 9 skipped under both cutlass-dsl 4.5.2 and 4.6.1, matching the pre-cleanup runs. AI-assisted (Claude Code). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
🧹 Nitpick comments (2)
flashinfer/cute_dsl/sparse/blk128/flash_fwd_sm100.py (2)
2373-2375: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRemove redundant tensor allocation.
The outer allocation for
tOrO_frgis immediately and unconditionally overwritten in the first iteration of the loop, making it dead code.♻️ Proposed fix
- tOrO_frg = cute.make_rmem_tensor((tOrO_t2r_shape, frg_count), self.pv_acc_dtype) for i in cutlass.range_constexpr(frg_count): tOrO_frg = cute.make_rmem_tensor(tOrO_t2r_shape, self.pv_acc_dtype)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@flashinfer/cute_dsl/sparse/blk128/flash_fwd_sm100.py` around lines 2373 - 2375, Remove the outer `cute.make_rmem_tensor((tOrO_t2r_shape, frg_count), self.pv_acc_dtype)` allocation for `tOrO_frg`; initialize it only within the `for i in cutlass.range_constexpr(frg_count)` loop using the existing per-iteration shape and dtype.
2120-2120: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRemove unassigned expression.
This
cute.make_rmem_tensorallocation is not assigned to a variable and acts as dead code.♻️ Proposed fix
- cute.make_rmem_tensor(tSrScale_t2r_shape, Float32)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@flashinfer/cute_dsl/sparse/blk128/flash_fwd_sm100.py` at line 2120, Remove the unassigned cute.make_rmem_tensor call in the surrounding function, as it allocates a tensor without using or storing the result. Preserve any assigned tensor allocations and the surrounding control flow.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@flashinfer/cute_dsl/sparse/blk128/flash_fwd_sm100.py`:
- Around line 2373-2375: Remove the outer
`cute.make_rmem_tensor((tOrO_t2r_shape, frg_count), self.pv_acc_dtype)`
allocation for `tOrO_frg`; initialize it only within the `for i in
cutlass.range_constexpr(frg_count)` loop using the existing per-iteration shape
and dtype.
- Line 2120: Remove the unassigned cute.make_rmem_tensor call in the surrounding
function, as it allocates a tensor without using or storing the result. Preserve
any assigned tensor allocations and the surrounding control flow.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 464617e5-f6c5-4965-9f26-3aaf5df40208
📒 Files selected for processing (4)
flashinfer/cute_dsl/sparse/blk128/flash_fwd_sm100.pyflashinfer/cute_dsl/sparse/blk128/pack_gqa.pyflashinfer/cute_dsl/sparse/blk128/utils.pyflashinfer/gemm/kernels/dense_blockscaled_gemm_sm120_b12x.py
bkryu
left a comment
There was a problem hiding this comment.
Approving b12x changes.
Sparse attention changes should still be reviewed
|
/bot run |
|
[FAILED] Pipeline #58066677: 4/20 passed |
|
CI triage for the record — the internal bot's "4/20 passed" verdict decomposes entirely into infra + pre-existing issues; no failure traces to this PR:
Everything this PR touches passed on every leg that reached it: 🤖 Generated with Claude Code |
📌 Description
nvidia-cutlass-dsl4.6.0 (released 2026-07-02) executed its long-deprecated API clean-up:cute.make_fragmentremoved →cute.make_rmem_tensorcute.core.ThrMma/cute.core.ThrCopyremoved →cute.ThrMma/cute.ThrCopySince
requirements.txtfloats onnvidia-cutlass-dsl>=4.5.0, a fresh install now resolves to 4.6.0, and the blk128 sparse-attention path and the SM120 b12x dense block-scaled GEMM path raiseAttributeErrorat trace time.This PR is a pure rename (±31 lines, 4 files):
cute.make_fragment(→cute.make_rmem_tensor(— 18 sitescute.core.ThrMma→cute.ThrMma— 13 sitesNo version guard and no requirements change needed: the replacement names already exist in 4.5.0/4.5.1/4.5.2 (verified against the v4.5.x tags), so the same code works across 4.5.x and 4.6.x.
cute.make_fragment_like(79 sites) is not touched — it is still shipped in 4.6.0 and in the current internal nightly.✅ Verification
make_rmem_tensor/ThrMma/ThrCopypresent in 4.5.2 and 4.6.0;make_fragmentconfirmed absent in 4.6.0.make_rmem_tensorsmoke kernel traces, compiles, and runs with correct output on SM100 under both cutlass-dsl 4.5.2 and 4.6.0.flashinfer/,tests/,benchmarks/).Not covered here (needs CI/QA hardware): full blk128/VSA suite on SM100 (requires
quack; note quack must be version-paired — quack 0.5.x for DSL 4.5.x, quack ≥0.6 pins==4.6.0), and SM120 b12x GEMM/MoE suites.🔍 Related Issues
Follow-up (separate PR):
flashinfer/cute_dsl/sparse/blk128/mma_sm100_desc.pyreferencescutlass.FloatE4M3FN/cutlass.FloatE5M2, which do not exist in any of 4.5.x/4.6.0 — latentAttributeErroron the fp8 branch, independent of this migration.🤖 Generated with Claude Code
Summary by CodeRabbit