WhoBuilt

Luminal - Search-Based Deep Learning Compilers

Jun 3, 2025· 25 min· 916 views·Watch on YouTube

Speaker

Joe Fioti, a creator of Luminal, explains how the ML library uses a small set of operations and search based compilation to run deep learning models, speaking at an AI Engineer event.

Reduce ML to a small set of operations

Fioti describes deep learning as mostly linear algebra built from scalars, vectors, matrices, and tensors. Luminal uses 12 basic operations, which he says can represent commercially relevant language, vision, convolutional, recurrent, and diffusion models. Other operations, including matrix multiplication and convolution, can be composed from these primitives and shape transformations.

Represent models as graphs

Fioti argues that most of a transformer model is static, with sequence length and KV cache length as its main dynamic parts. Luminal represents models as directed acyclic graphs of operations. He says the library has fewer than 5,000 lines of code and can express models that larger frameworks support.

Use search to find faster kernels

Luminal compiles its primitive graphs into faster ones, using rewrite rules to build a search space of logically equivalent GPU kernels. The compiler profiles candidates and chooses fast kernels, using Monte Carlo search to narrow the choices when exhaustive profiling is impractical. Fioti says this approach can discover kernel fusion and FlashAttention from a naive attention graph.

Apply deterministic runtime optimizations

After search, Luminal applies optimizations such as reusing memory buffers whose lifetimes do not overlap. It also queues kernels for GPU execution to reduce repeated CPU dispatch overhead. Although Luminal began as an inference library, an external autograd crate can derive a backward graph so the compiler flow also applies to training.

Expand hardware and cloud support

Fioti says Luminal supports CPU, CUDA, and Metal, with AMD, Tenstorrent, Groq, and TPU support as goals. He also outlines plans for distributed inference and training, plus reinforcement learning with model and environment steps running on the GPU. Luminal Cloud is presented as a way to export a graph and receive a serverless inference endpoint, with optimization, batching, queuing, and provisioning handled by the service.

Takeaways

  • A small set of tensor operations can represent many model architectures when shape transformations and composition are available.
  • Search can replace hand-written optimization rules by profiling logically equivalent kernel candidates.
  • Memory movement and CPU kernel dispatch can dominate runtime, so fusion, buffer reuse, and queued launches matter.
  • Static model graphs make it possible to optimize a full workload and reuse the compiler flow for forward and backward passes.
  • A graph export can serve as a boundary between model development and managed inference deployment.

Mentioned in this talk

Search inside this talk

What was claimed 13

  • built
    “Tri Dao discovered it in 2022.”
    YouTube
    Verified3 sources· Talk, Web· archived
  • feature
    Luminal: Uses 12 simple operations to represent commercially relevant machine learning models
    “We have 12 very simple operations.”
    YouTube
    Unverified1 source· Talk
  • metric
    Luminal: Under 5,000 lines of code
    “It’s under 5,000 lines of code.”
    YouTube
    Unverified1 source· Talk
  • uses
    “With Luminal, we directly emit and generate CUDA code.”
    YouTube
    Unverified1 source· Talk
  • uses
    “We take our graphs ... and convert them into expressions in a library called egglog.”
    YouTube
    Unverified1 source· Talk
  • feature
    Luminal: Compiler search can find FlashAttention from a naive multi-head attention graph
    “Our compiler is now able to find it completely by itself.”
    YouTube
    Unverified1 source· Talk
  • feature
    Luminal: Reuses memory buffers when graph lifetimes do not overlap
    “Buffer one and buffer three should actually be the same buffer.”
    YouTube
    Unverified1 source· Talk
  • feature
    Luminal: Issues all kernels at once to reduce CPU dispatch overhead
    “What if we dispatched all our kernels ahead of time?”
    YouTube
    Unverified1 source· Talk
Show all 13 facts

Related talks