@@ -3,30 +3,30 @@ LinearSolveBLISExt
33
44Extension module that provides BLIS (BLAS-like Library Instantiation Software) integration
55for LinearSolve.jl. This extension combines BLIS for optimized BLAS operations with
6- reference LAPACK for LAPACK operations, providing a high-performance yet stable linear
7- algebra backend.
6+ libflame for optimized LAPACK operations, providing a fully optimized linear algebra
7+ backend.
88
99Key features:
1010- Uses BLIS for BLAS operations (matrix multiplication, etc.)
11- - Uses reference LAPACK for LAPACK operations (LU factorization, solve, etc.)
11+ - Uses libflame for LAPACK operations (LU factorization, solve, etc.)
1212- Supports all standard numeric types (Float32/64, ComplexF32/64)
1313- Follows MKL-style ccall patterns for consistency
1414"""
1515module LinearSolveBLISExt
1616
1717using Libdl
1818using blis_jll
19- using LAPACK_jll
19+ using libflame_jll
2020using LinearAlgebra
2121using LinearSolve
2222
23- using LinearAlgebra: BlasInt, LU
23+ using LinearAlgebra: BlasInt, LU, libblastrampoline
2424using LinearAlgebra. LAPACK: require_one_based_indexing, chkfinite, chkstride1,
2525 @blasfunc , chkargsok
2626using LinearSolve: ArrayInterface, BLISLUFactorization, @get_cacheval , LinearCache, SciMLBase, do_factorization
2727
2828const global libblis = blis_jll. blis
29- const global liblapack = LAPACK_jll . liblapack_path
29+ const global libflame = libflame_jll . libflame
3030
3131"""
3232 LinearSolve.do_factorization(alg::BLISLUFactorization, A, b, u)
@@ -54,7 +54,7 @@ function getrf!(A::AbstractMatrix{<:ComplexF64};
5454 if isempty (ipiv)
5555 ipiv = similar (A, BlasInt, min (size (A, 1 ), size (A, 2 )))
5656 end
57- ccall ((@blasfunc ( zgetrf_), liblapack ), Cvoid,
57+ ccall ((" zgetrf_" , libflame ), Cvoid,
5858 (Ref{BlasInt}, Ref{BlasInt}, Ptr{ComplexF64},
5959 Ref{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}),
6060 m, n, A, lda, ipiv, info)
@@ -74,7 +74,7 @@ function getrf!(A::AbstractMatrix{<:ComplexF32};
7474 if isempty (ipiv)
7575 ipiv = similar (A, BlasInt, min (size (A, 1 ), size (A, 2 )))
7676 end
77- ccall ((@blasfunc ( cgetrf_), liblapack ), Cvoid,
77+ ccall ((" cgetrf_" , libflame ), Cvoid,
7878 (Ref{BlasInt}, Ref{BlasInt}, Ptr{ComplexF32},
7979 Ref{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}),
8080 m, n, A, lda, ipiv, info)
@@ -94,7 +94,7 @@ function getrf!(A::AbstractMatrix{<:Float64};
9494 if isempty (ipiv)
9595 ipiv = similar (A, BlasInt, min (size (A, 1 ), size (A, 2 )))
9696 end
97- ccall ((@blasfunc ( dgetrf_), liblapack ), Cvoid,
97+ ccall ((" dgetrf_" , libflame ), Cvoid,
9898 (Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64},
9999 Ref{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}),
100100 m, n, A, lda, ipiv, info)
@@ -114,7 +114,7 @@ function getrf!(A::AbstractMatrix{<:Float32};
114114 if isempty (ipiv)
115115 ipiv = similar (A, BlasInt, min (size (A, 1 ), size (A, 2 )))
116116 end
117- ccall ((@blasfunc ( sgetrf_), liblapack ), Cvoid,
117+ ccall ((" sgetrf_" , libflame ), Cvoid,
118118 (Ref{BlasInt}, Ref{BlasInt}, Ptr{Float32},
119119 Ref{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}),
120120 m, n, A, lda, ipiv, info)
@@ -138,7 +138,7 @@ function getrs!(trans::AbstractChar,
138138 throw (DimensionMismatch (" ipiv has length $(length (ipiv)) , but needs to be $n " ))
139139 end
140140 nrhs = size (B, 2 )
141- ccall ((" zgetrs_" , liblapack ), Cvoid,
141+ ccall ((@blasfunc ( zgetrs_), libblis ), Cvoid,
142142 (Ref{UInt8}, Ref{BlasInt}, Ref{BlasInt}, Ptr{ComplexF64}, Ref{BlasInt},
143143 Ptr{BlasInt}, Ptr{ComplexF64}, Ref{BlasInt}, Ptr{BlasInt}, Clong),
144144 trans, n, size (B, 2 ), A, max (1 , stride (A, 2 )), ipiv, B, max (1 , stride (B, 2 )), info,
@@ -163,7 +163,7 @@ function getrs!(trans::AbstractChar,
163163 throw (DimensionMismatch (" ipiv has length $(length (ipiv)) , but needs to be $n " ))
164164 end
165165 nrhs = size (B, 2 )
166- ccall ((" cgetrs_" , liblapack ), Cvoid,
166+ ccall ((@blasfunc ( cgetrs_), libblis ), Cvoid,
167167 (Ref{UInt8}, Ref{BlasInt}, Ref{BlasInt}, Ptr{ComplexF32}, Ref{BlasInt},
168168 Ptr{BlasInt}, Ptr{ComplexF32}, Ref{BlasInt}, Ptr{BlasInt}, Clong),
169169 trans, n, size (B, 2 ), A, max (1 , stride (A, 2 )), ipiv, B, max (1 , stride (B, 2 )), info,
@@ -188,7 +188,7 @@ function getrs!(trans::AbstractChar,
188188 throw (DimensionMismatch (" ipiv has length $(length (ipiv)) , but needs to be $n " ))
189189 end
190190 nrhs = size (B, 2 )
191- ccall ((" dgetrs_" , liblapack ), Cvoid,
191+ ccall ((@blasfunc ( dgetrs_), libblis ), Cvoid,
192192 (Ref{UInt8}, Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
193193 Ptr{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt}, Clong),
194194 trans, n, size (B, 2 ), A, max (1 , stride (A, 2 )), ipiv, B, max (1 , stride (B, 2 )), info,
@@ -213,7 +213,7 @@ function getrs!(trans::AbstractChar,
213213 throw (DimensionMismatch (" ipiv has length $(length (ipiv)) , but needs to be $n " ))
214214 end
215215 nrhs = size (B, 2 )
216- ccall ((" sgetrs_" , liblapack ), Cvoid,
216+ ccall ((@blasfunc ( sgetrs_), libblis ), Cvoid,
217217 (Ref{UInt8}, Ref{BlasInt}, Ref{BlasInt}, Ptr{Float32}, Ref{BlasInt},
218218 Ptr{BlasInt}, Ptr{Float32}, Ref{BlasInt}, Ptr{BlasInt}, Clong),
219219 trans, n, size (B, 2 ), A, max (1 , stride (A, 2 )), ipiv, B, max (1 , stride (B, 2 )), info,
0 commit comments