[Mlir-commits] [mlir] [mlir][Vectorizer] Added support to Vectorize tensor.unpack (PR #76087)

Han-Chung Wang llvmlistbot at llvm.org
Tue Feb 6 21:15:47 PST 2024


================
@@ -1518,6 +1643,19 @@ isValidMaskedInputVector(ArrayRef<int64_t> shape,
   return success();
 }
 
+/// Need to check if the inner-tiles are static/constant.
+static LogicalResult
+vectorizeUnPackOpPreCondition(tensor::UnPackOp unpackOp,
+                              ArrayRef<int64_t> inputVectorSizes) {
+  if (llvm::any_of(unpackOp.getInnerTiles(), [](OpFoldResult res) {
+        return !getConstantIntValue(res).has_value();
+      })) {
+    LDBG("Inner-tiles must be constant: " << unpackOp << "\n");
+    return failure();
+  }
+  return success();
----------------
hanhanW wrote:

We should also check if the inputVectorSizes is valid or not. You can use `isValidMaskedInputVector` method.

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


More information about the Mlir-commits mailing list