Skip to content

[BUG]: TensorView::view drops the slice offset from its alignment spec, causing error 716 #1540

Closed

Description

@younes-io

Description

TensorView::view rebuilds the specialization from the allocation's base pointer and leaves out the view's offset_bytes, while the kernel receives base + offset_bytes. When a slice starts off a 16-byte boundary and is then reshaped with .view(...), the spec claims 16-byte alignment (base_ptr_div = 16), the JIT emits vectorized loads, and the launch fails. Tensor::slice and TensorView::slice already add the offset; only view misses it.

Error / actual behavior

DriverError(716, "misaligned address")

Expected behavior

The view keeps the slice's real alignment (base_ptr_div = 4 for a one-element f32 offset) and the copy succeeds.

Minimal reproduction example

// entry: fn copy_32x32(output: &mut Tensor<f32, {[32, 32]}>, input: &Tensor<f32, {[-1, -1]}>)
//        { let t: Tile<f32, {[32, 32]}> = load_tile_like(input, output); output.store(t); }
let n = 128 * 128;
let tensor = api::arange::<f32>(n + 16).sync()?;
let viewed = tensor.slice(&[1..1 + n])?.view(&[128, 128])?;
assert_eq!(viewed.spec().base_ptr_div.divisor, 16); // should be 4
let out = api::zeros::<f32>(&[128, 128]).sync()?;
copy_32x32(out.partition([32, 32]), &viewed).sync()?; // error 716

Operating System

Arch-based Linux (Omarchy)

GPU and GPU Architecture

RTX 4070 Ti SUPER (sm_89)

CUDA driver version

615.78.08 (tileiras 13.4, V13.4.92)

Additional context

Root cause is at cutile-rs/cutile/src/tensor.rs:1482. The spec is also part of the kernel cache key, so a misaligned view shares a compiled kernel with the aligned case. This is distinct from #1479, where identical bytecode fails only with tileiras 13.4.

Activity

  1. added a commit that references this issue on Oct 30, 2026
    b29169a
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions