@@ -14,25 +14,28 @@ using ..Reactant:
14
14
15
15
using ReactantCore: ReactantCore
16
16
using ReactantCore: materialize_traced_array
17
+ using Reactant_jll: Reactant_jll
17
18
18
19
using .. TracedUtils: TracedUtils, get_mlir_data, set_mlir_data!
19
20
20
21
using LinearAlgebra
21
22
using Libdl: Libdl
22
23
23
24
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
36
39
end
37
40
38
41
return nothing
0 commit comments