Skip to content

[BUG]: tileiras 13.5.37 crashes (SIGSEGV, "Return code -11") compiling ct.cumsum along the middle axis of an arange-derived tile after a sum and a flip; 13.4.92 compiles it #136

Open

Description

@lifang535

Version

1.8.0 (also cutile-python main 5fe1aef)

Version

13.5 (tileiras 13.5.37 from the nvidia-cuda-tileiras wheel; 13.4.92 compiles the same program)

Which installation method(s) does this occur on?

Pip

Describe the bug.

tileiras 13.5.37 crashes with a segmentation fault (CompilerExecutionError: Return code -11, "Unknown location", no diagnostic) when compiling a small 3-D tile program:

  1. x is a (2, 16, 4) float32 tile computed from ct.arange ((2i + 3j + 4k) % 7 - 3, then ct.astype);
  2. x = x + ct.sum(x, axis=1, keepdims=True);
  3. axis 1 is reversed by reshaping to (2, 2, 2, 2, 2, 4) and swapping halves with ct.extract / ct.cat on axes 1-4, then reshaping back;
  4. ct.cumsum(x, axis=1) (forward or reverse=True).

The crash happens for sm_80, sm_89, sm_90, sm_100 and sm_120 and at opt_level 0 and 3 (controls/targets.py, compile-only). With tileiras 13.4.92 (same cuda-tile 1.8.0) the program compiles and the result is correct. Each ingredient is needed: loading the same values from memory instead of computing them from ct.arange, dropping the ct.sum, dropping the flip, dropping the scan, or scanning axis 0 or 2 all compile and give the correct result.

The crash is inside the tileiras process, so I am filing it here because it is reached through ordinary cuTile code; please forward it to the tileiras team if appropriate. It may be related to a separate report about wrong ct.cumsum results along the middle axis with 13.5.37 (a silent wrong result for simpler programs); here the program does not get that far.

How the kernels were run (please read): cuda-tile 1.8.0 requires a CUDA 13 driver, and the machine has a CUDA 12.6 driver (560.35.03). The launches therefore went through a small in-process loader, installed before cuda.tile is imported, that reports a CUDA 13 driver version to cuTile, rewrites only the ELF header fields of the CUDA 13 cubins (OSABI, ABI version, e_flags) so the 12.6 driver accepts them, and launches with the kernel's required block size. The crash itself happens during compilation and does not depend on the loader (controls/targets.py only compiles).

Minimum reproducible example

"""tileiras 13.5.37 crashes (SIGSEGV, "Return code -11") compiling a 3-D tile program that ends in ct.cumsum along
the middle axis of a tile computed from ct.arange; tileiras 13.4.92 compiles it and the result is correct.

The program: x + ct.sum(x, axis=1, keepdims=True), then flip axis 1 through a reshape to 6-D and extract/cat swaps,
reshape back, then ct.cumsum(x, axis=1). Each variant is launched once; a compiler crash is caught and reported."""
import importlib.metadata as md
import torch
import cuda.tile as ct

C = ct.Constant[int]


@ct.kernel
def sum_flip_cumsum(X, OUT, ARANGE: C, SUM: C, FLIP: C, SCAN: C, AXIS: C, REVERSE: ct.Constant[bool]):
    if ARANGE:  # the tile is computed from ct.arange (values (2i + 3j + 4k) % 7 - 3, as float32)
        x = ct.astype(ct.broadcast_to(ct.reshape(ct.arange(2, dtype=ct.int32), (2, 1, 1)) * 2
                                      + ct.reshape(ct.arange(16, dtype=ct.int32), (1, 16, 1)) * 3
                                      + ct.reshape(ct.arange(4, dtype=ct.int32), (1, 1, 4)) * 4, (2, 16, 4)) % 7 - 3,
                      ct.float32)
    else:       # the same values, loaded from X
        x = ct.load(X, index=(0, 0, 0), shape=(2, 16, 4))
    if SUM:
        x = x + ct.sum(x, axis=1, keepdims=True)
    if FLIP:  # reverse axis 1 (length 16): view as (2, 2, 2, 2, 2, 4) and swap the halves of axes 1..4
        x = ct.reshape(x, (2, 2, 2, 2, 2, 4))
        lo = ct.extract(x, (0, 0, 0, 0, 0, 0), (2, 1, 2, 2, 2, 4))
        hi = ct.extract(x, (0, 1, 0, 0, 0, 0), (2, 1, 2, 2, 2, 4))
        x = ct.cat((hi, lo), axis=1)
        lo = ct.extract(x, (0, 0, 0, 0, 0, 0), (2, 2, 1, 2, 2, 4))
        hi = ct.extract(x, (0, 0, 1, 0, 0, 0), (2, 2, 1, 2, 2, 4))
        x = ct.cat((hi, lo), axis=2)
        lo = ct.extract(x, (0, 0, 0, 0, 0, 0), (2, 2, 2, 1, 2, 4))
        hi = ct.extract(x, (0, 0, 0, 1, 0, 0), (2, 2, 2, 1, 2, 4))
        x = ct.cat((hi, lo), axis=3)
        lo = ct.extract(x, (0, 0, 0, 0, 0, 0), (2, 2, 2, 2, 1, 4))
        hi = ct.extract(x, (0, 0, 0, 0, 1, 0), (2, 2, 2, 2, 1, 4))
        x = ct.cat((hi, lo), axis=4)
        x = ct.reshape(x, (2, 16, 4))
    if SCAN:
        x = ct.cumsum(x, axis=AXIS, reverse=REVERSE)
    ct.store(OUT, index=(0, 0, 0), tile=x)


