Can Enzyme differentiate compiled libraries?

78 views
Skip to first unread message

Amit Gupta

unread,
Dec 26, 2021, 5:05:09 AM12/26/21
to Enzyme AD

Hi,
This might seem bit of a naive question. I was wondering as Enzyme works in LLVM IR, does it mean it can differentiate precompiled libraries as well?
I tried compiling a simple function "sin(cos(x))", compiled it, and called it in test.c program using

clang test.c -Xclang -load -Xclang ./Enzyme/enzyme/build/Enzyme/ClangEnzyme-9.dylib -O2 -fno-vectorize -fno-unroll-loops -lsincos -L./ -I./ -I/opt/local/libexec/llvm-9.0/include/c++/v1

but the compilation fails with error: error: <unknown>:0:0: EnzymeFailure when replacing __enzyme_autodiff calls in main

So I was wondering if what I think is even possible?

Background: I was wondering if we can use ONNXRuntime inference session `run` method and wrap it in __enzyme_autodiff call to create a framework agnostic differentiable ML model (current ONNXRuntime standards only allow for inference only, with no grads).
Reply all
Reply to author
Forward
0 new messages