Essentials
Array and tile types
cuTile.AbstractTileArray — Type
AbstractTileArray{T, N}Supertype for N-dimensional kernel array arguments with element type T.
cuTile.TileArray — Type
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 datasizes::NTuple{N, I}: Size in each dimensionstrides::NTuple{N, I}: Stride in each dimension (in elements)
cuTile.ArraySpec — Type
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 onemay_alias_internally::Bool: Whether two distinct in-bounds indices may refer to the same memory location (e.g. a zero or repeated stride).falseasserts the layout is internally non-overlapping, which enables optimizations such as loop-parallel stores;compute_array_specderives 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] = 4meansstride[i]is divisible by 4 (enables vectorized access)shape_div_by[i] = 16meansshape[i]is divisible by 16 (no tile boundary handling needed)
cuTile.Tile — Type
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.
cuTile.Constant — Type
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.
cuTile.similar_type — Function
similar_type(::Type{T}, ::Type{U}) -> Type
similar_type(::Type{T}, ::Type{U}, new_shape::Tuple) -> TypeReconstruct 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) # Int32cuTile.indextype — Function
indextype(array_or_type)Return the integer type used for a TileArray's sizes, strides, and address calculations.
Element types
cuTile.TFloat32 — Type
TFloat32 <: AbstractFloatTensor 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.
cuTile.bitwidth — Function
bitwidth(::Type{T}) -> IntNumber 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. UInt8 ↔ Float4_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.
cuTile.ScalarInt — Type
Scalar integer types supported by Tile IR (i8, i16, i32, i64).
cuTile.ScalarFloat — Type
Scalar floating-point types supported by Tile IR (f16, bf16, tf32, f32, f64).
cuTile.IntTile — Type
Integer tile types.
cuTile.FloatTile — Type
Floating-point tile types.
cuTile.TileOrScalar — Type
Scalar or tile of element type T.
cuTile.TileOrInt — Type
Integer values (scalar or tile).
cuTile.TileOrFloat — Type
Floating-point values (scalar or tile).
Toolchain
cuTile.tileiras_version — Function
tileiras_version() -> VersionNumberVersion of the selected tileiras executable. The executable is resolved and queried lazily, once per process.
cuTile.bytecode_version — Function
bytecode_version() -> VersionNumberThe 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.
cuTile.versioninfo — Function
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.