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

Targeted stable_muladdmul branches in small matmul #54470

Merged
merged 1 commit into from
May 15, 2024

Conversation

jishnub
Copy link
Contributor

@jishnub jishnub commented May 14, 2024

This PR changes the signature of matmul2x2! and matmul3x3! so that they now accept the alpha and beta parameters instead of the MulAddMul. Consequently, the @stable_muladdmul macro may be applied to smaller blocks of code within the functions instead of applying it to the entire call. This reduces the matrix multiplication latency by a bit.

julia> using LinearAlgebra

julia> A = rand(2,2); B = rand(size(A)...); C = zeros(size(A));

julia> @time mul!(C, A, B);
  0.903632 seconds (2.54 M allocations: 130.322 MiB, 5.52% gc time, 100.00% compilation time) # master
  0.813335 seconds (2.28 M allocations: 117.025 MiB, 2.07% gc time, 100.00% compilation time) # This PR

@jishnub jishnub added domain:linear algebra Linear algebra compiler:latency Compiler latency labels May 14, 2024
@jishnub jishnub changed the title Targetted stable_muladdmul branches in small matmul Targeted stable_muladdmul branches in small matmul May 15, 2024
Copy link
Member

@dkarrasch dkarrasch left a comment

Choose a reason for hiding this comment

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

Awesome!

@jishnub jishnub merged commit d4f0c0e into master May 15, 2024
10 of 12 checks passed
@jishnub jishnub deleted the jishnub/targettedstablemuladdmul branch May 15, 2024 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:latency Compiler latency domain:linear algebra Linear algebra
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants