Skip to content

Commit 8c484b7

Browse files
authored
fix: use missing instead of empty string for no jll (#1368)
* fix: use missing instead of empty string for no jll * fix: map symbol if reactant_jll is available
1 parent 1a0b19b commit 8c484b7

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

src/mlir/MLIR.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module API
1010
const mlir_c = if Reactant_jll.is_available()
1111
Reactant_jll.libReactantExtra
1212
else
13-
""
13+
missing
1414
end
1515

1616
# MLIR C API

src/stdlibs/LinearAlgebra.jl

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,28 @@ using ..Reactant:
1414

1515
using ReactantCore: ReactantCore
1616
using ReactantCore: materialize_traced_array
17+
using Reactant_jll: Reactant_jll
1718

1819
using ..TracedUtils: TracedUtils, get_mlir_data, set_mlir_data!
1920

2021
using LinearAlgebra
2122
using Libdl: Libdl
2223

2324
function __init__()
24-
libblastrampoline_handle = Libdl.dlopen(LinearAlgebra.BLAS.libblas)
25-
26-
for (cname, enzymexla_name) in [
27-
(LinearAlgebra.BLAS.@blasfunc(sgetrf_), :enzymexla_lapack_sgetrf_),
28-
(LinearAlgebra.BLAS.@blasfunc(dgetrf_), :enzymexla_lapack_dgetrf_),
29-
(LinearAlgebra.BLAS.@blasfunc(cgetrf_), :enzymexla_lapack_cgetrf_),
30-
(LinearAlgebra.BLAS.@blasfunc(zgetrf_), :enzymexla_lapack_zgetrf_),
31-
]
32-
sym = Libdl.dlsym(libblastrampoline_handle, cname)
33-
@ccall MLIR.API.mlir_c.EnzymeJaXMapSymbol(
34-
enzymexla_name::Cstring, sym::Ptr{Cvoid}
35-
)::Cvoid
25+
if Reactant_jll.is_available()
26+
libblastrampoline_handle = Libdl.dlopen(LinearAlgebra.BLAS.libblas)
27+
28+
for (cname, enzymexla_name) in [
29+
(LinearAlgebra.BLAS.@blasfunc(sgetrf_), :enzymexla_lapack_sgetrf_),
30+
(LinearAlgebra.BLAS.@blasfunc(dgetrf_), :enzymexla_lapack_dgetrf_),
31+
(LinearAlgebra.BLAS.@blasfunc(cgetrf_), :enzymexla_lapack_cgetrf_),
32+
(LinearAlgebra.BLAS.@blasfunc(zgetrf_), :enzymexla_lapack_zgetrf_),
33+
]
34+
sym = Libdl.dlsym(libblastrampoline_handle, cname)
35+
@ccall MLIR.API.mlir_c.EnzymeJaXMapSymbol(
36+
enzymexla_name::Cstring, sym::Ptr{Cvoid}
37+
)::Cvoid
38+
end
3639
end
3740

3841
return nothing

0 commit comments

Comments
 (0)