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

Renato Golin llvmlistbot at llvm.org
Thu Oct 10 03:00:03 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
----------------
rengolin wrote:

We don't need to verify everything in all places, as long as it's checked in one place, it's ok.

So here, just move the call to `verifyExtendedMatmulSemantic` to `Matmul::verify()` and we're done.

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


More information about the Mlir-commits mailing list