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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Oct 3 11:23:15 PDT 2024


================
@@ -1139,9 +1145,76 @@ int64_t LinalgOp::getIndexingMapIndex(OpOperand *opOperand) {
          operandNumber - start;
 }
 
+/// Returns true if the result AffineExpr of the \p explicitMap is same as \p
+/// defaultMap.
+static bool isValidResultDimExprs(AffineMap explictMap, AffineMap defaultMap) {
+  auto explicitRange = explictMap.getResults();
+  auto defaultRange = defaultMap.getResults();
+  DenseSet<AffineExpr> explicitSet(explicitRange.begin(), explicitRange.end());
+  DenseSet<AffineExpr> defaultSet(defaultRange.begin(), defaultRange.end());
+  llvm::set_union(explicitSet, defaultSet);
+  DenseSet<AffineExpr> resSet(explicitSet.begin(), explicitSet.end());
+  return explicitSet == defaultSet;
+}
+
+/// Verifies the broadcast and transpose semantic sepecified by the explicit
+/// indexing map for the MatmulOp \p op for each operand specified by \p
+/// opIndex.
+static LogicalResult verifyExtendedSemantic(Operation *op, unsigned opIndex) {
----------------
MaheshRavishankar wrote:

Please rename this `verifyExtendedMatmuSemantic` and make the operation take an explicit `linalg::MatmulOp` . This isnt general method for all operations anyway.

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


More information about the Mlir-commits mailing list