Skip to content

Commit

Permalink
rename helper
Browse files Browse the repository at this point in the history
  • Loading branch information
qedawkins committed Aug 27, 2023
1 parent fa76adb commit 032f13c
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ namespace Flow {

namespace {

// Method to match a transpose operation.
static bool matchNDTranspose(linalg::LinalgOp genericOp, unsigned rank) {
// Method to match a transpose operation on the two most minor dimensions of the
// specified rank.
static bool matchInner2DTranspose(linalg::LinalgOp genericOp, unsigned rank) {
// Only makes sense for minimum rank 2.
if (rank < 2) {
return false;
Expand Down Expand Up @@ -76,7 +77,7 @@ std::optional<Value> matchATransposeBMatmul(linalg::LinalgOp matmulOp) {
}
auto rhs = matmulOp.getDpsInputOperand(1);
auto genericOp = rhs->get().getDefiningOp<linalg::GenericOp>();
if (genericOp && matchNDTranspose(genericOp, 2)) {
if (genericOp && matchInner2DTranspose(genericOp, 2)) {
return genericOp.getDpsInputOperand(0)->get();
}
return std::nullopt;
Expand All @@ -90,7 +91,7 @@ std::optional<Value> matchATransposeBBatchMatmul(linalg::LinalgOp bmmOp) {
}
auto rhs = bmmOp.getDpsInputOperand(1);
auto genericOp = rhs->get().getDefiningOp<linalg::GenericOp>();
if (genericOp && matchNDTranspose(genericOp, 3)) {
if (genericOp && matchInner2DTranspose(genericOp, 3)) {
return genericOp.getDpsInputOperand(0)->get();
}
return std::nullopt;
Expand Down

0 comments on commit 032f13c

Please sign in to comment.