Skip to content

Commit

Permalink
new flag (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZuseZ4 committed Apr 2, 2024
1 parent 683aa31 commit 8e61557
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions compiler/rustc_codegen_llvm/src/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<u64>().unwrap();
Expand Down
7 changes: 7 additions & 0 deletions compiler/rustc_codegen_llvm/src/llvm/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!() }
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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>(
Expand Down

0 comments on commit 8e61557

Please sign in to comment.