[llvm-dev] RFC: Enzyme, Automatic Differentiation for LLVM as an LLVM Incubator Project

William Moses via llvm-dev llvm-dev at lists.llvm.org
Tue Jan 12 12:57:37 PST 2021

Hi all,

Automatic differentiation (AD) is a key component in algorithms used in
machine learning, scientific computing, and elsewhere.

For the last year-and-a-half, the `Enzyme` group have been looking at the
practical possibility of doing automatic differentiation as part of the
LLVM optimization pipeline. Performing automatic differentiation in LLVM is
quite beneficial as it allows all of the languages that lower to LLVM to
incorporate automatic differentiation without much additional work. It also
allows for automatic differentiation across languages, which is similarly

One unexpected benefit we found of doing AD at the LLVM-level is that there
is a significant performance benefit (4.2x in our tests) to be gained by
performing AD after LLVM’s optimization passes [1].

After several months of testing with various users including the Rust [4,
5], C/C++, Julia [6], Fortran, and machine learning communities, we’d like
to share LLVM-based automatic differentiation more widely and ask to be
considered as an LLVM incubator project.

Our code is available here (
https://github.com/wsmoses/Enzyme/tree/master/enzyme) as a plugin for LLVM
versions 7 through master. We’ve had weekly meetings for the past several
months with folks from MIT, Argonne, Princeton, Google, NVIDIA, and
Facebook and welcome anyone who wants to join. Documentation and install
instructions for Enzyme is available here: https://enzyme.mit.edu. We have
our charter available here:

Performing automatic differentiation inside of LLVM presents several
interesting technical questions, which we’ve explored with the community in
a poster and SRC talk at the 2020 US LLVM Dev Meeting [2, 3].

The Enzyme team


[2] https://c.wsmoses.com/posters/Enzyme-llvmdev.pdf

[3] https://www.youtube.com/watch?v=auQNFDlaXdM,

[4] https://github.com/tiberiusferreira/oxide-enzyme


[6] https://github.com/wsmoses/Enzyme.jl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210112/84509725/attachment.html>

More information about the llvm-dev mailing list