EnzymeAD/Reactant.jl

Optimize Julia Functions With MLIR and XLA for High-Performance Execution on CPU, GPU, TPU and more.

What it solves

Reactant simplifies the process of compiling Julia functions for high-performance execution on CPUs, GPUs, and TPUs. It removes the need for manual optimization or complex device-specific code (like CUDA.jl) by automatically transforming Julia code into a format that can be optimized and executed on hardware accelerators via XLA.

How it works

Reactant uses a tracing system to capture the execution of a Julia function. It converts the function into MLIR (Multi-Level Intermediate Representation) and applies optimizations, including automatic differentiation via EnzymeMLIR.

At its core, it uses two array types: ConcreteRArray (the actual data buffer on a device) and TracedRArray (used during compilation to represent data without knowing its actual values). When a function is compiled using the @compile macro, Reactant captures the control flow pattern of the initial execution and removes type instabilities, creating a static executable for the target device.

Who it’s for

Developers and researchers who want to run Julia code on hardware accelerators (GPU/TPU) with high performance and minimal effort, particularly those needing automatic differentiation for machine learning or scientific computing.

Highlights

  • Hardware Agnostic: Supports CPU, GPU, and TPU execution via XLA.
  • Automatic Differentiation: Integrates EnzymeMLIR for high-performance gradients.
  • Zero-Dependency GPU: Allows GPU execution without requiring a direct CUDA.jl dependency.
  • Recursive Data Support: Can convert complex, recursive data structures or shared objects into RArrays.

Related

  • Project
  • Project
  • Project
  • Project
  • Project