Skip to content

Commit d376a49

Browse files
authored
Rollup merge of #147888 - ZuseZ4:autodiff-with-download-ci, r=jieyouxu
enzyme/autodiff is compatible with download-ci=true To my surprise autodiff just works out of the box with download-ci=true. Thanks to all the bootstrap people who over the past helped me to link properly against the sysroot LLVM, which seems to pay off here. That also helps with enabling Rust in Enzyme CI, since CCache for some reason doesn't seem to cache LLVM correctly on their runners. I verified that this works with ` ./configure --release-channel=nightly --enable-llvm-enzyme --enable-option-checking --disable-docs --enable-llvm-assertions --set llvm.download-ci-llvm=true`. However, shouldn't download-ci-llvm already be the default? Why do I still have to manually set it with this pr? I tested it afterwards with `./x.py test --stage 1 tests/codegen-llvm/autodiff` r? bootstrap closes #147535
2 parents f87f9a4 + 3e32dc2 commit d376a49

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

src/bootstrap/src/core/config/toml/llvm.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ pub fn check_incompatible_options_for_ci_llvm(
117117
enable_warnings,
118118
download_ci_llvm: _,
119119
build_config,
120-
enzyme,
120+
enzyme: _,
121121
} = ci_llvm_config;
122122

123123
err!(current_llvm_config.optimize, optimize);
@@ -139,7 +139,6 @@ pub fn check_incompatible_options_for_ci_llvm(
139139
err!(current_llvm_config.clang, clang);
140140
err!(current_llvm_config.build_config, build_config);
141141
err!(current_llvm_config.plugins, plugins);
142-
err!(current_llvm_config.enzyme, enzyme);
143142

144143
warn!(current_llvm_config.enable_warnings, enable_warnings);
145144

src/bootstrap/src/utils/change_tracker.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,4 +571,9 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[
571571
severity: ChangeSeverity::Warning,
572572
summary: "`rust.lld = true` no longer automatically causes the `x86_64-unknown-linux-gnu` target to default into using the self-contained LLD linker. This target now uses the LLD linker by default. To opt out, set `target.x86_64-unknown-linux-gnu.default-linker-linux-override = 'off'`.",
573573
},
574+
ChangeInfo {
575+
change_id: 147888,
576+
severity: ChangeSeverity::Info,
577+
summary: "`llvm.enzyme` now works with `download-ci-llvm=true`.",
578+
},
574579
];

src/doc/rustc-dev-guide/src/autodiff/debugging.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ The actual numbers will depend on your code.
2525

2626
## 2) Check your llvm-ir reproducer
2727

28-
To confirm that your previous step worked, we will use llvm's `opt` tool. find your path to the opt binary, with a path similar to `<some_dir>/rust/build/<x86/arm/...-target-triple>/build/bin/opt`. also find `llvmenzyme-19.<so/dll/dylib>` path, similar to `/rust/build/target-triple/enzyme/build/enzyme/llvmenzyme-19`. Please keep in mind that llvm frequently updates it's llvm backend, so the version number might be higher (20, 21, ...). Once you have both, run the following command:
28+
To confirm that your previous step worked, we will use llvm's `opt` tool. Find your path to the opt binary, with a path similar to `<some_dir>/rust/build/<x86/arm/...-target-triple>/ci-llvm/bin/opt`. If you build LLVM from source, you'll likely need to replace `ci-llvm` with `build`. Also find `llvmenzyme-21.<so/dll/dylib>` path, similar to `/rust/build/target-triple/enzyme/build/enzyme/llvmenzyme-21`. Please keep in mind that llvm frequently updates it's llvm backend, so the version number might be higher (20, 21, ...). Once you have both, run the following command:
2929

3030
```sh
3131
<path/to/opt> out.ll -load-pass-plugin=/path/to/build/<target-triple>/stage1/lib/libEnzyme-21.so -passes="enzyme" -enzyme-strict-aliasing=0 -s

src/doc/rustc-dev-guide/src/autodiff/installation.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ First you need to clone and configure the Rust repository:
88
```bash
99
git clone [email protected]:rust-lang/rust
1010
cd rust
11-
./configure --enable-llvm-link-shared --enable-llvm-plugins --enable-llvm-enzyme --release-channel=nightly --enable-llvm-assertions --enable-clang --enable-lld --enable-option-checking --enable-ninja --disable-docs
11+
./configure --release-channel=nightly --enable-llvm-enzyme --enable-llvm-assertions --enable-option-checking --disable-docs --set llvm.download-ci-llvm=true
1212
```
1313

1414
Afterwards you can build rustc using:
@@ -47,7 +47,7 @@ Then build rustc in a slightly altered way:
4747
```bash
4848
git clone https://github.com/rust-lang/rust
4949
cd rust
50-
./configure --enable-llvm-link-shared --enable-llvm-plugins --enable-llvm-enzyme --release-channel=nightly --enable-llvm-assertions --enable-clang --enable-lld --enable-option-checking --enable-ninja --disable-docs
50+
./configure --release-channel=nightly --enable-llvm-enzyme --enable-llvm-assertions --enable-option-checking --disable-docs --set llvm.download-ci-llvm=true
5151
./x dist
5252
```
5353
We then copy the tarball to our host. The dockerid is the newest entry under `docker ps -a`.
@@ -84,5 +84,5 @@ cd build
8484
cmake .. -G Ninja -DLLVM_DIR=<YourLocalPath>/llvm-project/build/lib/cmake/llvm/ -DLLVM_EXTERNAL_LIT=<YourLocalPath>/llvm-project/llvm/utils/lit/lit.py -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=YES -DBUILD_SHARED_LIBS=ON
8585
ninja
8686
```
87-
This will build Enzyme, and you can find it in `Enzyme/enzyme/build/lib/<LLD/Clang/LLVM>Enzyme.so`. (Endings might differ based on your OS).
87+
This will build Enzyme, and you can find it in `Enzyme/enzyme/build/lib/<LLD/Clang/LLVM/lib>Enzyme.so`. (Endings might differ based on your OS).
8888

0 commit comments

Comments
 (0)