-
Notifications
You must be signed in to change notification settings - Fork 638
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
[LinalgExt] Scatter fusion by expansion 3/3 #19588
Conversation
c6c862a
to
7cd1fad
Compare
@@ -391,6 +392,197 @@ static std::optional<SmallVector<Value>> fuseAttentionWithReshapeByExpansion( | |||
return resultVals; | |||
} | |||
|
|||
namespace { | |||
class ScatterExpansionInfo { |
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.
I am wondering if we need to replicate all this logic for each op. It seems with a cursory glance that the CollapseInfo
(which can be reused for expansion as well) can just use methods defined by the FusionInterface? Then we should be able to just use that as a tool to get the reassociations we need. The actual math is fairly independent of the op?
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.
The problem I had with that is that the original
operand has a nullptr AffineMap which breaks the logic of CollapseInfo
. We need a way to represent the link between the innermost dims of original
and updates
while also expressing the fact that the outermost dims of original
are not indexed in an AffineMap represent-able way.
I know CustomOp
uses affine symbols which could possibly be useful here? I'm not to familiar with it so I'll need to check.
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.
(see comment below).
Signed-off-by: Ian Wood <[email protected]>
7cd1fad
to
8b870e6
Compare
Signed-off-by: Ian Wood <[email protected]>
Signed-off-by: Ian Wood <[email protected]>
Also, clean up some duplicated logic Signed-off-by: Ian Wood <[email protected]>
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! I didnt verify all the details of the expansion etc, but overall this seems much easier to reuse.
Implements fusion with reshapes by expansion for
LinalgExt::ScatterOp
.TODO: fix >1 dynamic dim (also a problem with attention).
See main issue #19091