cutlass
cutlass copied to clipboard
[BUG] CuTe DSL: cute.arch.red() fails to compile with its default sem=None
Which component has the problem? CuTe DSL
Describe the bug
cute.arch.red() with its default sem=None fails to compile. It works with sem="relaxed" or sem="release".
Steps/Code to reproduce bug
import torch
import cutlass.cute as cute
from cutlass import Float32
from cutlass.cute.runtime import from_dlpack
@cute.kernel
def k(x: cute.Tensor):
cute.arch.red(x.iterator.llvm_ptr, Float32(1.0), op="add", dtype=Float32)
@cute.jit
def run(x: cute.Tensor):
k(x).launch(grid=[1, 1, 1], block=[64, 1, 1])
x = torch.zeros(1, device="cuda")
run(from_dlpack(x))
error: NVVM backend compilation failed
note: backend log:
Failed to generate PTX from the compilation unit. (error 9: NVVM_ERROR_COMPILATION), libNVVM
extra log: Invalid memory model ordering for nvvm.red
Expected behavior
The kernel compiles and x is [64.0]. The docstring describes None as "no memory ordering specified", and PTX takes a red without .sem as relaxed.
Environment details
nvidia-cutlass-dsl 4.8.1 (latest on PyPI), torch 2.9.0, Python 3.13, Cloud (Modal), A10G (sm_86). The code involved is unchanged on main (b2f249a).
Additional context
red() passes mem_order=None to nvvm.red, which libNVVM rejects. I have a fix with a test and will open a PR.