Skip to content

cuTile: Tile::shape() fails during compilation to Tile IR #1843

Open

Description

@dzheltkov

On 8046b9e9, calling Tile::shape() from a kernel fails while compiling to Tile IR:

error: unrecognized macro `unreachable`

For example, this kernel sums each row of a matrix, clips negative sums to zero, and averages their squares. A 2×4 input gives a two-element intermediate tile and a scalar result. The zero tile should have the same shape as the row sums.

let sums: Tile<f32, { [M] }> = reduce_sum(matrix, 1);
let zero: Tile<f32, { [M] }> = constant(0.0f32, sums.shape());
let positive = max_tile(sums, zero);
let energy: Tile<f32, { [] }> = reduce_sum(positive * positive, 0);
let count: f32 = convert_scalar(sums.shape()[0]);
output.store((energy / scalar_to_tile(count)).reshape(shape![1]));

The public method contains an unconditional unreachable!(), and the JIT reaches it on a valid call. An intentionally unfinished method would be clearer with unimplemented!(...) in the source and a diagnostic naming the method. Here the dimensions are already available in D.

Reproduced on Linux with Rust 1.98.0 and no visible CUDA device. To reproduce on the base revision, apply only the regression test and run this command from cutile-rs/:

cargo test -p cutile --test tensor_and_matrix_ops compile_tile_shape -- --exact

Activity

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