From a96c3f3b9d279c0fe73c15824bdb5b40b037e1d7 Mon Sep 17 00:00:00 2001 From: Manuel Drehwald Date: Tue, 2 Apr 2024 14:10:14 -0400 Subject: [PATCH] new flag --- compiler/rustc_codegen_llvm/src/back/write.rs | 6 ++++++ compiler/rustc_codegen_llvm/src/llvm/ffi.rs | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/compiler/rustc_codegen_llvm/src/back/write.rs b/compiler/rustc_codegen_llvm/src/back/write.rs index dd5168ead45e5..54dca723d8dc6 100644 --- a/compiler/rustc_codegen_llvm/src/back/write.rs +++ b/compiler/rustc_codegen_llvm/src/back/write.rs @@ -1089,6 +1089,12 @@ pub(crate) unsafe fn differentiate( LLVMDumpModule(llmod); } } + + if std::env::var("ENZYME_INLINE").is_ok() { + dbg!("Setting inline to true"); + llvm::set_inline(true); + } + if std::env::var("ENZYME_TT_DEPTH").is_ok() { let depth = std::env::var("ENZYME_TT_DEPTH").unwrap(); let depth = depth.parse::().unwrap(); diff --git a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs index 77352e94c6d0b..a86e6ce8d65f0 100644 --- a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs +++ b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs @@ -2657,6 +2657,7 @@ pub mod Fallback_AD { pub fn EnzymeSetCLBool(arg1: *mut ::std::os::raw::c_void, arg2: u8) { unimplemented!() } pub fn EnzymeSetCLInteger(arg1: *mut ::std::os::raw::c_void, arg2: i64) { unimplemented!() } + pub fn set_inline(val: bool) { unimplemented!() } pub fn set_runtime_activity_check(check: bool) { unimplemented!() } pub fn set_max_int_offset(offset: u64) { unimplemented!() } pub fn set_max_type_offset(offset: u64) { unimplemented!() } @@ -3017,6 +3018,7 @@ extern "C" { static mut EnzymePrint: c_void; static mut EnzymeStrictAliasing: c_void; static mut looseTypeAnalysis: c_void; + static mut EnzymeInline: c_void; } pub fn set_runtime_activity_check(check: bool) { unsafe { @@ -3071,6 +3073,11 @@ pub fn set_loose_types(loose: bool) { EnzymeSetCLBool(std::ptr::addr_of_mut!(looseTypeAnalysis), loose as u8); } } +pub fn set_inline(val: bool) { + unsafe { + EnzymeSetCLBool(std::ptr::addr_of_mut!(EnzymeInline), val as u8); + } +} extern "C" { pub fn EnzymeCreatePrimalAndGradient<'a>(