Skip to content

[BUG]: tileiras 13.4 emits misaligned f16 loads with reshape/broadcast on sm_89 #1479

Open

Description

@hhdri

Description

With cutile 0.4.0 on an RTX 4060 (sm_89), the f16-only kernel below succeeds with tileiras 13.3 (V13.3.36) and fails with a misaligned global-memory read with tileiras 13.4 (V13.4.92).

It loads an 8×32 tile, repeats each element using reshape/broadcast, reshapes to 8×64, and multiplies by a broadcast 1×64 row. The internal compiler cause has not been isolated, but byte-for-byte identical Tile IR bytecode succeeds with 13.3 and fails with 13.4, using the same --gpu-name sm_89 --opt-level 3 options.

Minimal reproduction

Cargo.toml:

[package]
name = "tileiras-repro"
version = "0.1.0"
edition = "2021"

[dependencies]
cutile = "=0.4.0"
half = "=2.7.1"

src/main.rs:

use cutile::prelude::*;
use half::f16;

#[cutile::module]
mod gpu {
    use cutile::core::*;

    #[cutile::entry()]
    pub fn repro(
        y: &mut Tensor<f16, { [8, 64] }>,
        x: &Tensor<f16, { [8, 32] }>,
        s: &Tensor<f16, { [1, 64] }>,
    ) {
        let v = x.load_tile(shape![8, 32], [0, 0]).reshape(shape![256, 1]);
        let pairs = v.broadcast(shape![256, 2]);
        let scale = s.load_tile(shape![1, 64], [0, 0]).broadcast(shape![8, 64]);
        y.store(pairs.reshape(shape![8, 64]) * scale);
    }
}

fn main() {
    let device = Device::new(0).unwrap();
    let stream = device.new_stream().unwrap();
    let got = gpu::repro(
        api::zeros::<f16>(&[8, 64]).partition([8, 64]),
        api::ones::<f16>(&[8, 32]),
        api::full(f16::from_f32(0.5), &[1, 64]),
    )
    .first().unpartition().to_host_vec()
    .sync_on(&stream).unwrap();
    assert!(got.iter().all(|v| v.to_f32() == 0.5));
    println!("All {} values equal 0.5", got.len());
}

Build once, then run in separate processes. Substitute the installed path to the 13.3 assembler:

CUDA_HOME=/opt/cuda CUDA_TOOLKIT_PATH=/opt/cuda cargo build --release

# Fails with error 716.
CUTILE_TILEIRAS_PATH=/opt/cuda/bin/tileiras \
CUTILE_BYTECODE_VERSION=13.3 \
./target/release/tileiras-repro

# Passes; replace this path with your tileiras 13.3 binary.
CUTILE_TILEIRAS_PATH=/path/to/tileiras-13.3 \
CUTILE_BYTECODE_VERSION=13.3 \
./target/release/tileiras-repro

# Inspect the failing kernel.
CUTILE_TILEIRAS_PATH=/opt/cuda/bin/tileiras \
CUTILE_BYTECODE_VERSION=13.3 \
/opt/cuda/bin/compute-sanitizer --tool memcheck --print-limit 0 \
./target/release/tileiras-repro

Expected behavior

Every output should equal 0.5: the input contains ones and the row contains 0.5. The program checks all 512 values. On tileiras 13.3 it prints:

All 512 values equal 0.5

Memcheck reports zero errors on 13.3.

Actual behavior

Without memcheck, the program fails during GPU execution, surfaced by .sync_on(&stream):

called `Result::unwrap()` on an `Err` value: Driver(DriverError(716, "misaligned address"))

A fresh memcheck run of the reduced reproduction above reports:

========= Invalid __global__ read of size 4 bytes
=========     at repro_entry+0x110
=========     by thread (32,0,0) in block (0,0,0)
=========     Access to 0x700000602 is misaligned
=========     and is inside the nearest allocation at 0x700000600 of size 128 bytes

