EnzymeAD/Enzyme

High-performance automatic differentiation of LLVM and MLIR.

What it solves

Enzyme provides a way to automatically calculate gradients (automatic differentiation) of code written in LLVM and MLIR, allowing developers to generate high-performance gradients for their functions without manually rewriting code for machine learning or scientific computing.

How it works

It operates as a plugin for the LLVM and MLIR compiler infrastructure. By calling a special function __enzyme_autodiff on a target function, the Enzyme transformation pass replaces that call with the actual gradient of the first argument, synthesizing the gradient code directly within the compiler's intermediate representation.

Who it’s for

Developers and researchers in high-performance computing (HPC), machine learning, and scientific computing who need efficient gradients of optimized code, including support for GPU kernels and various parallel paradigms (OpenMP, MPI, Julia Tasks).

Highlights

  • own high-performance automatic differentiation of statically analyzable LLVM and MLIR.
  • Support for GPU kernels (CUDA, ROCm) and parallel programs (OpenMP, MPI).
  • Ability to perform AD on already optimized code to meet or exceed state-of-the-art tool performance.
  • Bindings available for Julia, Rust, and Fortran.