[Mlir-commits] [mlir] [mlir][linalg] Move transpose_matmul to targeted transform op (PR #89717)
Cullen Rhodes
llvmlistbot at llvm.org
Tue Apr 23 01:57:55 PDT 2024
================
@@ -3422,6 +3416,34 @@ DiagnosedSilenceableFailure transform::TransposeConv2DOp::applyToOne(
return DiagnosedSilenceableFailure::success();
}
+//===----------------------------------------------------------------------===//
+// TransposeMatmulOp
+//===----------------------------------------------------------------------===//
+
+DiagnosedSilenceableFailure transform::TransposeMatmulOp::applyToOne(
+ transform::TransformRewriter &rewriter, linalg::LinalgOp target,
+ transform::ApplyToEachResultList &results,
+ transform::TransformState &state) {
+ rewriter.setInsertionPoint(target);
+ bool transposeLHS = getInputToTranspose() == TransposeMatmulInput::lhs;
+ auto maybeTransformed =
+ TypeSwitch<Operation *, FailureOr<Operation *>>(target)
+ .Case([&](linalg::MatmulOp op) {
+ return transposeMatmul(rewriter, op, transposeLHS);
+ })
+ .Case([&](linalg::BatchMatmulOp op) {
+ return transposeBatchMatmul(rewriter, op, transposeLHS);
+ })
+ .Default([&](Operation *op) {
+ return rewriter.notifyMatchFailure(op, "not supported");
+ });
+ if (failed(maybeTransformed))
+ return emitDefaultSilenceableFailure(target);
----------------
c-rhodes wrote:
I've updated it to simply return failure from the TypeSwitch for unsupported op and emit a message here instead.
https://github.com/llvm/llvm-project/pull/89717
More information about the Mlir-commits
mailing list