Skip to content

Commit 14a8f66

Browse files
committed
working
1 parent f1b0c51 commit 14a8f66

File tree

6 files changed

+402
-216
lines changed

6 files changed

+402
-216
lines changed

compiler/rustc_codegen_llvm/src/back/lto.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -522,9 +522,9 @@ fn thin_lto(
522522
}
523523
}
524524

525-
fn enable_autodiff_settings(ad: &[config::AutoDiff]) {
526-
use crate::llvm::EnzymeWrapper;
527-
let enzyme = EnzymeWrapper::current();
525+
fn enable_autodiff_settings(cgcx: &CodegenContext<LlvmCodegenBackend>, ad: &[config::AutoDiff]) {
526+
use rustc_codegen_ssa::back::write::EnzymeWrapper;
527+
let enzyme = rustc_codegen_ssa::back::write::EnzymeWrapper::current(cgcx);
528528
for val in ad {
529529
// We intentionally don't use a wildcard, to not forget handling anything new.
530530
match val {
@@ -603,7 +603,7 @@ pub(crate) fn run_pass_manager(
603603
};
604604

605605
if enable_ad {
606-
enable_autodiff_settings(&config.autodiff);
606+
enable_autodiff_settings(&cgcx, &config.autodiff);
607607
}
608608

609609
unsafe {

compiler/rustc_codegen_llvm/src/back/write.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -665,8 +665,8 @@ pub(crate) unsafe fn llvm_optimize(
665665

666666
let llvm_plugins = config.llvm_plugins.join(",");
667667

668-
let enzyme_fn = if run_enzyme {
669-
let wrapper = crate::llvm::EnzymeWrapper::current();
668+
let enzyme_fn = if consider_ad {
669+
let wrapper = rustc_codegen_ssa::back::write::EnzymeWrapper::current(cgcx);
670670
wrapper.lock().unwrap().registerEnzymeAndPassPipeline
671671
} else {
672672
//dbg!(run_enzyme);

compiler/rustc_codegen_llvm/src/context.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,6 @@ impl<'ll, 'tcx> MiscCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> {
834834
}
835835

836836
fn sess(&self) -> &Session {
837-
let _enzyme = crate::llvm::EnzymeWrapper::set_path(self.tcx.sess);
838837
self.tcx.sess
839838
}
840839

0 commit comments

Comments
 (0)