Skip to content

[BUG]: tileiras crashes (SIGSEGV / heap corruption) compiling ct.argmax along axis 0 of an arange-built tile with num_ctas=2 #142

Open

Description

@lifang535

Version

9.9.99 (cutile-python main 25b3a13, built from source); the same crash with 1.8.1, 1.8.0 and 1.7.0 from pip

Version

13.5 (tileiras 13.5.37 from the nvidia-cuda-tileiras wheel); 13.4 (tileiras 13.4.92) also crashes, with a glibc heap-corruption abort

Which installation method(s) does this occur on?

Pip, Source

Describe the bug.

tileiras crashes while compiling a small kernel with num_ctas=2: a float tile built from ct.arange, ct.argmax along axis 0, and the tile used again:

x = ct.astype(ct.broadcast_to(ct.reshape(ct.arange(16, dtype=ct.int32), (16, 1)), (16, 8)), ct.float32)
r = ct.argmax(x, axis=0, keepdims=True)
ct.store(OUT, index=(0, 0), tile=x + ct.astype(r, ct.float32))

For sm_90, sm_100 and sm_120 at opt_level 1-3, compilation fails with CompilerExecutionError: Return code -11: tileiras 13.5.37 dies with SIGSEGV and prints nothing. tileiras 13.4.92 aborts with a glibc heap-corruption message instead (Return code -6, mremap_chunk(): invalid pointer or realloc(): invalid old size). I expected it to compile, as it does with num_ctas=1, with opt_level=0, for sm_89 and with axis=1 (num_ctas=4 and 8 crash too). The reproducer only compiles (export_kernel); no GPU is needed.

The defect appears to be in tileiras: the Tile IR looks ordinary (iota -> reshape -> broadcast -> itof, a two-operand reduce dim=0 whose index operand is a second broadcast iota, then addf), the num_ctas=1 and num_ctas=2 bytecode differ only in the num_cta_in_cga hint, and the tileiras command line crashes on the exported bytecode by itself (controls/tileiras_cli.py). I am filing it here because it is reached through ordinary cuTile code; please forward it to the tileiras team if appropriate.

Minimum reproducible example

"""tileiras crashes (SIGSEGV, or a glibc heap-corruption abort) compiling ct.argmax along axis 0 of a tile built from
ct.arange, with num_ctas=2 and opt_level >= 1, for sm_90 / sm_100 / sm_120.
Compile-only (export_kernel to a cubin); no GPU is needed."""
import io

import cuda.tile as ct
from cuda.tile.compilation import ArrayConstraint, CallingConvention, KernelSignature, export_kernel


@ct.kernel
def argmax_axis0(OUT):
    x = ct.astype(ct.broadcast_to(ct.reshape(ct.arange(16, dtype=ct.int32), (16, 1)), (16, 8)), ct.float32)
    r = ct.argmax(x, axis=0, keepdims=True)                      # (1, 8) int32
    ct.store(OUT, index=(0, 0), tile=x + ct.astype(r, ct.float32))


@ct.kernel
def argmax_axis1(OUT):                                            # control: the same, reduced along axis 1
    x = ct.astype(ct.broadcast_to(ct.reshape(ct.arange(16, dtype=ct.int32), (16, 1)), (16, 8)), ct.float32)
    r = ct.argmax(x, axis=1, keepdims=True)                      # (16, 1) int32
    ct.store(OUT, index=(0, 0), tile=x + ct.astype(r, ct.float32))


sig = KernelSignature([ArrayConstraint(ct.float32, 2, index_dtype=ct.int32, stride_lower_bound_incl=0,
                                       alias_groups=(), may_alias_internally=False)],
                      CallingConvention.cutile_python_v2())


def compile_(label, kernel=argmax_axis0, num_ctas=2, opt_level=3, arch='sm_90'):
    kernel = kernel.replace_hints(num_ctas=num_ctas, opt_level=opt_level)
    export_kernel(kernel, [sig], io.BytesIO(), gpu_code=arch, output_format='cubin')
    print(f'{label}: compiled', flush=True)


compile_('control: num_ctas=1', num_ctas=1)
compile_('control: argmax along axis 1', kernel=argmax_axis1)
compile_('control: opt_level=0', opt_level=0)
compile_('argmax along axis 0, num_ctas=2, opt_level=3, sm_90')   # tileiras crashes here

