autodiff: typetree recursive depth query from enzyme with fallback

Signed-off-by: Karan Janthe <karanjanthe@gmail.com>
This commit is contained in:
Karan Janthe
2025-09-12 06:11:18 +00:00
parent 4520926bb5
commit 3ba5f19182
6 changed files with 26 additions and 22 deletions

View File

@@ -1847,3 +1847,15 @@ extern "C" void LLVMRustSetNoSanitizeHWAddress(LLVMValueRef Global) {
MD.NoHWAddress = true;
GV.setSanitizerMetadata(MD);
}
#ifdef ENZYME
extern "C" {
extern llvm::cl::opt<unsigned> EnzymeMaxTypeDepth;
}
extern "C" size_t LLVMRustEnzymeGetMaxTypeDepth() { return EnzymeMaxTypeDepth; }
#else
extern "C" size_t LLVMRustEnzymeGetMaxTypeDepth() {
return 6; // Default fallback depth
}
#endif