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 broadcast by loop in LinearAlgebra.exp! for StridedMatrixes #54520

Merged
merged 1 commit into from
May 20, 2024

Conversation

jishnub
Copy link
Contributor

@jishnub jishnub commented May 20, 2024

Since the broadcasts are carried out over StridedMatrixes of the same size, we may replace these with explicit loops over the arrays. The loop is much simpler to compile, and this reduces TTFX by quite a bit:

julia> using LinearAlgebra

julia> A = rand(2,2);

julia> @time LinearAlgebra.exp!(A);
  3.253866 seconds (4.85 M allocations: 254.398 MiB, 6.92% gc time, 100.00% compilation time) # nightly v"1.12.0-DEV.558"
  1.819190 seconds (3.76 M allocations: 194.803 MiB, 3.01% gc time, 99.99% compilation time) # this PR

@jishnub jishnub added the domain:linear algebra Linear algebra label May 20, 2024
@dkarrasch dkarrasch merged commit bdd01ca into master May 20, 2024
8 checks passed
@dkarrasch dkarrasch deleted the jishnub/exploop branch May 20, 2024 09:18
KristofferC pushed a commit that referenced this pull request May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants