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

Narrower MulAddMul stabilization in bidiag mul! #56362

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

jishnub
Copy link
Contributor

@jishnub jishnub commented Oct 28, 2024

This builds on #56360, so it would be easier to review by rebasing after that one is merged.

This PR reduces latency for mul! involving Bidiagonal matrices.

julia> using LinearAlgebra

julia> B = Bidiagonal(1:4, 1:3, :U); D = Diagonal(B); C = similar(B, size(B));

julia> @time mul!(C, B, D, 2, 2);
  0.117434 seconds (243.24 k allocations: 12.758 MiB, 99.97% compilation time) # nightly
  0.054078 seconds (122.71 k allocations: 6.076 MiB, 99.94% compilation time)
julia> @time mul!(C, B, B, 2, 2);
  0.716847 seconds (1.89 M allocations: 93.264 MiB, 16.74% gc time, 99.99% compilation time) # nightly
  0.493675 seconds (1.04 M allocations: 52.477 MiB, 24.34% gc time, 99.99% compilation time) # this PR
julia> B = Bidiagonal(1:4, 1:3, :U); A = Array(B); C = similar(B, size(B));

julia> @time mul!(C, A, B, 2, 2);
  0.287015 seconds (325.09 k allocations: 16.715 MiB, 10.32% gc time, 99.95% compilation time) # nightly
  0.220946 seconds (250.40 k allocations: 12.395 MiB, 15.51% gc time, 99.99% compilation time) # this PR
julia> B = Bidiagonal(1:4, 1:3, :U); v = rand(size(B,2)); C = similar(v);

julia> @time mul!(C, B, v, 2, 2);
  0.351700 seconds (570.67 k allocations: 30.650 MiB, 8.00% gc time, 99.99% compilation time) # nightly
  0.272777 seconds (901.02 k allocations: 47.221 MiB, 10.34% gc time, 99.99% compilation time) # this PR

@jishnub jishnub added the linear algebra Linear algebra label Oct 28, 2024
@jishnub jishnub marked this pull request as draft October 28, 2024 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
linear algebra Linear algebra
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant