[BACKEND] Optimization to sink broadcast ops#2274
Merged
ptillet merged 1 commit intotriton-lang:mainfrom Sep 13, 2023
Merged
Conversation
Try to move broadcast ops after arithmetic and convert ops in order to reduce the amount of work needed.
peterbell10
reviewed
Sep 11, 2023
| seenBroadcast = true; | ||
| srcType = broadcastOp.getSrc().getType(); | ||
| } else if (srcType != broadcastOp.getSrc().getType()) { | ||
| // If the broadcast have different types we cannot re-order. |
Contributor
There was a problem hiding this comment.
This is a nice improvement. I think you can generalize it slightly further by having a common srcShape and allowing the scalar types to differ. This would allow the pattern to work for AddPtrOp for example.
Collaborator
Author
There was a problem hiding this comment.
sorry for the delay, thanks for the advice. I'm sending another PR to handle this.
peterbell10
reviewed
Sep 11, 2023
| return isa<arith::ExtSIOp, arith::ExtUIOp, arith::ExtFOp>(op); | ||
| auto isExtOrBroadcastOp = [](Operation *op) { | ||
| return isa<arith::ExtSIOp, arith::ExtUIOp, arith::ExtFOp, | ||
| triton::BroadcastOp>(op); |
Contributor
There was a problem hiding this comment.
Could this apply to ExpandDim and Splat as well?
Collaborator
Author
There was a problem hiding this comment.
Splat takes a scalar source so it is already handled. I'll extend to ExpandDim
ptillet
approved these changes
Sep 13, 2023
ThomasRaoux
added a commit
that referenced
this pull request
Sep 18, 2023
Improve patterns that sync broadcast to reduce the arithmetic density and also hoist convert on top of expand_dims to do less work. This address comments in #2274
ThomasRaoux
added a commit
that referenced
this pull request
Sep 18, 2023
Improve patterns that sync broadcast to reduce the arithmetic density and also hoist convert on top of expand_dims to do less work. This address comments in #2274
ptillet
pushed a commit
that referenced
this pull request
Sep 18, 2023
) Improve patterns that sync broadcast to reduce the arithmetic density and also hoist convert on top of expand_dims to do less work. This address comments in #2274
alexander-zinoviev
pushed a commit
to alexander-zinoviev/triton
that referenced
this pull request
Sep 21, 2023
Try to move broadcast ops after arithmetic and convert ops in order to reduce the amount of work needed.
alexander-zinoviev
pushed a commit
to alexander-zinoviev/triton
that referenced
this pull request
Sep 21, 2023
…iton-lang#2331) Improve patterns that sync broadcast to reduce the arithmetic density and also hoist convert on top of expand_dims to do less work. This address comments in triton-lang#2274
pingzhuu
pushed a commit
to siliconflow/triton
that referenced
this pull request
Apr 2, 2024
Try to move broadcast ops after arithmetic and convert ops in order to reduce the amount of work needed.
pingzhuu
pushed a commit
to siliconflow/triton
that referenced
this pull request
Apr 2, 2024
…iton-lang#2331) Improve patterns that sync broadcast to reduce the arithmetic density and also hoist convert on top of expand_dims to do less work. This address comments in triton-lang#2274
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Try to move broadcast ops after arithmetic and convert ops in order to reduce the amount of work needed.