You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
v0.10: some LinearAlgebra functions can't be called anymore inside kernels #759
using KernelAbstractions, LinearAlgebra
@kernelfunctiondots!(out, a, b)
i =@index(Global, Linear)
@inboundsbegin
x =collect((a[i], a[i] +1, a[i] +2)) # Vector{Float64}
y =collect((b[i], b[i] +1, b[i] +2))
out[i] =dot(x, y) # BLAS.dot → cblas_ddot64_endend
a =rand(8); b =rand(8); out =zeros(8)
dots!(CPU(), 4)(out, a, b; ndrange =8)
This used to work in v0.9, but now we get
ERROR: LoadError: InvalidIRError: compiling MethodInstance for gpu_dots!(::KernelAbstractions.CompilerMetadata{KernelAbstractions.NDIteration.DynamicSize, KernelAbstractions.NDIteration.DynamicCheck, Nothing, CartesianIndices{1, Tuple{B
ase.OneTo{Int64}}}, KernelAbstractions.NDIteration.NDRange{1, KernelAbstractions.NDIteration.DynamicSize, KernelAbstractions.NDIteration.StaticSize{(4,)}, CartesianIndices{1, Tuple{Base.OneTo{Int64}}}, Nothing}}, ::KernelAbstractions.PO
CL.CLDeviceVector{Float64, 1}, ::KernelAbstractions.POCL.CLDeviceVector{Float64, 1}, ::KernelAbstractions.POCL.CLDeviceVector{Float64, 1}) resulted in invalid LLVM IR
Reason: unsupported call to an external C function (call to cblas_ddot64_)
Reason: unsupported call to a lazy-initialized function (call to cblas_ddot64_)
Interestingly, this gives different errors when the env var CI=true is set, and then an abort:
Call parameter type does not match function signature!
ptr addrspace(1) @ccalllib_libblastrampoline_so_59929
ptr %cblas_ddot64_.found = call ptr @ijl_load_and_lookup(ptr addrspacecast (ptr addrspace(1) @_j_str_libblastrampoline_so_5_3 to ptr), ptr addrspacecast (ptr addrspace(1) @_j_str_cblas_ddot64__2 to ptr), ptr addrspace(1) @ccalllib_lib
blastrampoline_so_59929)
LLVM ERROR: Broken module found, compilation aborted!
[93912] signal 6 (-6): Aborted
Activity
vchuravy commentedon Sep 10, 2026
How does any of this work on the GPU? If you want this x and y should be static arrays.
giordano commentedon Sep 10, 2026
To quickly answer that question: the
_calculate_metrics!kernel in Oceananigans is only ever called on CPU