-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Use mul! in Diagonal*Matrix #42321
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
Merged
Merged
Use mul! in Diagonal*Matrix #42321
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
bc0aa8a
use mul! in Diagonal*Matrix of numbers
jishnub 211a574
Add comment
jishnub e237daa
runtime checks to avoid ambiguities
jishnub fcdc986
Force destination to be a Matrix
jishnub 7ce858c
Require one-based indices
jishnub 5152902
don't specialize * for numbers
jishnub f380284
don't specialize for triangular
jishnub 744c336
don't use in as a variable
jishnub 911dbd6
use branch in five-element mul
jishnub 43671e1
Add test for 5-element mul
jishnub 36a0109
simplify size mismatch error check
jishnub 0a268c2
fix mul! broadcasting
jishnub 9761a58
mul! with Diagonal output and add zero and one
jishnub bf17e13
bugfix in mul for diagonal output
jishnub 44d19fe
Specialize oneunit for Diagonal
jishnub 1f66595
replace conflicting definition for one(::Diagonal)
jishnub File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,8 @@ | |
# inside this function. | ||
function *ₛ end | ||
Broadcast.broadcasted(::typeof(*ₛ), out, beta) = | ||
iszero(beta::Number) ? false : broadcasted(*, out, beta) | ||
iszero(beta::Number) ? false : | ||
isone(beta::Number) ? broadcasted(identity, out) : broadcasted(*, out, beta) | ||
Comment on lines
10
to
+12
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. This change might introduce more instability? |
||
|
||
""" | ||
MulAddMul(alpha, beta) | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
rmul!
andlmul!
won't be vectorlized on master as it is a self-inplace broadcast. (4x slower)Add
@inline
is useless here. Without fix like #43185, the only solution is recoding with for-loop.But this should not be caught by CI as the test size is usually small.
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.
Thanks for taking a look, @N5N3! I vaguely remember that you proposed in a similar situation the fix by inlining the rhs. Why doesn't that help here?
Uh oh!
There was an error while loading. Please reload this page.
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.
IIUC, our broadcast unaliases the
src
from thedest
to avoid memory contention, which prevents LLVM to provedest === src
.Our for-loop based implement doesn't include such unaliasing stage, thus
@inline
is enough to enable simd.