Relevant log output

$ python repro.py      # cutile-python main 25b3a13 + nvidia-cuda-tileiras 13.5.37
control: num_ctas=1: compiled
control: argmax along axis 1: compiled
control: opt_level=0: compiled
Traceback (most recent call last):
  ...
subprocess.CalledProcessError: Command '['.../nvidia/cu13/bin/tileiras', '/tmp/tmpsn_glrf4/argmax_axis064b82rll.bytecode', '-o', '/tmp/tmpsn_glrf4/argmax_axis064b82rll.cubin', '--gpu-name', 'sm_90', '-O3', '--lineinfo', ...]' died with <Signals.SIGSEGV: 11>.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "repro.py", line 38, in <module>
    compile_('argmax along axis 0, num_ctas=2, opt_level=3, sm_90')   # tileiras crashes here
  File "repro.py", line 31, in compile_
    export_kernel(kernel, [sig], io.BytesIO(), gpu_code=arch, output_format='cubin')
  ...
  File ".../cuda/tile/_compile.py", line 755, in run
    raise TileCompilerExecutionError(e.returncode, message, loc, ' '.join(flags),
cuda.tile._exception.CompilerExecutionError: Return code -11

Unknown location

$ python repro.py      # cuda-tile 1.8.1 + nvidia-cuda-tileiras 13.5.37 (pip): the same (1.8.0 too)
$ python repro.py      # cuda-tile 1.7.0 + nvidia-cuda-tileiras 13.4.92 (pip): the same controls, then SIGABRT:
cuda.tile._exception.CompilerExecutionError: Return code -6
mremap_chunk(): invalid pointer

Full env printout

Summary instead of the full print_env.sh output (compile-only):
cutile-python main 25b3a13 (source, cuda.tile.__version__ 9.9.99) + nvidia-cuda-tileiras 13.5.37: Python 3.11.18, Ubuntu 22.04.4, glibc 2.35
cuda-tile 1.8.1 and 1.8.0 + nvidia-cuda-tileiras 13.5.37 (pip): Python 3.11.16, same machine
cuda-tile 1.7.0 + nvidia-cuda-tileiras 13.4.92 (pip): Python 3.11.16, Ubuntu 24.04.4 (WSL2), glibc 2.39

Other/Misc.

  • What the crash needs (controls/variants.py, 22 variants, all compile with num_ctas=1): with num_ctas=2, every crashing variant has
    • a float x computed from an int32 ct.arange as long as axis 0 (like the index iota cuTile adds for the argmax) and converted after its reshape/broadcast, in either direction (x[i, j] = j on a 16x16 tile crashes too; another length or dtype compiles);
    • ct.argmax / ct.argmin of x along axis 0 (nothing along axis 1 crashed; ct.max compiles);
    • a later use of x.
  • It looks like heap corruption: under glibc malloc checking (LD_PRELOAD=libc_malloc_debug.so.0 MALLOC_CHECK_=3) tileiras 13.5.37 aborts with realloc(): invalid pointer, while num_ctas=1 and -O0 pass. Deterministic (5/5 repeats), not a stack overflow (ulimit -s unlimited changes nothing).
  • Not new in 13.5 (13.4.92 aborts too). Workarounds: num_ctas=1 or opt_level=0.
  • I found no report of this here or in NVIDIA/cuda-tile (searched argmax, argmin, num_ctas, realloc, mremap, heap corruption); the other tileiras SIGSEGV reports ([BUG]: tileiras SIGSEGV on aliased advanced-index load/store around reduction or matmul #94-[BUG]: tileiras SIGSEGV compiling dynamic MMA loops around a 128x64 panel #97, e.g. [BUG]: tileiras SIGSEGV when occupancy=2 is requested for a 32-wide fused tile kernel #96 occupancy=2) have different triggers.
  • attachment.zip: repro.py, the two control scripts, the disassembled Tile IR and the logs (three runs on main, 1.8.1, 1.8.0, 1.7.0, controls).

Contributing Guidelines

  • I agree to follow cuTile Python's contributing guidelines
  • I have searched the open bugs and have found no duplicates for this bug report

Activity

  1. added
    status: needs-triage
    on Nov 23, 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

    bugstatus: needs-triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions