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

Md Asghar Ahmad Shahid llvmlistbot at llvm.org
Fri Oct 4 08:47:17 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);
----------------
shahidact wrote:

> I dont follow this logic. Maybe this is more complicated that it needs to be. Also `resSet` is defined below and not used. This logic seems like it can be very much simplified.
Thanks, `resSet `is to be cleaned up. 
This function checks if the explicitMap has extraneous dimExpr against corresponding defaultmap results. Suppose for LHS, `explicitMap = affine_map<(d0, d1, d2) -> (d1, d2)>` and `defaultMap = affine_map<(d0, d1, d2) -> (d0, d2)>`. The union of their results is {d0, d1, d2} Where {d1} is extraneous which is not expected.


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


More information about the Mlir-commits mailing list