Skip to content

Commit 42578e8

Browse files
authored
[mlir][linalg] Use hasPureTensorSemantics in TransposeMatmul methods. (#146438)
The issue is triggered by ee070d0 that checks `TensorLikeType` when downstream projects use the pattern without registering bufferization::BufferizationDialect. The registration is needed because the interface implementation for builtin types locate at `BufferizationDialect::initialize()`. However, we do not need to fix it by the registration. The proper fix is using the linalg method, i.e., hasPureTensorSemantics. No additional tests are added because the functionality is well tested in [transpose-matmul.mlir](https://github.com/llvm/llvm-project/blob/main/mlir/test/Dialect/Linalg/transpose-matmul.mlir). To reproduce the issue, it requires a different setup, e.g., writing a new C++ pass, which seems not worth it. Signed-off-by: hanhanW <[email protected]>
1 parent 5d849d3 commit 42578e8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mlir/lib/Dialect/Linalg/Transforms/TransposeMatmul.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ FailureOr<Operation *> mlir::linalg::transposeMatmul(RewriterBase &rewriter,
3838
matmulOp, "only matmul ops with non-extended semantics are supported");
3939
}
4040

41-
if (!bufferization::hasTensorSemantics(matmulOp))
41+
if (!matmulOp.hasPureTensorSemantics())
4242
return rewriter.notifyMatchFailure(
4343
matmulOp, "only matmul ops with tensors are supported");
4444

@@ -93,7 +93,7 @@ mlir::linalg::transposeBatchMatmul(RewriterBase &rewriter,
9393
batchMatmulOp, "ops with user-defined maps are not supported");
9494
}
9595

96-
if (!bufferization::hasTensorSemantics(batchMatmulOp))
96+
if (!batchMatmulOp.hasPureTensorSemantics())
9797
return rewriter.notifyMatchFailure(
9898
batchMatmulOp, "only matmul ops with tensors are supported");
9999

0 commit comments

Comments
 (0)