I am trying to understand what julia uses in a call to mul!
in the following example:
using LinearAlgebra
m,n = 10,5;
A = randn(m,n);
x = randn(n);
Ax = zeros(m);
@code_lowered mul!(Ax, A, x, true, false)
@code_lowered LinearAlgebra.gemv!('N', true, A, x, false, Ax)
@code_lowered BLAS.gemv!('N', true, A, x, false, Ax)
@code_llvm mul!(Ax, A, x, true, false)
@code_llvm LinearAlgebra.gemv!('N', true, A, x, false, Ax)
@code_llvm BLAS.gemv!('N', true, A, x, false, Ax)
julia> @code_lowered mul!(Ax, A, x, true, false)
CodeInfo(
1 β nothing
β %2 = LinearAlgebra.gemv!(y, 'N', A, x, alpha, beta)
βββ return %2
)
julia> @code_lowered @views LinearAlgebra.gemv!('N', true, A, x, false, Ax)
CodeInfo(
1 β nothing
β %2 = Base.replace_ref_begin_end!(x)
β %3 = Base._views(%2)
β %4 = Base.esc(%3)
βββ return %4
)
julia> @code_lowered @views BLAS.gemv!('N', true, A, x, false, Ax)
CodeInfo(
1 β nothing
β %2 = Base.replace_ref_begin_end!(x)
β %3 = Base._views(%2)
β %4 = Base.esc(%3)
βββ return %4
)
julia> LinearAlgebra.gemv! == LinearAlgebra.BLAS.gemv!
false
Repeating the above with @code_llvm
instead of @code_lowered
makes it seem that mul!
calls LinearAlgebra.gemv!
which is the same as BLAS.gemv!
and LinearAlgebra.BLAS.gemv!
. Is there a difference between LinearAlgebra.gemv!
and LinearAlgebra.BLAS.gemv!
? Guessing I have a simple misunderstanding for why LinearAlgebra.gemv! == LinearAlgebra.BLAS.gemv!
is false
.