Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace MulAddMul by alpha,beta in __muldiag #56360

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Conversation

jishnub
Copy link
Contributor

@jishnub jishnub commented Oct 28, 2024

This PR replaces MulAddMul arguments by alpha, beta pairs in the multiplication methods involving Diagonal matrices, and constructs the objects exactly where they are required. Such an approach improves latency.

julia> D = Diagonal(1:2000); A = rand(size(D)...); C = similar(A);

julia> @time mul!(C, A, D, 1, 2); # first-run latency is reduced
  0.129741 seconds (180.18 k allocations: 9.607 MiB, 88.87% compilation time) # nightly v"1.12.0-DEV.1505"
  0.083005 seconds (146.68 k allocations: 7.442 MiB, 82.94% compilation time) # this PR

julia> @btime mul!($C, $A, $D, 1, 2); # runtime performance is unaffected 
  4.983 ms (0 allocations: 0 bytes) # nightly
  4.938 ms (0 allocations: 0 bytes) # this PR

This PR sets the stage for a similar change for Bidiagonal/Tridiaognal matrices, which would lead to a bigger reduction in latencies.

@jishnub jishnub marked this pull request as ready for review October 29, 2024 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:latency Compiler latency linear algebra Linear algebra
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant