std::autodiff - computing derivatives with your compiler
summary
A new std::autodiff macro compiles Rust functions into extra derivative-returning variants (reverse-mode gradients, jacobians, hessians), using an Enzyme/LLVM backend integrated by modifying the compiler pipeline and requiring nightly with D set autodiff=enable. Benchmarks across LSTM, Gaussian mixtures, bundle adjustment and ODE solvers show Rust matching C++ when relying on safe Rust optimizations; using raw pointers yields 2.5x–10x slower results in some cases. GPU, MPI, batching and custom derivatives are supported but the feature remains experimental and some CMake/compile-time rough edges persist.
AI-written summary · about
chapters (6)
- 0:00Intro
- 0:52What is autodiff
- 3:10Why autodiff is fast
- 5:40Autodiff in Rust
- 6:44Benchmarks
- 8:52Next steps
related talks
59mDifferentiable Programming in C++
01h 22mRust for the C++ Programmer
31mBenchmarking and Optimization of Rust Libraries
28mGenerating ergonomic C++ APIs using Rustdoc, procedural macros, and Serde
29mAutomatic Differentiation via Effects and Handlers in OCaml
40mRust’s approach of getting things right
25m"Compiler-Driven Development: Making Rust Work for You"
25mRust and C++
