Repository navigation
Fix cvt_packfloat compatibility with nvidia-cutlass-dsl 4.6.0+ - #4766
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/4766
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 550f24f with merge base ca74881 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
8ec516a to
c7041df
Compare
|
@claude review |
|
Claude finished @andrewor14's task in 3m 0s —— View job Code Review: Fix cvt_packfloat compatibility with nvidia-cutlass-dsl 4.6.0+
The overall approach is sound: gate the removed leading result-type argument ( 🔴 The
|
|
Thanks for addressing the One additional compatibility point may be worth including before merge: Also, since It would be useful to test both a 4.5.x and 4.6.x CuTeDSL environment before merging, since the goal is to preserve older-version support while adding 4.6+ compatibility. |
f08577a to
55edcb6
Compare
|
@claude review again? I just rebased. The naming change was actually made before this PR |
|
Hi @janbernloehr, thanks for the suggestion. I fixed it for fmax too. Will test on 4.5.0 now. I did actually confirm that |
|
Claude finished @andrewor14's task in 1m 14s —— View job Re-review: Fix cvt_packfloat compatibility with nvidia-cutlass-dsl 4.6.0+
You're right — and the rebase resolves the two blocking items from the last round. 👍 ✅ Resolved:
|
759a77b to
082ac20
Compare
|
@claude review latest changes again |
|
Claude finished @andrewor14's task in 48s —— View job Re-review: Fix cvt_packfloat compatibility with nvidia-cutlass-dsl 4.6.0+
The detection strategy changed entirely since the last round, and it's a clear improvement. 👍 ✅ Signature introspection replaces the version gate — this is the right callInstead of def _accepts_res_arg(op) -> bool:
return "res" in inspect.signature(op).parameters
_FMAX_ACCEPTS_RES_ARG = _accepts_res_arg(nvvm.fmax)
_CVT_PACKFLOAT_F32_ACCEPTS_RES_ARG = _accepts_res_arg(nvvm.cvt_packfloat_f32)
_CVT_PACKFLOAT_ACCEPTS_RES_ARG = _accepts_res_arg(nvvm.cvt_packfloat)This directly resolves both issues that couldn't be solved by version comparison:
Caching the three booleans at module scope rather than calling 🟢 Minor (non-blocking): still some branch duplication
res_prefix = (T.i32(),) if _CVT_PACKFLOAT_F32_ACCEPTS_RES_ARG else ()
packed = nvvm.cvt_packfloat_f32(
*res_prefix, src_a, src_b, src_c, to,
rnd=rounding_mode, sat=nvvm.SaturationModeKind.NONE, loc=loc, ip=ip,
)Purely stylistic — the explicit branches read fine and the duplication is bounded. Fix this → 🟢 One thing worth a sanity check
VerdictThis is a better fix than the version-gated version I reviewed last time — it solves the same-version/different-extra ambiguity that motivated the PR and eliminates the nightly-misclassification edge case entirely. Both prior blockers are gone. Only the optional dedup remains. LGTM, assuming the full version sweep in the PR description passed (which is the real confirmation, since there's no |
| # nvidia-cutlass-dsl 4.4.x, 4.5.x accepts `res` | ||
| # nvidia-cutlass-dsl[cu13] 4.4.x, 4.5.x no `res` | ||
| # nvidia-cutlass-dsl 4.6.0+ no `res` | ||
| # nvidia-cutlass-dsl[cu13] 4.6.0+ no `res` |
There was a problem hiding this comment.
can we add a TODO here to go back to a version gate once 4.5.x ages out of pytorch support
**Summary:** `nvidia-cutlass-dsl` 4.6.0 removed a leading argument in a few nvvm ops. The current callsite in torchao (introduced in #4725) still includes this leading argument, resulting in the following error: ``` TypeError: cvt_packfloat_f32() takes 4 positional arguments but 5 were given ``` Correct signature: ``` \# 4.5.x nvvm.cvt_packfloat_f32(T.i32(), src_a, src_b, src_c, to, rnd=..., sat=...) \# 4.5.x[cu13], 4.6.0+ nvvm.cvt_packfloat_f32(src_a, src_b, src_c, to, rnd=..., sat=...) ``` Note that we cannot simply gate this on the verison because different variants within the same version can have different signatures. Here is the complete table: ``` nvidia-cutlass-dsl 4.4.x, 4.5.x accepts `res` == T.i32() nvidia-cutlass-dsl[cu13] 4.4.x, 4.5.x no `res` nvidia-cutlass-dsl 4.6.0+ no `res` nvidia-cutlass-dsl[cu13] 4.6.0+ no `res` ``` Full list of affected ops used by `cute_utils.py`: ``` fmax cvt_packfloat cvt_packfloat32 ``` **Test Plan:** Full version sweep across the following versions. vllm nightly currently requires 4.6.2. ``` nvidia-cutlass-dsl 4.5.3, 4.6.0, 4.6.2, 4.7.1 nvidia-cutlass-dsl[cu13] 4.5.3, 4.6.0, 4.6.2, 4.7.1 ``` Repro 1: ``` import torch from torchao.prototype.moe_training.kernels.mxfp8 import ( mxfp8_quantize_2d_1x32_cutedsl, ) x = torch.randn(128, 2048, device="cuda", dtype=torch.bfloat16) offs = torch.tensor([128], device="cuda", dtype=torch.int32) mxfp8_quantize_2d_1x32_cutedsl(x, scaling_mode="rceil", offs=offs) ``` Repro 2: ``` import torch from torchao.prototype.moe_training.kernels.mxfp8 import ( mxfp8_quantize_cuda_3d, ) x = torch.randn(2, 256, 256, device="cuda", dtype=torch.bfloat16) mxfp8_quantize_cuda_3d( x, scale_block_dim1=32, scale_block_dim2=32, scaling_mode="rceil", ) ```
082ac20 to
550f24f
Compare
Summary
nvidia-cutlass-dsl4.6.0 removed a leading argument in a few nvvm ops. The current callsite in torchao (introduced in #4725) still includes this leading argument, resulting in the following error:Correct signature:
Note that we cannot simply gate this on the verison because different variants within the same version can have different signatures. Here is the complete table:
Full list of affected ops used by
cute_utils.py:Test Plan
Full version sweep across the following versions. vllm nightly currently requires 4.6.2.
Repro 1:
Repro 2: