[Mlir-commits] [mlir] [mlir][linalg] Introduce transpose semantic to 'linalg.matmul' ops. (PR #104783)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Oct 9 16:20:37 PDT 2024


================
@@ -1172,19 +1240,26 @@ LogicalResult mlir::linalg::detail::verifyStructuredOpInterface(Operation *op) {
 
     // Domain must be consistent.
     unsigned numLoops = linalgOp.getNumLoops();
-    if (indexingMap.getNumDims() != numLoops)
+    if (!isUserDefinedSemantic && indexingMap.getNumDims() != numLoops)
       return op->emitOpError("expected indexing_map #")
              << opOperand.getOperandNumber() << " to have " << numLoops
              << " dim(s) to match the number of loops";
 
     int64_t rank = linalgOp.getRank(&opOperand);
-    if (indexingMap.getNumResults() != rank)
+
+    if (!isUserDefinedSemantic && indexingMap.getNumResults() != rank)
       return op->emitOpError("expected operand rank (")
              << rank << ") to match the result rank of indexing_map #"
              << opOperand.getOperandNumber() << " ("
              << indexingMap.getNumResults() << ")";
-  }
 
+    // Try to verify broadcast/transpose semantic requested through explicit
----------------
MaheshRavishankar wrote:

You dont need to do this here.  Add a `hasVerifier = 1` to the op definition in tablegen file. Then you would need to define a `LogicalResult MatmulOp::verify()` method. You can make this check in that method. AFAICS you should not need any change to the verifier of structured op semantics, but maybe I am missing something here?

https://github.com/llvm/llvm-project/pull/104783


More information about the Mlir-commits mailing list