Skip to content

Commit

Permalink
Read views of destination in adjoint * adjoint (#56138)
Browse files Browse the repository at this point in the history
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
```
  • Loading branch information
jishnub authored Oct 17, 2024
1 parent bbd8158 commit 727a57e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions stdlib/LinearAlgebra/src/matmul.jl
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ end
# NOTE: the generic version is also called as fallback for
# strides != 1 cases

generic_matvecmul!(C::AbstractVector, tA, A::AbstractVecOrMat, B::AbstractVector, alpha::Number, beta::Number) =
Base.@constprop :aggressive generic_matvecmul!(C::AbstractVector, tA, A::AbstractVecOrMat, B::AbstractVector, alpha::Number, beta::Number) =
@stable_muladdmul generic_matvecmul!(C, tA, A, B, MulAddMul(alpha, beta))
@inline function generic_matvecmul!(C::AbstractVector, tA, A::AbstractVecOrMat, B::AbstractVector,
_add::MulAddMul = MulAddMul())
Expand Down Expand Up @@ -957,7 +957,7 @@ Base.@constprop :aggressive generic_matmatmul!(C::AbstractVecOrMat, tA, tB, A::A
ta = t(_add.alpha)
for i in AxM
mul!(tmp, pB, view(pA, :, i))
C[ci,:] .+= t.(ta .* tmp)
@views C[ci,:] .+= t.(ta .* tmp)
ci += 1
end
else
Expand Down

2 comments on commit 727a57e

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily package evaluation, I will reply here when finished:

@nanosoldier runtests(isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The package evaluation job you requested has completed - possible new issues were detected.
The full report is available.

Please sign in to comment.