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, S}Represents an N-dimensional array argument to a kernel with element type T and specialization S::ArraySpec.
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, Int32}: Size in each dimensionstrides::NTuple{N, Int32}: 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)may_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 a compile-time abstraction - at runtime in kernel code, tiles are represented as Tile IR values. The struct exists to enable proper type inference and operator dispatch.
Note: This is a mutable struct (despite having no fields) to prevent Julia's optimizer from treating it as a singleton. Each Tile instance represents a distinct Tile IR value, and we need SSA references to be preserved rather than being replaced with constant QuoteNodes.
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) # Int32Element 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.bytecode_version — Function
bytecode_version() -> VersionNumberThe Tile IR bytecode version that cuTile will emit by default. Either the highest version the current tileiras binary accepts (probed by emitting a minimal empty bytecode buffer at each entry of SUPPORTED_BYTECODE_VERSIONS newest-first and picking the first that compiles cleanly), or, if the bytecode_version preference is set, that value.
Result is cached for the lifetime of the process.
We probe rather than reading CUDA_Compiler_jll.cuda_version because users can override tileiras via JLL preferences, in which case the JLL's static cuda_version no longer reflects the actual binary's capabilities. Mirrors _get_max_supported_bytecode_version in cuTile Python's _compile.py.
cuTile.versioninfo — Function
versioninfo([io::IO=stdout])Print information about the active tileiras toolkit, the bytecode version cuTile.jl will emit for it, and any user overrides set via LocalPreferences.toml.