Repository navigation
Fix RoundingModeKind incompatible with nvidia-cutlass-dsl 4.6.0+ - #4765
Conversation
nvidia-cutlass-dsl 4.6.0 renamed RoundingModeKind -> FPRoundingMode, while both existed in 4.5.0. #4725 recently added references to the old name, resulting in the following error. This breaks compatibility with vllm nightly, which currently depends on 4.6.2: ``` AttributeError: module 'cutlass._mlir.dialects.nvvm' has no attribute 'RoundingModeKind' at cute_utils.py:246, in compute_scale_rceil ``` According to claude: ``` Rename the three uses to `FPRoundingMode`, which is correct on every released version: - Values are identical for the members used here: RoundingModeKind: NONE=0 RN=1 RM=2 RP=3 RZ=4 FPRoundingMode: NONE=0 RN=1 RM=2 RP=3 RZ=4 RNA=5 (strict superset) - Both register attribute builders with the same body, emitting a signless i32 IntegerAttr from int(x), so the enum class does not affect the attribute. - From 4.6.0 the generated op requests 'FPRoundingModeAttr' (22 uses, 0 of 'RoundingModeKindAttr'), so this is the expected API there, not a shim. - FPRoundingMode is present in 4.4.2, 4.5.0, 4.6.0, 4.6.2 and 4.7.0, so the unconditional rename keeps older versions working. ```
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/4765
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit b5f5875 with merge base f10e69b ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@claude review, and make sure to check vs the cutedsl docs |
|
Claude finished @vkuzo's task in 2m 21s —— View job Review: PR #4765 —
|
| Line | Function | Mode |
|---|---|---|
cute_utils.py:204 |
_cvt_ue8m0_to_f32 |
.RN (round-to-nearest) |
cute_utils.py:246 |
compute_scale_rceil |
.RP (round-up / ceil) |
cute_utils.py:260 |
compute_scale_floor |
.RZ (round-toward-zero / floor) |
Verified in-repo
- ✅ Complete — a repo-wide grep for
RoundingModeKindreturns zero remaining hits; all three sites are converted. - ✅ Consistent — on
origin/mainthe file usedRoundingModeKindfor all three (introduced in Refine MXFP8 CUDA quantization semantics #4725, commitf10e69b's successor). There's no mixed usage left, and no other file in the repo references either enum. - ✅ Semantics preserved — the modes map 1:1 to the same intent:
.RPstill backs the round-up path incompute_scale_rceiland.RZstill backs the floor path incompute_scale_floor, matching each function's docstring. The rename doesn't touchCVTPackFloatKindorSaturationModeKind, which is right.
On the "check vs the cutedsl docs" request
WebFetch is not permitted here and outbound gh api/network calls are blocked. The nvvm dialect enums are also code-generated into the nvidia-cutlass-dsl wheel rather than committed to the public NVIDIA/cutlass git tree, so they can't be inspected from the repo either. If you want an independent doc cross-check, it's a one-liner against an installed wheel:
from cutlass._mlir.dialects import nvvm
print([m for m in dir(nvvm.FPRoundingMode) if not m.startswith("_")])
# expect: NONE RN RM RP RZ (RNA on 4.6+)The PR description's evidence is internally consistent with the fix: FPRoundingMode is a strict superset of RoundingModeKind for the members used here (RN=1, RP=3, RZ=4), both enums feed the same signless-i32 IntegerAttr builder, and from 4.6.0 the generated op requests FPRoundingModeAttr exclusively. That matches the reported runtime error (nvvm has no attribute 'RoundingModeKind' on 4.6.2) and the claim that FPRoundingMode exists on 4.4.2 → 4.7.0.
Suggestion (non-blocking)
Since the whole motivation is a version-compat break, it would be worth confirming the fix on the actual pinned version (vllm nightly's nvidia-cutlass-dsl==4.6.2) — the GPU CI job exercising cute_utils is the real signal here. The RoundingModeKind→FPRoundingMode rename landed in 4.6.0, so a green run on 4.6.2 fully closes this out. (The current CI failure is just the unrelated module: label check, not a code failure.)
· branch cutlass-rounding-mode
`nvidia-cutlass-dsl` 4.6.0 removed a leading argument in `cvt_packfloat_f32` and `cvt_packfloat`. 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 ``` ``` \# 4.5.x nvvm.cvt_packfloat_f32(T.i32(), src_a, src_b, src_c, to, rnd=..., sat=...) \# 4.6.0+ nvvm.cvt_packfloat_f32(src_a, src_b, src_c, to, rnd=..., sat=...) ``` Repro on 4.6.0 (needs #4765 to run): ``` 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) ``` Verified on 4.6.0 that the output is bitwise identical to `triton_to_mxfp8_dim0` for qdata and scales.
`nvidia-cutlass-dsl` 4.6.0 removed a leading argument in `cvt_packfloat_f32` and `cvt_packfloat`. 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 ``` ``` \# 4.5.x nvvm.cvt_packfloat_f32(T.i32(), src_a, src_b, src_c, to, rnd=..., sat=...) \# 4.6.0+ nvvm.cvt_packfloat_f32(src_a, src_b, src_c, to, rnd=..., sat=...) ``` Repro on 4.6.0 (needs #4765 to run): ``` 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) ``` Verified on 4.6.0 that the output is bitwise identical to `triton_to_mxfp8_dim0` for qdata and scales.
`nvidia-cutlass-dsl` 4.6.0 removed a leading argument in `cvt_packfloat_f32` and `cvt_packfloat`. 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 ``` ``` \# 4.5.x nvvm.cvt_packfloat_f32(T.i32(), src_a, src_b, src_c, to, rnd=..., sat=...) \# 4.6.0+ nvvm.cvt_packfloat_f32(src_a, src_b, src_c, to, rnd=..., sat=...) ``` Repro on 4.6.0 (needs #4765 to run): ``` 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) ``` Verified on 4.6.0 that the output is bitwise identical to `triton_to_mxfp8_dim0` for qdata and scales.
`nvidia-cutlass-dsl` 4.6.0 removed a leading argument in `cvt_packfloat_f32` and `cvt_packfloat`. 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 ``` ``` \# 4.5.x nvvm.cvt_packfloat_f32(T.i32(), src_a, src_b, src_c, to, rnd=..., sat=...) \# 4.6.0+ nvvm.cvt_packfloat_f32(src_a, src_b, src_c, to, rnd=..., sat=...) ``` Repro on 4.6.0 (needs #4765 to run): ``` 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) ``` Verified on 4.6.0 that the output is bitwise identical to `triton_to_mxfp8_dim0` for qdata and scales.
`nvidia-cutlass-dsl` 4.6.0 removed a leading argument in `cvt_packfloat_f32` and `cvt_packfloat`. 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 ``` ``` \# 4.5.x nvvm.cvt_packfloat_f32(T.i32(), src_a, src_b, src_c, to, rnd=..., sat=...) \# 4.6.0+ nvvm.cvt_packfloat_f32(src_a, src_b, src_c, to, rnd=..., sat=...) ``` Repro on 4.6.0 (needs #4765 to run): ``` 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) ``` Verified on 4.6.0 that the output is bitwise identical to `triton_to_mxfp8_dim0` for qdata and scales. Same fix for `fmax`.
`nvidia-cutlass-dsl` 4.6.0 removed a leading argument in `cvt_packfloat_f32` and `cvt_packfloat`. 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 ``` ``` \# 4.5.x nvvm.cvt_packfloat_f32(T.i32(), src_a, src_b, src_c, to, rnd=..., sat=...) \# 4.6.0+ nvvm.cvt_packfloat_f32(src_a, src_b, src_c, to, rnd=..., sat=...) ``` Repro on 4.6.0 (needs #4765 to run): ``` 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) ``` Verified on 4.6.0 that the output is bitwise identical to `triton_to_mxfp8_dim0` for qdata and scales. Same fix for `fmax`.
Summary:
nvidia-cutlass-dsl 4.6.0renamedRoundingModeKind->FPRoundingMode, while both existed in 4.5.0. #4725 recently added references to the old name, resulting in the following error. This breaks compatibility with vllm nightly, which currently depends on 4.6.2:Claude summary: