Skip to content

[BUG] [CuTeDSL] SIGABRT compiling a cute_ext copy kernel with rank-2 inputs and local_tile(..., proj=...) #3957

Backlog

Description

@zkyue

Which component has the problem?

CuTe DSL

Bug Report

Describe the bug

On an NVIDIA B200, compilation aborts when a copy kernel uses cute.local_tile(..., proj=(1, 1, None)) on rank-2 tensors and passes the resulting tiles to cute_ext.partition and cute_ext.copy. The kernel uses CopyUniversalOp and a register buffer.

Of the four cases below, only ext 2 proj aborted. The plain kernel calls the same tile helper on the same rank-2 inputs and copies the elements with indexed loads and stores.

The process exited 134. The captured output contains no compiler diagnostic. faulthandler reported these top Python frames (paths shortened):

Fatal Python error: Aborted
  File ".../cutlass/base_dsl/compiler.py", line 325 in compile
  File ".../cutlass/base_dsl/compiler.py", line 423 in compile_and_jit

Line 325 calls pm.run(module.operation).

Steps/Code to reproduce bug

Save the script as repro.py and run each command in a separate process.

python -X faulthandler repro.py ext   2 proj     # SIGABRT, exit 134
python -X faulthandler repro.py ext   2 noproj   # PASS, exit 0
python -X faulthandler repro.py ext   3 proj     # PASS, exit 0
python -X faulthandler repro.py plain 2 proj     # PASS, exit 0
repro.py
import sys

import torch

import cutlass
from cutlass import cute
from cutlass.cute import experimental as cute_ext

MODE, RANK, PROJ = sys.argv[1], int(sys.argv[2]), sys.argv[3] == "proj"


def tile(t, cta_m, cta_n, cta_l):
    if cutlass.const_expr(PROJ):
        coord = (cta_m, cta_n, None, cta_l) if cutlass.const_expr(RANK == 3) else (cta_m, cta_n, None)
        return cute.local_tile(t, (128, 64, 1), coord, proj=(1, 1, None))
    coord = (cta_m, cta_n, cta_l) if cutlass.const_expr(RANK == 3) else (cta_m, cta_n)
    return cute.local_tile(t, (128, 64), coord)


@cute.kernel
def ext_kernel(mA: cute.Tensor, mD: cute.Tensor):
    cta_m, cta_n, cta_l = cute.arch.block_idx()
    tid, _, _ = cute.arch.thread_idx()
    gA, gD = tile(mA, cta_m, cta_n, cta_l), tile(mD, cta_m, cta_n, cta_l)
    buf = cute_ext.allocate(
        cute.Float16,
        cutlass.AddressSpace.rmem,
        cute.make_layout(((8, 1), (1, 8)), stride=((1, 8), (1, 8))),
        alignment=16,
    )
    tv = cute.make_layout(((16, 8), (8, 1)), stride=((8, 128), (1, 1024)))
    tl = cute.core._pack_tile((128, 8))
    atom = cute.make_copy_atom(cute.nvgpu.CopyUniversalOp(), cute.Float16, num_bits_per_copy=128)
    cute_ext.copy(cute_ext.partition(gA, tid, layout_tv=tv, tiler=tl), buf, copy_atom=atom)
    cute_ext.copy(buf, cute_ext.partition(gD, tid, layout_tv=tv, tiler=tl), copy_atom=atom)


@cute.kernel
def plain_kernel(mA: cute.Tensor, mD: cute.Tensor):
    cta_m, cta_n, cta_l = cute.arch.block_idx()
    tid, _, _ = cute.arch.thread_idx()
    gA, gD = tile(mA, cta_m, cta_n, cta_l), tile(mD, cta_m, cta_n, cta_l)
    for j in cutlass.range_constexpr(64):
        gD[tid, j] = gA[tid, j]


@cute.jit
def host(a: cute.Tensor, d: cute.Tensor):
    k = ext_kernel if cutlass.const_expr(MODE == "ext") else plain_kernel
    k(a, d).launch(grid=(1, 1, 1), block=(128, 1, 1))


if RANK == 3:
    src = torch.randn(1, 64, 128, dtype=torch.float16, device="cuda").permute(2, 1, 0)
else:
    src = torch.randn(64, 128, dtype=torch.float16, device="cuda").T
dst = torch.zeros_like(src)
host(cute.runtime.from_dlpack(src, assumed_align=16), cute.runtime.from_dlpack(dst, assumed_align=16))
torch.cuda.synchronize()
print(MODE, "rank", RANK, sys.argv[3], "PASS" if torch.equal(src, dst) else "MISMATCH")

Expected behavior

The projected rank-2 case should compile and copy the tile. If this combination is unsupported, compilation should raise a catchable exception identifying the unsupported operation.

Environment details (please complete the following information):

  • Reported environment location: Docker (Kubernetes pod), Linux x86_64
  • NVIDIA B200, driver 580.95.05, CUDA 13.3
  • nvidia-cutlass-dsl 4.9.0.dev1, cuda-python 13.3.1
  • PyTorch 2.13.0a0+8145d630e8.nv26.06, Python 3.12.3

Additional context

For rank-2 inputs, cute.local_tile(t, (128, 64), (cta_m, cta_n)) works around the abort. The projection drops the third entry from both (128, 64, 1) and (cta_m, cta_n, None), so both calls select a tile with layout (128,64):(1,128) on these inputs.

The passing rank-3 case adds a trailing unit batch mode to both tensors and indexes it with cta_l in (cta_m, cta_n, None, cta_l).

Activity

  1. added
    bug
    on Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CuTe DSLbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions