-
Notifications
You must be signed in to change notification settings - Fork 8
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
Chase down matmul allocation from mul_to! #12
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,16 +27,16 @@ function mutable_operate_to!(C::Vector, ::typeof(*), A::AbstractMatrix, B::Abstr | |
end | ||
|
||
# We need a buffer to hold the intermediate multiplication. | ||
mul_buffer = zero(zero(eltype(A)) * zero(eltype(B))) | ||
for k = 1:mB | ||
aoffs = (k-1)*Astride | ||
mul_buffer = zero(promote_operation(*, eltype(A), eltype(B))) | ||
@inbounds for k = Base.OneTo(mB) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding another There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed, thanks for catching this |
||
aoffs = (k-1) * Astride | ||
b = B[k] | ||
for i = 1:mA | ||
for i = Base.OneTo(mA) | ||
# `C[i] = muladd_buf!(mul_buffer, C[i], A[aoffs + i], b)` | ||
mutable_buffered_operate!(mul_buffer, add_mul, C[i], A[aoffs + i], b) | ||
end | ||
end | ||
end # @inbounds | ||
end | ||
return C | ||
end | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the change that removed the 140 bytes of allocation.