diff options
| author | bors <bors@rust-lang.org> | 2025-02-22 10:30:06 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-02-22 10:30:06 +0000 |
| commit | 8dac72bb1d12b2649acd0c190e41524f83da5683 (patch) | |
| tree | 23cadee493bbc328f4d7227e66212847c17388ba /compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp | |
| parent | b6d3be4948e92fce0236cbbe22b55c55f6950269 (diff) | |
| parent | 49e9630641e44756b679187bfeefa85b06dfc86f (diff) | |
| download | rust-8dac72bb1d12b2649acd0c190e41524f83da5683.tar.gz rust-8dac72bb1d12b2649acd0c190e41524f83da5683.zip | |
Auto merge of #136428 - EnzymeAD:enable-autodiff, r=oli-obk
test building enzyme in CI 1) This PR fixes a significant compile-time regression, by only running the expensive autodiff pipeline, if the users pass the newly introduced Enable value to the `-Zautodiff=` flag. It updates the test(s) accordingly. It gives a nice error if users forget that. 2) It fixes macos support by explicitly linking against the Enzyme build folder. This doesn't cover CI macos yet. 3) It fixes the issue that setting ENZYME_RUNPASS was ignored by enzyme and in fact did not schedule enzyme's opt pass. 4) It also re-enables support for various other values for the autodiff flag, which were ignored since the refactor. 5) I merged some improvements to Enzyme core, which means we do not longer depend on LLVM being build with the Plugin Interface enabled. 6) Unrelated to other fixes, this changes `rustc_autodiff` to `EncodeCrossCrate::Yes`. It is not enough on it's own to enable usage of Enzyme in libraries, but it is for sure a piece of the fixes needed to get this to work. try-job: x86_64-gnu r? `@oli-obk` Tracking: - https://github.com/rust-lang/rust/issues/124509
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp')
| -rw-r--r-- | compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp index 7eb11f9e608..9ce4abdb432 100644 --- a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp @@ -692,9 +692,12 @@ struct LLVMRustSanitizerOptions { bool SanitizeKernelAddressRecover; }; -// This symbol won't be available or used when Enzyme is not enabled +// This symbol won't be available or used when Enzyme is not enabled. +// Always set AugmentPassBuilder to true, since it registers optimizations which +// will improve the performance for Enzyme. #ifdef ENZYME -extern "C" void registerEnzyme(llvm::PassBuilder &PB); +extern "C" void registerEnzymeAndPassPipeline(llvm::PassBuilder &PB, + /* augmentPassBuilder */ bool); #endif extern "C" LLVMRustResult LLVMRustOptimize( @@ -1023,7 +1026,7 @@ extern "C" LLVMRustResult LLVMRustOptimize( // now load "-enzyme" pass: #ifdef ENZYME if (RunEnzyme) { - registerEnzyme(PB); + registerEnzymeAndPassPipeline(PB, true); if (auto Err = PB.parsePassPipeline(MPM, "enzyme")) { std::string ErrMsg = toString(std::move(Err)); LLVMRustSetLastError(ErrMsg.c_str()); |
