From 6815fa340716a7f5a7cf82eefe93edb12e11217a Mon Sep 17 00:00:00 2001 From: hanhanW Date: Mon, 30 Jun 2025 17:14:08 -0700 Subject: [PATCH] [mlir][linalg] Use hasPureTensorSemantics in TransposeMatmul methods. The issue is triggered by https://github.com/llvm/llvm-project/commit/ee070d08163ac09842d9bf0c1315f311df39faf1 that checks `TensorLikeType` when downstream projects use the pattern without registering bufferization::BufferizationDialect. The registeration is needed because the interface implementation for builtin types locate at `BufferizationDialect::initialize()`. However, we do not need to fix it by the registeration. The proper fix is using the linalg method, i.e., hasPureTensorSemantics. Signed-off-by: hanhanW --- mlir/lib/Dialect/Linalg/Transforms/TransposeMatmul.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mlir/lib/Dialect/Linalg/Transforms/TransposeMatmul.cpp b/mlir/lib/Dialect/Linalg/Transforms/TransposeMatmul.cpp index e624f589917d1..233f180e48be0 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/TransposeMatmul.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/TransposeMatmul.cpp @@ -38,7 +38,7 @@ FailureOr mlir::linalg::transposeMatmul(RewriterBase &rewriter, matmulOp, "only matmul ops with non-extended semantics are supported"); } - if (!bufferization::hasTensorSemantics(matmulOp)) + if (!matmulOp.hasPureTensorSemantics()) return rewriter.notifyMatchFailure( matmulOp, "only matmul ops with tensors are supported"); @@ -93,7 +93,7 @@ mlir::linalg::transposeBatchMatmul(RewriterBase &rewriter, batchMatmulOp, "ops with user-defined maps are not supported"); } - if (!bufferization::hasTensorSemantics(batchMatmulOp)) + if (!batchMatmulOp.hasPureTensorSemantics()) return rewriter.notifyMatchFailure( batchMatmulOp, "only matmul ops with tensors are supported");