pytorch/helion

A Python-embedded DSL that makes it easy to write fast, scalable ML kernels with minimal boilerplate.

What it solves

Writing high-performance machine learning kernels (the low-level code that makes GPU operations fast) is normally tedious and error-prone. Developers have to manually manage memory access, tiling, parallel scheduling, and tune dozens of parameters for each new GPU model. Helion removes that pain by letting you write kernels in ordinary Python PyTorch style, then automatically exploring many possible implementations to find the fastest one for your specific hardware and input shapes.

How it works

You write a kernel as a Python function using PyTorch operations inside tiled loops. Helion treats that code as a high-level description, not the final kernel. Its compiler analyzes the loops and operations, then generates a search space of configurations covering things like tile sizes, loop order, memory indexing strategies, and parallelization choices. When the kernel first runs, an autotuner (using a differential evolution algorithm) tries hundreds of these configurations, measures their speed on your actual hardware, and picks the best one. The winning configuration can be hard-coded to skip future tuning. Helion can also lower kernels through several backends: Triton (default), TileIR for NVIDIA Blackwell, CuTe for CUDA 13+, Pallas for Google TPUs, and experimental Metal and FlyDSL for Apple and AMD GPUs.

Who it’s for

Machine learning engineers, systems researchers, and library developers who need custom GPU kernels but don’t want to hand-tune low-level CUDA, Triton, or TPU code. It’s ideal if you’re already comfortable with PyTorch and want to write a kernel once and have it automatically optimized for multiple GPU generations and vendors. It’s also useful for exploring kernel optimizations without writing manual search scripts.

Highlights

  • PyTorch-native syntax – You write kernels using familiar torch operations, so no new language to learn.
  • Automatic autotuning – One kernel becomes hundreds of candidate implementations; Helion picks the fastest for your hardware and data shapes.
  • Backend flexibility – Generate code for Triton, NVIDIA Blackwell (TileIR/CuTe), Google TPU (Pallas), and experimental Apple/AMD support.
  • Reduces manual effort – Handles indexing, masking, grid/PID calculations, kernel argument plumbing, and loop transformations automatically.
  • Production-ready tuning – You can save the best configuration and hard-code it, skipping runtime tuning for predictable performance.

Related

  • Project
  • Project
  • Project
  • Dispatch
  • Dispatch