[Mlir-commits] [mlir] [mlir][vector] Fix invalid IR in `ContractionOpLowering` (PR #78130)

Han-Chung Wang llvmlistbot at llvm.org
Mon Jan 15 16:51:57 PST 2024


================
@@ -458,49 +450,70 @@ struct UnrolledOuterProductGenerator
     return res;
   }
 
+  std::optional<int64_t> getReductionSize(VectorType vecType,
+                                          int64_t reductionDim) {
+    // Cannot unroll scalable dimension.
+    if (vecType.getScalableDims()[reductionDim])
+      return std::nullopt;
+    int64_t reductionSize = vecType.getDimSize(reductionDim);
+    assert(reductionSize > 0 &&
+           "Reduction dim must be a known static size to allow unrolling");
+    return reductionSize;
+  }
+
   /// Two outer parallel, one inner reduction (matmat flavor).
   FailureOr<Value> matmat() {
     if (!iters({Par(), Par(), Red()}))
       return failure();
     // Set up the parallel/reduction structure in the right form.
     AffineExpr m, n, k;
     bindDims(rewriter.getContext(), m, n, k);
-    Value transposedMask = t(mask, {2, 0, 1});
+
----------------
hanhanW wrote:

I think keeping the variable is quite useful in terms of readability. Can we keep it?

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


More information about the Mlir-commits mailing list