Skip to main content
The CuTe DSL provides Python decorators to define GPU kernels and JIT-compiled host functions. These decorators transform Python functions into CUDA kernels or optimized host code.

Decorators

@cute.kernel

Defines a GPU kernel function that will be JIT-compiled and executed on the device.
cute.Tensor
Input tensor A
cute.Tensor
Input tensor B
cute.Tensor
Output tensor C
cute.Shape
Shape of the tensors
cute.Layout
Thread layout for partitioning
cute.Layout
Value layout for vectorization
Launching Kernels:

@cute.jit

Defines a JIT-compiled host function that can call GPU kernels.
cute.Tensor
Input tensor A
cute.Tensor
Input tensor B
cute.Tensor
Output tensor C
cuda.CUstream
CUDA stream for execution

Launch Configuration

Kernel launches use the .launch() method with grid and block dimensions:
tuple[int, int, int]
Grid dimensions (number of thread blocks in x, y, z)
tuple[int, int, int]
Block dimensions (number of threads per block in x, y, z)
int
default:"None"
Shared memory size in bytes (auto-calculated if None)
cuda.CUstream
default:"default stream"
CUDA stream for asynchronous execution

Compile-Time Constants

Use cutlass.Constexpr for values known at compile time:

Thread and Block Indexing

Access CUDA thread and block indices within kernels:

Complete Example

See Also