-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BACKEND] Canonicalize ReshapeOp even if not allowing reorder (#5752)
The `getAllowReorder` check was added in #2676, but the canonicalizations are value-preserving so this is not required. Specifically: - `reshape(splat) -> splat`, order is irrelevant for splat - `reshape(reshape) -> reshape`, reshape essentially treats the input as 1d, so the input reshape has no effect.
- Loading branch information
1 parent
c75c6b0
commit a5d90d0
Showing
5 changed files
with
66 additions
and
23 deletions.
There are no files selected for viewing
This file contains 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 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 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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#ifndef TT_PATTERNS | ||
#define TT_PATTERNS | ||
|
||
include "mlir/IR/PatternBase.td" | ||
include "triton/Dialect/Triton/IR/TritonOps.td" | ||
|
||
// broadcast(splat(x)) -> splat(x) | ||
def BroadcastSplatPattern : | ||
Pat<(TT_BroadcastOp (TT_SplatOp $x)), | ||
(TT_SplatOp $x)>; | ||
|
||
// broadcast(broadcast(x)) -> broadcast(x) | ||
def BroadcastBroadcastPattern : | ||
Pat<(TT_BroadcastOp (TT_BroadcastOp $x)), | ||
(TT_BroadcastOp $x)>; | ||
|
||
#endif |
This file contains 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 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