-
-
Notifications
You must be signed in to change notification settings - Fork 72
Safety measures around AppleAccelerate #676
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
Conversation
```julia Enzyme Derivative Rules: Error During Test at /home/runner/.julia/packages/SafeTestsets/raUNr/src/SafeTestsets.jl:30 Got exception outside of a @test LoadError: could not load library "/System/Library/Frameworks/Accelerate.framework/Accelerate" /System/Library/Frameworks/Accelerate.framework/Accelerate.so: cannot open shared object file: No such file or directory Stacktrace: [1] fix_ptr_lookup(name::String) @ Enzyme.Compiler.JIT ~/.julia/packages/Enzyme/LMVya/src/compiler/orcv2.jl:63 [2] add!(mod::LLVM.Module) @ Enzyme.Compiler.JIT ~/.julia/packages/Enzyme/LMVya/src/compiler/orcv2.jl:251 [3] _link(job::GPUCompiler.CompilerJob{<:Enzyme.Compiler.EnzymeTarget}, mod::LLVM.Module, edges::Vector{Any}, adjoint_name::String, primal_name::Union{Nothing, String}, TapeType::Any, prepost::String) @ Enzyme.Compiler ~/.julia/packages/Enzyme/LMVya/src/compiler.jl:5661 [4] cached_compilation @ ~/.julia/packages/Enzyme/LMVya/src/compiler.jl:5750 ``` Basically, you can't do option dependencies, but BinaryBuilder just simply sends no binary if the platform isn't supported. So LinearSolve.jl always has a dependency on AppleAccelerate, and if the binary exists it defaults to it (since it's pretty much always the fastest on M-series mac) and otherwise it disables it. Enzyme still seems to want to try to call it, so this should fix that.
@@ -34,6 +34,8 @@ function aa_getrf!(A::AbstractMatrix{<:ComplexF64}; | |||
ipiv = similar(A, Cint, min(size(A, 1), size(A, 2))), | |||
info = Ref{Cint}(), | |||
check = false) | |||
__appleaccelerate_isavailable() || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
__appleaccelerate_isavailable() || | |
__appleaccelerate_isavailable() || |
@@ -54,6 +56,8 @@ | |||
ipiv = similar(A, Cint, min(size(A, 1), size(A, 2))), | |||
info = Ref{Cint}(), | |||
check = false) | |||
__appleaccelerate_isavailable() || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
__appleaccelerate_isavailable() || | |
__appleaccelerate_isavailable() || |
@@ -74,6 +78,8 @@ | |||
ipiv = similar(A, Cint, min(size(A, 1), size(A, 2))), | |||
info = Ref{Cint}(), | |||
check = false) | |||
__appleaccelerate_isavailable() || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
__appleaccelerate_isavailable() || | |
__appleaccelerate_isavailable() || |
@@ -94,6 +100,8 @@ | |||
ipiv = similar(A, Cint, min(size(A, 1), size(A, 2))), | |||
info = Ref{Cint}(), | |||
check = false) | |||
__appleaccelerate_isavailable() || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
__appleaccelerate_isavailable() || | |
__appleaccelerate_isavailable() || |
@@ -116,6 +124,8 @@ | |||
ipiv::AbstractVector{Cint}, | |||
B::AbstractVecOrMat{<:ComplexF64}; | |||
info = Ref{Cint}()) | |||
__appleaccelerate_isavailable() || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
__appleaccelerate_isavailable() || | |
__appleaccelerate_isavailable() || |
@@ -140,6 +150,8 @@ | |||
ipiv::AbstractVector{Cint}, | |||
B::AbstractVecOrMat{<:ComplexF32}; | |||
info = Ref{Cint}()) | |||
__appleaccelerate_isavailable() || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
__appleaccelerate_isavailable() || | |
__appleaccelerate_isavailable() || |
@@ -165,6 +177,8 @@ | |||
ipiv::AbstractVector{Cint}, | |||
B::AbstractVecOrMat{<:Float64}; | |||
info = Ref{Cint}()) | |||
__appleaccelerate_isavailable() || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
__appleaccelerate_isavailable() || | |
__appleaccelerate_isavailable() || |
@@ -190,6 +204,8 @@ | |||
ipiv::AbstractVector{Cint}, | |||
B::AbstractVecOrMat{<:Float32}; | |||
info = Ref{Cint}()) | |||
__appleaccelerate_isavailable() || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
__appleaccelerate_isavailable() || | |
__appleaccelerate_isavailable() || |
@@ -236,6 +252,8 @@ | |||
|
|||
function SciMLBase.solve!(cache::LinearCache, alg::AppleAccelerateLUFactorization; | |||
kwargs...) | |||
__appleaccelerate_isavailable() || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
__appleaccelerate_isavailable() || | |
__appleaccelerate_isavailable() || |
Basically, you can't do option dependencies, but BinaryBuilder just simply sends no binary if the platform isn't supported. So LinearSolve.jl always has a dependency on AppleAccelerate, and if the binary exists it defaults to it (since it's pretty much always the fastest on M-series mac) and otherwise it disables it. Enzyme still seems to want to try to call it, so this should fix that.
Checklist
contributor guidelines, in particular the SciML Style Guide and
COLPRAC.
Additional context
Add any other context about the problem here.