Pidoku

The New Kernel Languages: CuTe DSL, Triton/Gluon, TileLang, ThunderKittens

Module 25 Lesson 25.d 1h 15m Difficulty 4/5

Prerequisites 25.a, 25.b, 25.c, 6.e


Before you start: words you need#

WordPlain meaning
DSLDomain-specific language: a small language (here usually embedded in Python or C++) for one job — writing GPU kernels.
Block-level / tile-levelThe programmer writes code for one tile of data processed by one CTA, and the compiler decides which thread does what.
Thread-levelThe programmer writes code for one thread (CUDA C++) and arranges cooperation by hand.
JITJust-in-time compilation: the kernel is compiled the first time it is called with a given set of shapes and types, then cached.
MLIRA compiler framework of stacked “dialects” from high level to machine level. Triton, CuTe DSL, TileLang’s newer stack and cuTile all lower through it.
Layout (in a DSL)How a tile’s elements are assigned to threads, registers or shared-memory addresses (25.c). Who chooses it is the main difference between the languages.
AutotuningTrying many configurations (tile sizes, stages, warps) on the real GPU and keeping the fastest (25.l).

1. What is it?#

Between “write CUDA C++ by hand” and “call cuBLAS” there are now half a dozen serious languages for writing fast kernels. They differ mainly in how much of the hardware machine of 25.a–25.b the programmer controls:

Language (Nov 2026)OwnerYou writeThe compiler decidesHardware
Helion 1.5.2PyTorchPyTorch ops over tilestile sizes, layouts, pipelining, even backend (autotuned)Triton, CuTe DSL, TileIR, Pallas, Metal and FlyDSL backends
Triton 3.9.0OpenAI and communityblock-level program with tl.load, tl.dotlayouts, shared memory, pipelining, (optional) warp specialisationNVIDIA, AMD, others via plugins
cuTile Python (cuda-tile 1.8.1)NVIDIAtile-level Python over Tile IRthread mapping, layoutsAmpere, Ada, Blackwell (PyPI page: Hopper “coming”)
TileLang 0.1.15tile-ai (Peking University, Microsoft Research and others)tiles, T.copy, T.gemm, T.Pipelinedthread mapping and layouts (overridable)NVIDIA, AMD, Apple Metal, Ascend, CPU
Gluon (in Triton 3.9)TritonTriton plus explicit layouts, shared/tensor memory, mbarriers, warp partitionsinstruction selectionNVIDIA Hopper/Blackwell, AMD CDNA
ThunderKittens 2.0Stanford Hazy ResearchC++ tiles (st_bf<64,64>, rt_fl<16,…>) and a load–compute–store templatealmost nothing hidden; it is a CUDA header libraryNVIDIA (HipKittens for AMD)
CuTe DSL (CUTLASS 4.8.1)NVIDIAlayouts, atoms, pipelines, warp rolesonly lowering to PTXNVIDIA Ampere → Rubin

Read the table from top to bottom as “more automatic” to “more explicit”. Lesson 6.e taught the basics of Triton; this lesson is about choosing and reading the others.

Facts checked on 13 November 2026 (versions from PyPI and GitHub releases).


2. Why does it exist?#

Because the hardware moved faster than the compilers.

  • Triton’s model hides the things that now matter most. Triton chooses layouts and pipelining itself. On Ampere that was enough to match cuBLAS for many shapes. On Hopper and Blackwell, peak performance needs TMA, mbarrier rings, warp specialisation and TMEM (25.a, 25.b), and an automatic compiler does not always find the right arrangement.
  • CUDA C++ with CUTLASS templates is powerful but slow to write and slow to compile. A new attention variant in C++ templates is weeks of expert work and minutes of compile time per configuration.
  • New hardware, new formats, every year. FP4 with block scales, CTA pairs, Rubin’s larger TMEM — each needs new kernels quickly. Python DSLs with JIT compilation iterate in seconds.

The result is a ladder. Teams start high (Helion, Triton), and drop a level only for the few kernels that dominate the profile. In inference those are GEMMs, attention, MoE and communication kernels — the topics of 25.e–25.i.


3. Simple analogy#

Cooking with increasingly professional kitchens:

  • Helion / Triton: a meal kit. You say “sear, then simmer”; the kit picks pans and timings. Great results for most dishes, quickly.
  • TileLang / cuTile: a well-equipped home kitchen. You choose the steps and the pans; the kitchen arranges where everything sits.
  • Gluon / ThunderKittens: a professional line where you also choose the station layout and who stands where, but with good standard tools.
  • CuTe DSL / CUTLASS: building the kitchen. Every shelf and every handoff is yours to design.

4. Tiny example: one idea in five languages#

Helion: a matmul with no tile sizes at all (from Helion’s README). The autotuner chooses them.

Python
import torch, helion, helion.language as hl

