[Mlir-commits] [mlir] [mlir][Vector] Add utility for computing scalable value bounds (PR #83876)
Andrzej WarzyĆski
llvmlistbot at llvm.org
Tue Mar 19 10:38:14 PDT 2024
================
@@ -0,0 +1,140 @@
+// RUN: mlir-opt %s -test-affine-reify-value-bounds -cse -verify-diagnostics \
+// RUN: -verify-diagnostics -split-input-file | FileCheck %s
+
+#fixedDim0Map = affine_map<(d0)[s0] -> (-d0 + 32400, s0)>
+#fixedDim1Map = affine_map<(d0)[s0] -> (-d0 + 16, s0)>
+
+// Here the upper bound for min_i is 4 x vscale, as we know 4 x vscale is
+// always less than 32400. The bound for min_j is 16 as at vscale > 4,
+// 4 x vscale will be > 16, so the value will be clamped at 16.
+
+// CHECK: #[[$SCALABLE_BOUND_MAP_0:.*]] = affine_map<()[s0] -> (s0 * 4)>
+
+// CHECK-LABEL: @fixed_size_loop_nest
+// CHECK-DAG: %[[VSCALE:.*]] = vector.vscale
+// CHECK-DAG: %[[SCALABLE_BOUND:.*]] = affine.apply #[[$SCALABLE_BOUND_MAP_0]]()[%[[VSCALE]]]
+// CHECK-DAG: %[[C16:.*]] = arith.constant 16 : index
----------------
banach-space wrote:
[nit] This is mostly me reading and parsing the test, but others could also find the suggested names easier to follow.
```suggestion
// CHECK-DAG: %[[UB_i.*]] = affine.apply #[[$SCALABLE_BOUND_MAP_0]]()[%[[VSCALE]]]
// CHECK-DAG: %[[UB_j:.*]] = arith.constant 16 : index
```
https://github.com/llvm/llvm-project/pull/83876
More information about the Mlir-commits
mailing list