[Mlir-commits] [mlir] [mlir][affine] Make --affine-super-vectorize fail if no vector size is specified (PR #114530)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Fri Nov 1 04:17:40 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-affine
Author: Clément Fournier (oowekyala)
<details>
<summary>Changes</summary>
Fix #<!-- -->114528
---
Full diff: https://github.com/llvm/llvm-project/pull/114530.diff
2 Files Affected:
- (modified) mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp (+6)
- (added) mlir/test/Dialect/Affine/SuperVectorize/invalid-no-size.mlir (+9)
``````````diff
diff --git a/mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp b/mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp
index 6bb8dfecba0ec5..6a6c98e7544679 100644
--- a/mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp
@@ -1763,6 +1763,12 @@ void Vectorize::runOnOperation() {
return signalPassFailure();
}
+ if (vectorSizes.empty()) {
+ f.emitError("Vector rank cannot be zero, specify pass option ")
+ << vectorSizes.getArgStr();
+ return signalPassFailure();
+ }
+
if (vectorizeReductions && vectorSizes.size() != 1) {
f.emitError("Vectorizing reductions is supported only for 1-D vectors.");
return signalPassFailure();
diff --git a/mlir/test/Dialect/Affine/SuperVectorize/invalid-no-size.mlir b/mlir/test/Dialect/Affine/SuperVectorize/invalid-no-size.mlir
new file mode 100644
index 00000000000000..8805c4327c6ef3
--- /dev/null
+++ b/mlir/test/Dialect/Affine/SuperVectorize/invalid-no-size.mlir
@@ -0,0 +1,9 @@
+// RUN: mlir-opt %s -verify-diagnostics --affine-super-vectorize
+
+// expected-error at +1 {{Vector rank cannot be zero, specify pass option virtual-vector-size}}
+func.func @with_zero_vector_size(%arg0: memref<21x12x12xi1>) {
+ affine.for %arg1 = 0 to 84 step 4294967295 {
+ }
+ return
+}
+
``````````
</details>
https://github.com/llvm/llvm-project/pull/114530
More information about the Mlir-commits
mailing list