Skip to content

Commit df9080e

Browse files
committed
add custom enzyme marker to target methods
1 parent 116c948 commit df9080e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

compiler/rustc_codegen_llvm/src/builder/autodiff.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,13 @@ fn generate_enzyme_call<'ll>(
334334
let attr = llvm::AttributeKind::NoInline.create_attr(cx.llcx);
335335
attributes::apply_to_llfn(ad_fn, Function, &[attr]);
336336

337+
// We add a made-up attribute just such that we can recognize it after AD to update
338+
// (no)-inline attributes. We'll then also remove this attribute.
339+
let enzyme_marker_attr = llvm::CreateAttrString(cx.llcx, "enzyme_marker");
340+
//Some(llvm::CreateAttrStringValue(cx.llcx, "no-jump-tables", "true"))
341+
// &llvm::ffi::Attribute
342+
attributes::apply_to_llfn(outer_fn, Function, &[enzyme_marker_attr]);
343+
337344
// first, remove all calls from fnc
338345
let entry = llvm::LLVMGetFirstBasicBlock(outer_fn);
339346
let br = llvm::LLVMRustGetTerminator(entry);

0 commit comments

Comments
 (0)