Skip to content

Commit 42fdea5

Browse files
authored
Use OpTrait to check for elementwise ops (#955)
1 parent b2742c3 commit 42fdea5

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

lib/Dialect/XeTile/Transforms/WgToSg.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -750,14 +750,6 @@ class WGToSGVectorBroadcast
750750
}
751751
};
752752

753-
754-
// TODO: Add more pre-ops
755-
bool isElementWiseOp(mlir::Operation *op) {
756-
return llvm::isa<mlir::arith::AddFOp>(op) ||
757-
llvm::isa<mlir::arith::MulFOp>(op) ||
758-
llvm::isa<mlir::math::ExpOp>(op);
759-
}
760-
761753
// Helper function to analyze the def-use chain of initTileOps. Currently we
762754
// pattern match the following def-use chain as a candidate for
763755
// load + tranpose optimization.
@@ -813,7 +805,7 @@ void analyzeInitTileOps(mlir::Operation *op) {
813805
// Check if vector.transpose is consumed by TileMMA directly or
814806
// is consumed by some pre-op and then TileMMA.
815807
if(!llvm::isa<imex::xetile::TileMMAOp>(consumerOp)){
816-
if(!isElementWiseOp(consumerOp) &&
808+
if(!OpTrait::hasElementwiseMappableTraits(consumerOp) &&
817809
!(llvm::isa<mlir::vector::BroadcastOp>(consumerOp))) {
818810
return mlir::WalkResult::skip();
819811
}
@@ -834,7 +826,6 @@ void analyzeInitTileOps(mlir::Operation *op) {
834826
});
835827
}
836828

837-
838829
void populateXeTileWgToSgPatterns(imex::XeOneToNTypeConverter &converter,
839830
mlir::RewritePatternSet &patterns,
840831
TileUsageAnalysis &analysis) {

0 commit comments

Comments
 (0)