Skip to content

Commit 727a57e

Browse files
authored
Read views of destination in adjoint * adjoint (#56138)
Also, add an aggressive constprop annotation to `generic_matvecmul!`. Together, these improve performance: ```julia julia> A = rand(Int,100,100); julia> @Btime $A' * $A'; 290.203 μs (405 allocations: 175.98 KiB) # v"1.12.0-DEV.1364" 270.008 μs (5 allocations: 79.11 KiB) # This PR ```
1 parent bbd8158 commit 727a57e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

stdlib/LinearAlgebra/src/matmul.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,7 @@ end
825825
# NOTE: the generic version is also called as fallback for
826826
# strides != 1 cases
827827

828-
generic_matvecmul!(C::AbstractVector, tA, A::AbstractVecOrMat, B::AbstractVector, alpha::Number, beta::Number) =
828+
Base.@constprop :aggressive generic_matvecmul!(C::AbstractVector, tA, A::AbstractVecOrMat, B::AbstractVector, alpha::Number, beta::Number) =
829829
@stable_muladdmul generic_matvecmul!(C, tA, A, B, MulAddMul(alpha, beta))
830830
@inline function generic_matvecmul!(C::AbstractVector, tA, A::AbstractVecOrMat, B::AbstractVector,
831831
_add::MulAddMul = MulAddMul())
@@ -957,7 +957,7 @@ Base.@constprop :aggressive generic_matmatmul!(C::AbstractVecOrMat, tA, tB, A::A
957957
ta = t(_add.alpha)
958958
for i in AxM
959959
mul!(tmp, pB, view(pA, :, i))
960-
C[ci,:] .+= t.(ta .* tmp)
960+
@views C[ci,:] .+= t.(ta .* tmp)
961961
ci += 1
962962
end
963963
else

0 commit comments

Comments
 (0)