about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorbit-aloo <sshourya17@gmail.com>2025-04-20 15:48:58 +0530
committerbit-aloo <sshourya17@gmail.com>2025-04-25 11:09:52 +0530
commit9bc04016e6dffd6398ea62f05b9320e0198ab0be (patch)
tree604f9760a3e6562c34dd9b1db9e9cfd075d75359 /compiler/rustc_codegen_llvm/src
parentf319dd909ed3ec1c0d04ede06b5864badddefb15 (diff)
downloadrust-9bc04016e6dffd6398ea62f05b9320e0198ab0be.tar.gz
rust-9bc04016e6dffd6398ea62f05b9320e0198ab0be.zip
add custom enzyme markers to target methods
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
-rw-r--r--compiler/rustc_codegen_llvm/src/builder/autodiff.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_llvm/src/builder/autodiff.rs b/compiler/rustc_codegen_llvm/src/builder/autodiff.rs
index 0147bd5a665..c5c13ac097a 100644
--- a/compiler/rustc_codegen_llvm/src/builder/autodiff.rs
+++ b/compiler/rustc_codegen_llvm/src/builder/autodiff.rs
@@ -361,6 +361,11 @@ fn generate_enzyme_call<'ll>(
         let attr = llvm::AttributeKind::NoInline.create_attr(cx.llcx);
         attributes::apply_to_llfn(ad_fn, Function, &[attr]);
 
+        // We add a made-up attribute just such that we can recognize it after AD to update
+        // (no)-inline attributes. We'll then also remove this attribute.
+        let enzyme_marker_attr = llvm::CreateAttrString(cx.llcx, "enzyme_marker");
+        attributes::apply_to_llfn(outer_fn, Function, &[enzyme_marker_attr]);
+
         // first, remove all calls from fnc
         let entry = llvm::LLVMGetFirstBasicBlock(outer_fn);
         let br = llvm::LLVMRustGetTerminator(entry);