@helion.kernel()
def matmul(x: torch.Tensor, y: torch.Tensor) -> torch.Tensor:
    m, k = x.size()
    k, n = y.size()
    out = torch.empty([m, n], dtype=x.dtype, device=x.device)
    for tile_m, tile_n in hl.tile([m, n]):          # becomes the grid
        acc = hl.zeros([tile_m, tile_n], dtype=torch.float32)
        for tile_k in hl.tile(k):                    # becomes the K loop
            acc = torch.addmm(acc, x[tile_m, tile_k], y[tile_k, tile_n])
        out[tile_m, tile_n] = acc
    return out

TileLang: you choose tiles and stages; it chooses thread mapping (from TileLang’s README).

Python
import tilelang
import tilelang.language as T

@tilelang.jit
def matmul_relu(A, B, block_M: int = 128, block_N: int = 128, block_K: int = 32):
    M, N, K = T.const("M, N, K")
    A: T.Tensor((M, K), T.float16)
    B: T.Tensor((K, N), T.float16)
    C = T.empty((M, N), T.float16)
    with T.Kernel(T.ceildiv(N, block_N), T.ceildiv(M, block_M), threads=128) as (bx, by):
        A_shared = T.alloc_shared((block_M, block_K), T.float16)
        B_shared = T.alloc_shared((block_K, block_N), T.float16)
        C_local = T.alloc_fragment((block_M, block_N), T.float32)
        T.clear(C_local)
        for k in T.Pipelined(T.ceildiv(K, block_K), num_stages=3):   # software pipeline
            T.copy(A[by * block_M, k * block_K], A_shared)
            T.copy(B[k * block_K, bx * block_N], B_shared)
            T.gemm(A_shared, B_shared, C_local)
        for i, j in T.Parallel(block_M, block_N):
            C_local[i, j] = T.max(C_local[i, j], 0)                  # fused ReLU epilogue
        T.copy(C_local, C[by * block_M, bx * block_N])
    return C

cuTile Python: tiles as values (from the cuda-tile package description).

Python
import cuda.tile as ct

TILE_SIZE = 16

@ct.kernel
def vector_add_kernel(a, b, result):
    block_id = ct.bid(0)
    a_tile = ct.load(a, index=(block_id,), shape=(TILE_SIZE,))
    b_tile = ct.load(b, index=(block_id,), shape=(TILE_SIZE,))
    ct.store(result, index=(block_id,), tile=a_tile + b_tile)

ThunderKittens: a C++ header library; types say which memory a tile lives in (st_ shared, rt_ registers) and the template supplies the producer/consumer structure (excerpt from its README’s H100 GEMM):

C++
using namespace kittens;
using namespace kittens::prototype::lcf;          // load-compute-finish template
struct matmul_layout {
    using  base_tile      = st_bf<64, 64>;               // 64x64 BF16 tile in shared memory
    using  global_layout  = gl<bf16, 1, 1, -1, -1, base_tile>;
    struct globals        { global_layout A, B, C; };
    struct input_block    { base_tile a[2], b[4]; };     // one pipeline stage
    struct consumer_state { rt_fl<16, 4*64> accum; };    // FP32 accumulator in registers
};
// ... then producer::load(...) issues TMA, consumer::compute(...) issues warpgroup MMAs

CuTe DSL: everything explicit, down to the copy atom and the thread–value layout (from CUTLASS’s elementwise_add_autotune.py, abridged):

Python
import cutlass, cutlass.cute as cute

@cute.kernel
def elementwise_add_kernel(gA, gB, gC, cC, shape, thr_layout, val_layout):
    tidx, _, _ = cute.arch.thread_idx()
    bidx, _, _ = cute.arch.block_idx()
    blkA, blkB, blkC = gA[((None, None), bidx)], gB[((None, None), bidx)], gC[((None, None), bidx)]
    atom = cute.make_copy_atom(cute.nvgpu.CopyUniversalOp(), gA.element_type)
    tiled = cute.make_tiled_copy_tv(atom, thr_layout, val_layout)   # who copies what
    thr = tiled.get_slice(tidx)
    frgA = cute.make_rmem_tensor_like(thr.partition_S(blkA))
    frgB = cute.make_rmem_tensor_like(thr.partition_S(blkB))
    cute.copy(atom, thr.partition_S(blkA), frgA)
    cute.copy(atom, thr.partition_S(blkB), frgB)
    frgA.store(frgA.load() + frgB.load())
    cute.copy(atom, frgA, thr.partition_S(blkC))

The Gluon version of a Blackwell matmul is in 25.a, and its warp-specialised form in 25.b.


5. Technical explanation#

What each language makes you decide#

DecisionHelionTritonTileLangGluonThunderKittensCuTe DSL
Tile sizesautotunedyou (or autotune)youyouyouyou
Register/shared layoutscompilercompilercompiler, overridable (T.annotate_layout)youlibrary typesyou
Software pipelinecompilernum_stagesT.Pipelined(num_stages=)you (barriers)templateyou (pipeline objects)
Warp specialisationautotuned flagautomatic (opt-in)automatic (2026)you (gl.warp_specialize)templateyou
TMA / TMEM / CTA pairsvia backendpartly automatic (tl.make_tensor_descriptor)T.tma_copy, two-SM supportyouyouyou

Triton and Gluon#

Triton (6.e) compiles a block-level program through Triton IR → TritonGPU IR (where layouts and pipelining are decided) → LLVM → PTX or AMDGCN. On Hopper and Blackwell, recent releases use TMA through tensor descriptors and can warp-specialise tl.range(..., warp_specialize=True) loops.

Gluon is the same compiler entered one level lower: you write TritonGPU-level code with explicit layouts (BlockedLayout, NVMMASharedLayout), explicit shared and tensor memory (allocate_shared_memory, allocate_tensor_memory), explicit mbarriers and explicit warp partitions. Triton 3.9.0 (27 October 2026) added gl.inline_asm, cache-policy hints and offline compilation of Gluon IR. Gluon is the language of choice for teams already invested in Triton who need the last 20–30 % on Hopper and Blackwell; its tutorial series (14 files from “intro” to “multi-CTA”) is the best free material on modern NVIDIA kernels.

CuTe DSL#

The CuTe algebra (25.c) in Python. NVIDIA’s own Blackwell and Rubin examples, FlashAttention-4 and FlashInfer’s Blackwell attention and GEMM kernels are written in it. It exposes every hardware feature on the day it ships (CUTLASS 4.8 added Rubin MMA shapes, B-collector reuse and 576-column TMEM). Price: you must understand layouts, atoms and pipelines.

TileLang#

A Python DSL built on Apache TVM, from a group that includes Peking University and Microsoft Research (paper: arXiv 2504.17577). You write tile operations; the compiler infers thread mappings and layouts, and since 2026 can generate warp-specialised TMA pipelines automatically. It targets more hardware than any other entry (CUDA, ROCm, Metal, Ascend 950 since September 2026, CPU via LLVM). DeepSeek uses it heavily: FlashMLA’s fused kernel test requires TileLang, and DeepSeek’s TileKernels repository and V3.2/V4 sparse-attention examples are written in it.

ThunderKittens#

A small C++ embedded library (the paper: arXiv 2410.20399): every tile is at least 16 × 16, and operations are over whole tiles in registers or shared memory, with TMA, wgmma/tcgen05 and multi-GPU (NVLink) operations wrapped. ThunderKittens 2.0 (January 2026) added full Blackwell support with MXFP8 and NVFP4, and a September 2026 update added Rubin instructions. Its README lists Together AI, Jump Trading and Cursor as users. HipKittens is the AMD sibling.

cuTile and Tile IR#

NVIDIA’s CUDA 13.1 (December 2025) introduced Tile IR, a virtual instruction set for tile programs (like PTX, but for tiles), and cuTile Python on top. It is NVIDIA’s answer to Triton: tile-level, compiler-managed, portable across GPU generations. Helion can target it (HELION_BACKEND=tileir). Check the cuda-tile PyPI page for supported architectures before planning on it.

Outside NVIDIA#

Triton runs on AMD; TileLang and Helion have AMD paths; AMD’s own FlyDSL (an MLIR Python DSL with CuTe-like layout algebra) is used inside AITER; Google’s Pallas is the TPU and (Mosaic GPU) GPU DSL in JAX. Lesson 25.k covers them.


6. Under the hood: what the compilers produce#

All of them end at the same places: PTX/SASS (NVIDIA) or AMDGCN (AMD). Two habits make any of them debuggable:

Shell
# Triton / Gluon: keep and inspect the intermediate stages
TRITON_KERNEL_DUMP=1 TRITON_DUMP_DIR=/tmp/tdump python my_kernel.py
#   *.ttir (Triton IR), *.ttgir (layouts and pipelining decided), *.llir, *.ptx, *.cubin

# CuTe DSL: keep the generated IR, PTX, cubin and SASS (CUTLASS 4.8 debugging guide)
CUTE_DSL_KEEP=ir,ptx,cubin,sass CUTE_DSL_DUMP_DIR=/tmp/cdump python my_kernel.py

# Any NVIDIA kernel: look at the final machine code
cuobjdump -sass my_kernel.cubin | grep -E "UTMALDG|HGMMA|UTC.*MMA|SYNCS"

In the SASS, TMA loads appear as UTMALDG, Hopper wgmma as HGMMA, Blackwell tcgen05.mma as instructions whose names start with UTC and end in MMA, and mbarrier operations under SYNCS. If your “Blackwell” kernel has no UTC…MMA instruction, it is not using the fifth-generation tensor cores.

