Essentials

Array and tile types

cuTile.TileArrayType
TileArray{T, N, I, S}

Represents an N-dimensional array argument to a kernel with element type T and index type I. I is Int32 unless an array size or stride requires Int64. S::ArraySpec holds layout specialization information.

Unlike raw pointers, TileArray carries size and stride information that is passed to the kernel as runtime parameters, enabling dynamic array sizes.

The specialization parameter S drives kernel compilation - different specializations (e.g., aligned vs unaligned) produce different cubins.

Fields

  • ptr::Ptr{T}: Base pointer to array data
  • sizes::NTuple{N, I}: Size in each dimension
  • strides::NTuple{N, I}: Stride in each dimension (in elements)
source
cuTile.ArraySpecType
ArraySpec{N}

Specialization hints for N-dimensional array arguments. Encoded as a type parameter to enable kernel specialization based on array properties.

Fields

  • alignment::Int: Base pointer alignment in bytes (0 = unknown)
  • contiguous::Bool: Whether stride[1] == 1 (contiguous in first dimension)
  • stride_div_by::NTuple{N,Int}: Per-dimension stride divisibility (0 = unknown)
  • shape_div_by::NTuple{N,Int}: Per-dimension shape divisibility (0 = unknown)
  • singleton::NTuple{N,Bool}: Axes whose size and stride are both one
  • may_alias_internally::Bool: Whether two distinct in-bounds indices may refer to the same memory location (e.g. a zero or repeated stride). false asserts the layout is internally non-overlapping, which enables optimizations such as loop-parallel stores; compute_array_spec derives it exactly from the runtime sizes/strides.

Common alignment values:

  • 0: Unknown/unaligned
  • 16: 16-byte aligned (enables basic vectorization)
  • 128: 128-byte aligned (optimal for TMA on Blackwell)

Divisibility values enable optimizations:

  • stride_div_by[i] = 4 means stride[i] is divisible by 4 (enables vectorized access)
  • shape_div_by[i] = 16 means shape[i] is divisible by 16 (no tile boundary handling needed)
source
cuTile.TileType
Tile{T, Shape}

Represents a tile of data with element type T and static shape Shape. Shape is a tuple type encoding the tile dimensions (e.g. Tuple{16, 32}).

This is an opaque handle like Ptr: tile data exists only as Tile IR values. The byte payload is never read; it keeps concrete tile types from becoming singletons so inference preserves distinct tile SSA values.

source
cuTile.ConstantType
Constant{T, V}

Zero-size launch wrapper that makes a kernel argument a compile-time constant. Construct one at the launch site; the kernel receives the wrapped value with its ordinary type.

function kernel(a, tile_size::Int)
    tile = ct.load(a; index=ct.bid(1), shape=(tile_size,))
    return
end

@cuda backend=cuTile blocks=grid kernel(a, ct.Constant(16))

The value is encoded in Constant's type and generates no runtime kernel parameter. Each distinct value produces a separate kernel specialization.

source
cuTile.similar_typeFunction
similar_type(::Type{T}, ::Type{U}) -> Type
similar_type(::Type{T}, ::Type{U}, new_shape::Tuple) -> Type

Reconstruct a Tile type with element type U, optionally reshaped to new_shape. A scalar type T maps to the scalar type U, so operations that must work uniformly on scalars and tiles can compute their result type without branching on which they were given.

similar_type(Tile{UInt32, Tuple{16}}, Int32)      # Tile{Int32, Tuple{16}}
similar_type(Tile{UInt32, Tuple{16}}, Int8, (32,)) # Tile{Int8, Tuple{32}}
similar_type(Float32, Int32)                       # Int32
source
cuTile.indextypeFunction
indextype(array_or_type)

Return the integer type used for a TileArray's sizes, strides, and address calculations.

source

Element types

cuTile.TFloat32Type
TFloat32 <: AbstractFloat

Tensor Float 32 - a 32-bit floating-point type optimized for tensor core operations. Has the same range as Float32 (8 exponent bits) but reduced precision (10 mantissa bits).

Convert Float32 tiles to TFloat32 for tensor core acceleration:

a = ct.load(A, (bid_m, k), (tm, tk))
a_tf32 = convert(ct.Tile{ct.TFloat32}, a)

Note: This is a compile-time only type for Tile IR code generation.

source
cuTile.bitwidthFunction
bitwidth(::Type{T}) -> Int

Number of bits a single element of T occupies in a Tile IR tile. Used by the whole-tile reinterpret to scale the tile shape across a change of element width (e.g. UInt8Float4_E2M1FN, 8 bits ↔ 4 bits).

The default is 8 * sizeof(T), which is correct for the standard integer and floating-point types and for the byte-wide Float8_* formats. Sub-byte formats whose sizeof rounds up to a whole byte (e.g. Float4_E2M1FN, 4 bits but sizeof == 1) override this; the Microfloats extension forwards to Microfloats.bitwidth, which derives the true width from the format's bit fields. Matches the bitwidth convention used by Microfloats/Narrow.

source

Toolchain

cuTile.tileiras_versionFunction
tileiras_version() -> VersionNumber

Version of the selected tileiras executable. The executable is resolved and queried lazily, once per process.

source
cuTile.bytecode_versionFunction
bytecode_version() -> VersionNumber

The validated Tile IR bytecode version emitted by default. This is either the highest version accepted by the selected tileiras, or the bytecode_version preference after checking that both cuTile and tileiras support it.

source
cuTile.versioninfoFunction
versioninfo([io::IO=stdout])

Print information about the active tileiras, the bytecode version cuTile.jl will emit for it, and any user overrides set via LocalPreferences.toml.

source