The 128-byte allocation matches the f16 row input. Reported offsets are 0x2, 0xa, 0x12, ..., 0x7a: all are 2 modulo 4, so these 4-byte reads are misaligned. This run reports 128 invalid reads plus 15 subsequent CUDA API error reports, 143 errors total. Under memcheck, the application returns error 719 (unspecified launch failure). The uninstrumented failure is error 716.

The 13.4 cubin disassembly at the reported PC contains:

/*0110*/ LDG.E R13, [R4.64+0x2];

The 13.3 cubin uses a 16-bit LDG.E.U16 for the row load.

Assembler/bytecode comparison

These results are for the reduced reproduction above, starting a fresh process for each run. It does not enable cutile's optional persistent cubin cache.

Assembler CUTILE_BYTECODE_VERSION Result
13.4 unset (negotiates 13.4) DriverError 716
13.4 13.4 DriverError 716
13.4 13.3 DriverError 716
13.4 13.2 DriverError 716
13.3 unset (negotiates 13.3) All 512 values correct
13.3 13.3 All 512 values correct
13.3 13.2 All 512 values correct

I captured the bytecode passed to each assembler. For each fixed bytecode version, the repro_entry module is byte-for-byte identical between the 13.3 and 13.4 assembler runs. For example, the captured 13.3 bytecode has SHA-256:

94ba8e24393bee83359534fb852865a0789a3f714d279df14707808901a3a5bf

This identifies the captured artifact; rebuilding in another source directory may change embedded debug information. CUTILE_DUMP=bytecode confirms the selected format version; it does not decode function-body instructions.

Additional context

Originally encountered in a Q4 GEMM with nibble extraction, conversion to f16, and cat/reshape. The reproduction above removes the nibble operations, cat, the additive offset input, and the GEMM loop.

A plain f16 tile multiplied by a broadcast row passes on 13.4. In the larger 32×64 variant, loading the duplicated input directly as a [1024, 1] tile instead of loading [32, 32] and reshaping also passes on 13.4. The failing pattern is sensitive to the input tile layout; I am not claiming all f16 broadcasts are broken.

Environment

  • OS: Omarchy, kernel 7.2.8-5-omarchy-bore.
  • GPU: NVIDIA GeForce RTX 4060, sm_89. Other GPU architectures have not been tested.
  • NVIDIA driver: 615.78.08.
  • CUDA toolkit: 13.4.2 (Arch package 13.4.2-1).
  • Failing tileiras: release 13.4, V13.4.92, built Tue_Sep__1_09:35:26_PDT_2026; lists bytecode 13.1–13.4.
  • Passing tileiras: release 13.3, V13.3.36, built Fri_May__1_20:03:54_PDT_2026; lists bytecode 13.1–13.3.
  • Compute Sanitizer: 2026.3.0.0, build 38855100.
  • Rust: rustc 1.99.0 (b940084d7 2026-09-28), x86_64-unknown-linux-gnu.
  • Crates: cutile 0.4.0, half 2.7.1.

This uses the Tile JIT path (Rust → Tile IR bytecode → cubin). It does not emit .ll or .ptx files or use cargo oxide/llc. NVlabs/cutile-rs is archived; cutile-rs is now part of this repository.

Activity

  1. changed the title [-][BUG]: tileiras 13.4 misaligned f16 load when a 1x64 broadcast sits next to a nibble unpack[/-] [+][BUG]: tileiras 13.4 emits misaligned f16 loads with reshape/broadcast on sm_89[/+] on Oct 10, 2026
  2. hhdri commented on Oct 10, 2026

    @hhdri
    Author

    Compiler-side follow-up: NVIDIA/cuda-tile#26

    That report includes the self-contained reproduction, exact captured Tile IR 13.3 bytecode, assembler comparison, and additional alignment-hint experiments. Keeping this issue as the Rust-side tracker; the alignment cap is a temporary mitigation, and the requested fix is in the compiler.

  3. added
    cutile-rs
    on Nov 12, 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

    cutile-rs

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions