While looking at rust-lang/rust#160470 (comment), I noticed a different enzyme failure:
opt bar.ll -load-pass-plugin=enzyme-23.so -passes="enzyme" -enzyme-strict-aliasing=0
error: <unknown>:0:0: in function preprocess_bar void (ptr, i64): Enzyme: No forward mode derivative found for __enzyme_autodiff
at context: %3 = call {} (...) @__enzyme_autodiff(ptr @baz, ptr @enzyme_const, ptr %0, ptr @enzyme_const, i64 %1) #1
error: <unknown>:0:0: in function fwddiffebar void (ptr, ptr, i64): Enzyme: Cannot cast __enzyme_autodiff primal argument 3, found ptr %0, type ptr (simplified to ptr %0 ) - to arg 1, i64
Presumably enzyme doesn't recognize named globals in nested autodiff calls, which then makes the outer fwddiff call fall as well?
; ModuleID = 'std-ca0eb62edd1eb486.std.a58e486c150d32d8-cgu.0.rcgu.o'
source_filename = "std.a58e486c150d32d8-cgu.0"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
@enzyme_const = external global ptr
@enzyme_dup = external global ptr
; Function Attrs: nonlazybind uwtable
define internal void @outer(ptr align 8 %0, i64 %1, ptr align 8 %2) {
%20 = call {} (...) @__enzyme_fwddiff(ptr @foo, ptr @enzyme_dup, ptr %0, ptr %2, ptr @enzyme_const, i64 %1)
ret void
}
; Function Attrs: nonlazybind uwtable
define internal void @foo(ptr align 8 %0, i64 %1) {
call void @bar(ptr align 8 %0, i64 %1)
ret void
}
declare {} @__enzyme_fwddiff(...)
; Function Attrs: nonlazybind uwtable
define internal void @bar(ptr align 8 %0, i64 %1) {
%5 = call {} (...) @__enzyme_autodiff(ptr @baz, ptr @enzyme_const, ptr %0, ptr @enzyme_const, i64 %1)
ret void
}
; Function Attrs: nonlazybind uwtable
define internal void @baz(ptr align 8 %0, i64 %1) {
ret void
}
declare {} @__enzyme_autodiff(...)
While looking at rust-lang/rust#160470 (comment), I noticed a different enzyme failure:
opt bar.ll -load-pass-plugin=enzyme-23.so -passes="enzyme" -enzyme-strict-aliasing=0Presumably enzyme doesn't recognize named globals in nested autodiff calls, which then makes the outer fwddiff call fall as well?