@@ -6,16 +6,37 @@ The tracking issue for this feature is: [#124509](https://github.com/rust-lang/r
66
77This feature allows you to differentiate functions using automatic differentiation.
88Set the ` -Zautodiff=<options> ` compiler flag to adjust the behaviour of the autodiff feature.
9- Multiple options can be separated with a comma. Valid options are:
10-
11- ` Enable ` - Required flag to enable autodiff
12- ` PrintTA ` - print Type Analysis Information
13- ` PrintTAFn ` - print Type Analysis Information for a specific function
14- ` PrintAA ` - print Activity Analysis Information
15- ` PrintPerf ` - print Performance Warnings from Enzyme
16- ` PrintSteps ` - prints all intermediate transformations
17- ` PrintModBefore ` - print the whole module, before running opts
18- ` PrintModAfter ` - print the module after Enzyme differentiated everything
19- ` LooseTypes ` - Enzyme's loose type debug helper (can cause incorrect gradients)
20- ` Inline ` - runs Enzyme specific Inlining
21- ` RuntimeActivity ` - allow specifying activity at runtime
9+ Multiple options can be separated with a comma.
10+
11+ ## Syntax
12+ ``` bash
13+ rustc -Z autodiff=Enable[,options]
14+ ```
15+
16+ Where ` options ` can be:
17+
18+ - ` Enable ` - Required flag to enable autodiff
19+ - ` PrintTA ` - print Type Analysis Information
20+ - ` PrintTAFn=<fn_name> ` - print Type Analysis Information for a specific function (consider combining it with ` no_mangle ` )
21+ - ` PrintAA ` - print Activity Analysis Information
22+ - ` PrintPerf ` - print Performance Warnings from Enzyme
23+ - ` PrintSteps ` - prints all intermediate transformations
24+ - ` PrintModBefore ` - print the whole module, before running opts
25+ - ` PrintModAfter ` - print the module after Enzyme differentiated everything
26+ - ` LooseTypes ` - Enzyme's loose type debug helper (can cause incorrect gradients)
27+ - ` Inline ` - runs Enzyme specific Inlining
28+ - ` RuntimeActivity ` - allow specifying activity at runtime
29+
30+
31+ ## Examples
32+
33+ ``` bash
34+ # Enable autodiff via cargo, assuming `enzyme` being a toolchain that supports autodiff
35+ " RUSTFLAGS=-Zautodiff=Enable" cargo +enzyme build
36+
37+ # Enable autodiff directly via rustc
38+ rustc -Z autodiff=Enable
39+
40+ # Print TypeAnalysis updates for the function `foo`, as well as Activity Analysis for all differentiated code.
41+ rustc -Z autodiff=Enable,PrintTAFn=foo,PrintAA
42+ ```
0 commit comments