[Mlir-commits] [mlir] [mlir][linalg] Introduce transpose semantic to 'linalg.matmul' ops. (PR #104783)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Tue Sep 24 15:14:10 PDT 2024
================
@@ -1177,13 +1220,48 @@ LogicalResult mlir::linalg::detail::verifyStructuredOpInterface(Operation *op) {
<< " dim(s) to match the number of loops";
int64_t rank = linalgOp.getRank(&opOperand);
- if (indexingMap.getNumResults() != rank)
+ // Check if matmulOp need broadcast.
+ if (matmulOp)
+ hasBroadcast = matmulOp.hasBroadcastSemantic(opIndex);
+
+ if (!hasBroadcast && indexingMap.getNumResults() != rank)
return op->emitOpError("expected operand rank (")
<< rank << ") to match the result rank of indexing_map #"
<< opOperand.getOperandNumber() << " ("
<< indexingMap.getNumResults() << ")";
- }
+ // For verification of broadcast/transpose, create a temporary broadcasted
+ // type and try to verify the constructed type from the provided types and
+ // indexing maps.
+ if (hasBroadcast) {
+ llvm::SmallVector<AffineMap, 3> defaultIndexingMaps;
+ matmulOp.getDefaultIndexingMaps(defaultIndexingMaps);
----------------
MaheshRavishankar wrote:
Seems excessive to do this for each operand. Could we move this out of the loop?
https://github.com/llvm/llvm-project/pull/104783
More information about the Mlir-commits
mailing list