-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What is ABI? #1345
Comments
It's somewhat intentionally underdocumented at the moment. Specifically it is used to specify how Enzyme injects the code it produces into the Julia runtime. There's presently only one "officially" supported runtime, the DefaultABI aka FFIABI (in which we inject the code into Julia's JIT after we run our own separate compilation). There's a second "hidden" ABI, InlineABI, which basically causes Enzyme to emit things as an inline llvmcall. It's mostly used by Enzyme devs for debugging, but may also enable support with precompilation. That said the reason it's hidden is that @vchuravy is skeptical of the integration with other components so we intentionally haven't advertised it. |
If curious for specifics, see below: julia> @code_llvm Enzyme.autodiff(Reverse, sin, Active(3.0))
; @ /Users/wmoses/git/Enzyme.jl/src/Enzyme.jl:317 within `autodiff`
define [1 x [1 x double]] @julia_autodiff_2864([1 x double]* nocapture noundef nonnull readonly align 8 dereferenceable(8) %0) #0 {
guard_exit5:
%memcpy_refined_src = getelementptr inbounds [1 x double], [1 x double]* %0, i64 0, i64 0
%1 = load double, double* %memcpy_refined_src, align 8
; @ /Users/wmoses/git/Enzyme.jl/src/Enzyme.jl:318 within `autodiff` @ /Users/wmoses/git/Enzyme.jl/src/Enzyme.jl:333 @ /Users/wmoses/git/Enzyme.jl/src/Enzyme.jl:309
; ┌ @ /Users/wmoses/git/Enzyme.jl/src/compiler.jl:6067 within `CombinedAdjointThunk`
; │┌ @ /Users/wmoses/git/Enzyme.jl/src/compiler.jl:6190 within `enzyme_call`
; ││┌ @ /Users/wmoses/git/Enzyme.jl/src/compiler.jl:6589 within `macro expansion`
%2 = call [1 x [1 x double]] inttoptr (i64 5353095168 to [1 x [1 x double]] (double, double)*)(double %1, double 1.000000e+00)
ret [1 x [1 x double]] %2
; └└└
}
julia> @code_llvm Enzyme.autodiff(ReverseMode{false, InlineABI, false}(), sin, Active(3.0))
; @ /Users/wmoses/git/Enzyme.jl/src/Enzyme.jl:317 within `autodiff`
define [1 x [1 x double]] @julia_autodiff_2934([1 x double]* nocapture noundef nonnull readonly align 8 dereferenceable(8) %0) #0 {
guard_exit5:
%memcpy_refined_src = getelementptr inbounds [1 x double], [1 x double]* %0, i64 0, i64 0
%1 = load double, double* %memcpy_refined_src, align 8
; @ /Users/wmoses/git/Enzyme.jl/src/Enzyme.jl:318 within `autodiff` @ /Users/wmoses/git/Enzyme.jl/src/Enzyme.jl:333 @ /Users/wmoses/git/Enzyme.jl/src/Enzyme.jl:309
; ┌ @ /Users/wmoses/git/Enzyme.jl/src/compiler.jl:6067 within `CombinedAdjointThunk`
; │┌ @ /Users/wmoses/git/Enzyme.jl/src/compiler.jl:6190 within `enzyme_call`
; ││┌ @ /Users/wmoses/git/Enzyme.jl/src/compiler.jl:6596 within `macro expansion`
%2 = call fast double @llvm.cos.f64(double %1)
%unbox3.fca.0.0.insert = insertvalue [1 x [1 x double]] zeroinitializer, double %2, 0, 0
ret [1 x [1 x double]] %unbox3.fca.0.0.insert
; └└└
} |
Thanks for the details!
For the record, I don't think that should ever be a thing. I understand the lack of time and hands to write docs, but refusing to document something because someone else might use it is different. |
there are some (admittedly breif) docs, closing |
Apparently it plays a part in the mode choice?
Enzyme.jl/lib/EnzymeCore/src/EnzymeCore.jl
Lines 180 to 185 in 413b70f
The text was updated successfully, but these errors were encountered: