RUSTFLAGSTo support you while debugging or profiling, we have added support for an experimental -Z autodiff rustc flag (which can be passed to cargo via RUSTFLAGS), which allow changing the behaviour of Enzyme, without recompiling rustc. We currently support the following values for autodiff.
PrintTA // Print TypeAnalysis information PrintAA // Print ActivityAnalysis information Print // Print differentiated functions while they are being generated and optimized PrintPerf // Print AD related Performance warnings PrintModBefore // Print the whole LLVM-IR module directly before running AD PrintModAfter // Print the whole LLVM-IR module after running AD, before optimizations PrintModFinal // Print the whole LLVM-IR module after running optimizations and AD LooseTypes // Risk incorrect derivatives instead of aborting when missing Type Info
For performance experiments and benchmarking we also support
NoPostopt // We won't optimize the LLVM-IR Module after AD RuntimeActivity // Enables the runtime activity feature from Enzyme Inline // Instructs Enzyme to maximize inlining as far as possible, beyond LLVM's default
You can combine multiple autodiff values using a comma as separator:
RUSTFLAGS="-Z autodiff=Enable,LooseTypes,PrintPerf" cargo +enzyme build
Using -Zautodiff=Enable will allow using autodiff and update your normal rustc compilation pipeline: