[Mlir-commits] [mlir] [mlir][vector] Separate bitwidth specific tests out (PR #138071)
Andrzej WarzyĆski
llvmlistbot at llvm.org
Thu May 1 08:31:50 PDT 2025
================
@@ -0,0 +1,56 @@
+// RUN: mlir-opt %s -split-input-file -test-bit-width-constrained-vector-linearize=target-vector-bitwidth=128 | FileCheck %s --check-prefixes=ALL,BW-128
+// RUN: mlir-opt %s -split-input-file -test-bit-width-constrained-vector-linearize=target-vector-bitwidth=0 | FileCheck %s --check-prefixes=ALL,BW-0
+
+// A vector<2x2xf32> has inner-most dimension with 64-bits. Check that at
+// bitwidth threshold 128 (>= 64), operations are linearized, and at
+// bitwidth threshold 0 (< 64), operations are not linearized.
+
+// ALL-LABEL: test_result_bitwidth_64
+func.func @test_result_bitwidth_64(%arg0: vector<2x2xf32>) -> vector<2x2xf32> {
+
+ // BW-128: arith.constant {{.*}} vector<4xf32>
+ // BW-0: arith.constant {{.*}} vector<2x2xf32>
+ %0 = arith.constant dense<[[1.0, 2.0], [3.0, 4.0]]> : vector<2x2xf32>
+
+ // BW-128: math.sin {{.*}} vector<4xf32>
+ // BW-0: math.sin {{.*}} vector<2x2xf32>
+ %1 = math.sin %arg0 : vector<2x2xf32>
+
+ return %0 : vector<2x2xf32>
+}
+
+// -----
+
+// Test that operations with vectors of index type are not linearized.
----------------
banach-space wrote:
I guess for this to work, we'd need to know the bit-width of `index` (i.e. have access to a data layout)? Perhaps it's worth adding a note?
https://github.com/llvm/llvm-project/pull/138071
More information about the Mlir-commits
mailing list