Triton’s .ttgir is where to look when Triton is slow: it shows the layout of every tensor (#blocked, #nvidia_mma, #shared), whether loads were pipelined, and where layout conversions (convert_layout, often a shared-memory round trip) were inserted.


7. Performance implications#

Published comparisons (authors’ figures, on their GPUs; treat as indicative):

  • Triton’s Gluon tutorial: a warp-specialised persistent Gluon matmul reaches about 88–100 % of cuBLAS on B200 across K, before multi-CTA tricks (25.b).
  • FlashAttention-4 (CuTe DSL): up to 1.3× over cuDNN 9.13 and 2.7× over Triton on B200 (13.l).
  • The JAX Pallas Blackwell matmul tutorial: utilisation from about 45 % to 72 % by adding warp specialisation, and further with later steps.

The pattern holds broadly in 2026: compiler-managed languages are within 10–30 % of hand-tuned kernels for GEMM and attention on the newest GPUs, and at parity for memory-bound kernels. The gap closes over time as compilers learn the new hardware; it reopens with each new generation.

Compile time matters too: Triton and CuTe DSL compile in seconds; CUTLASS C++ in tens of seconds to minutes per instantiation; Helion’s autotuner can spend about ten minutes searching over a thousand configurations on first use (its README shows a 586-second session).


8. Production implications#

  • Pick by kernel, not by team fashion. A practical policy: fused elementwise, normalisation, quantisation, sampling and routing kernels in Triton (or Helion); GEMM, attention and MoE from a library first (cuBLAS, CUTLASS, FlashInfer, FlashAttention, DeepGEMM); write a custom kernel in Gluon, TileLang or CuTe DSL only when a profile shows a real gap.
  • JIT means cold starts. Every DSL here compiles on first use. Pre-compile or warm caches in your container (TRITON_CACHE_DIR, FlashInfer’s cubin and JIT-cache wheels, TileLang’s binary cache) and include warm-up in readiness checks (20.g).
  • Pin versions. Triton, TileLang and CuTe DSL change APIs between minor releases (TileLang 0.1.13 removed legacy APIs; Triton 3.9 changed E8M0 decoding). Engines pin exact versions; so should you.
  • Portability is real but partial. Triton and TileLang kernels run on AMD, but tuned NVIDIA configurations are rarely optimal there. Budget for re-tuning (25.k, 25.l).
  • Hiring and maintenance. CuTe DSL and Gluon code needs people who understand 25.a–25.c. Triton and Helion code can be maintained by a much wider group.

9. Common mistakes#

  1. Dropping to the lowest level first. Start with a library or Triton; measure; descend only for the hot kernel.
  2. Comparing languages on one shape. A DSL that wins on 8192³ GEMMs can lose on the M = 16 decode shapes that dominate inference.
  3. Ignoring compile and autotune time in serving start-up and in CI.
  4. Assuming automatic warp specialisation happened. Check the IR or SASS; compilers silently fall back to non-specialised code when a pattern does not match.
  5. Treating research DSLs as stable APIs. Pin, test and expect churn.
  6. Forgetting the backward pass is not your problem. Inference kernels need only the forward pass; many DSL examples include backward kernels you can ignore, and the shapes differ.

10. Hands-on exercise#

On one NVIDIA GPU (Hopper or Blackwell preferred):

  1. Write a fused “SiLU(x) × y” (the SwiGLU activation) in Triton, TileLang and Helion. Check each against PyTorch with torch.testing.assert_close, and measure GB/s. All three should approach the memory roofline (6.a).
  2. Run TileLang’s README matmul and Helion’s matmul at M = N = K = 4096 and at M = 16, N = K = 4096. Compare with torch.matmul. Where is each language weakest?
  3. Dump Triton’s .ttgir for your SwiGLU kernel and for tl.dot matmul. Find the layouts and any convert_layout.
  4. Read ThunderKittens’ H100 GEMM end to end and map each part to the roles in 25.b.

11. Interview questions#

  1. Order Helion, Triton, TileLang, Gluon, ThunderKittens and CuTe DSL by how much they make the programmer decide. What does each one leave to the compiler?
  2. Why did Triton need Gluon on Hopper and Blackwell?
  3. Your team must ship a new attention variant on B200 in two weeks. Which language do you pick, and what is your fallback?
  4. What is Tile IR, and how is it like and unlike PTX?
  5. How would you check that a Triton kernel actually uses TMA and warp specialisation?
  6. What production costs come with JIT-compiled kernel languages, and how do you contain them?

12. Further reading#

Checked on 13 November 2026.

↑↓ navigate↵ openesc close

100% drag to pan · scroll or pinch to zoom · double-click to zoom in