def reference(x, s, f, scan, axis, rev):
    if s:
        x = x + x.sum(1, keepdim=True)
    if f:
        x = x.flip(1)
    if scan:
        x = torch.cumsum(x.flip(axis), axis).flip(axis) if rev else torch.cumsum(x, axis)
    return x


def run(name, a=1, s=1, f=1, scan=1, axis=1, rev=1):
    i, j, k = torch.meshgrid(torch.arange(2), torch.arange(16), torch.arange(4), indexing='ij')
    x = ((2 * i + 3 * j + 4 * k) % 7 - 3).float().cuda()
    out = torch.full_like(x, -999.0)
    try:
        ct.launch(torch.cuda.current_stream(), (1, 1, 1), sum_flip_cumsum, (x, out, a, s, f, scan, axis, bool(rev)))
        torch.cuda.synchronize()
        bad = int((out != reference(x, s, f, scan, axis, rev)).sum())
        res = 'OK' if bad == 0 else f'WRONG {bad}/128'
    except Exception as exc:
        msg = ' '.join(str(exc).split())
        res = f'{type(exc).__name__}: {msg[:90]}'
    print(f'{name:52s} {res}', flush=True)


print(f'cuda-tile {md.version("cuda-tile")}, nvidia-cuda-tileiras {md.version("nvidia-cuda-tileiras")} |',
      torch.cuda.get_device_name())
run('arange tile: sum + flip + cumsum(axis=1, reverse)')
run('arange tile: sum + flip + cumsum(axis=1)', rev=0)
print('-- controls')
run('loaded tile (same values): sum + flip + cumsum(axis=1, reverse)', a=0)
run('arange tile, no sum: flip + cumsum(axis=1, reverse)', s=0)
run('arange tile, no flip: sum + cumsum(axis=1, reverse)', f=0)
run('arange tile, no scan: sum + flip', scan=0)
run('arange tile: sum + flip + cumsum(axis=0, reverse)', axis=0)
run('arange tile: sum + flip + cumsum(axis=2, reverse)', axis=2)

Relevant log output

$ python repro.py      # cuda-tile 1.8.0 + nvidia-cuda-tileiras 13.5.37
cuda-tile 1.8.0, nvidia-cuda-tileiras 13.5.37 | NVIDIA vGPU-32GB
arange tile: sum + flip + cumsum(axis=1, reverse)    CompilerExecutionError: Return code -11 Unknown location
arange tile: sum + flip + cumsum(axis=1)             CompilerExecutionError: Return code -11 Unknown location
-- controls
loaded tile (same values): sum + flip + cumsum(axis=1, reverse) OK
arange tile, no sum: flip + cumsum(axis=1, reverse)  OK
arange tile, no flip: sum + cumsum(axis=1, reverse)  OK
arange tile, no scan: sum + flip                     OK
arange tile: sum + flip + cumsum(axis=0, reverse)    OK
arange tile: sum + flip + cumsum(axis=2, reverse)    OK

$ python repro.py      # cuda-tile 1.8.0 + nvidia-cuda-tileiras 13.4.92: every line OK
$ python repro.py      # cutile-python main 5fe1aef + tileiras 13.5.37: same as 1.8.0 + 13.5.37

$ python controls/targets.py      # 1.8.0 + 13.5.37, compile-only
-- compile-only
sm_80  opt 0: CompilerExecutionError: Return code -11 Unknown location
sm_80  opt 3: CompilerExecutionError: Return code -11 Unknown location
sm_89  opt 0: CompilerExecutionError: Return code -11 Unknown location
sm_89  opt 3: CompilerExecutionError: Return code -11 Unknown location
sm_90  opt 0: CompilerExecutionError: Return code -11 Unknown location
sm_90  opt 3: CompilerExecutionError: Return code -11 Unknown location
sm_100 opt 0: CompilerExecutionError: Return code -11 Unknown location
sm_100 opt 3: CompilerExecutionError: Return code -11 Unknown location
sm_120 opt 0: CompilerExecutionError: Return code -11 Unknown location
sm_120 opt 3: CompilerExecutionError: Return code -11 Unknown location

$ python controls/targets.py      # 1.8.0 + 13.4.92
-- compile-only
sm_80  opt 0: compiled
sm_80  opt 3: compiled
sm_89  opt 0: compiled
sm_89  opt 3: compiled
sm_90  opt 0: compiled
sm_90  opt 3: compiled
sm_100 opt 0: compiled
sm_100 opt 3: compiled
sm_120 opt 0: compiled
sm_120 opt 3: compiled

Full env printout

Summary instead of the full print_env.sh output:
OS: Ubuntu 22.04.4 LTS, x86_64
GPU: NVIDIA vGPU-32GB (sm_89), driver 560.35.03 (CUDA 12.6)
Python 3.11.16
cuda-tile 1.8.0, nvidia-cuda-tileiras 13.5.37 (crashes) / 13.4.92 (compiles), pip
torch 2.4.0+cu124

Other/Misc.

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