[Mlir-commits] [mlir] [mlir][vector] Support scalable vectors when unrolling vector.bitcast (PR #94197)

Andrzej WarzyƄski llvmlistbot at llvm.org
Tue Jun 11 07:59:06 PDT 2024


================
@@ -38,8 +38,30 @@ func.func @vector_bitcast_4d_with_scalable_dim(%arg0: vector<1x2x[3]x4xi64>) ->
   return %0 : vector<1x2x[3]x8xi32>
 }
 // CHECK-LABEL: func.func @vector_bitcast_4d_with_scalable_dim
-// CHECK:         vector.bitcast {{.+}} : vector<1x2x[3]x4xi64> to vector<1x2x[3]x8xi32>
+// CHECK-SAME:    %[[IN:[a-zA-Z0-9]+]]
+// CHECK:         %[[INIT:.+]] = arith.constant dense<0> : vector<1x2x[3]x8xi32>
+// CHECK:         %[[V1:.+]] = vector.extract %[[IN]][0, 0] : vector<[3]x4xi64> from vector<1x2x[3]x4xi64>
+// CHECK:         %[[B1:.+]] = vector.bitcast %[[V1]] : vector<[3]x4xi64> to vector<[3]x8xi32>
+// CHECK:         %[[R1:.+]] = vector.insert %[[B1]], %[[INIT]] [0, 0] : vector<[3]x8xi32> into vector<1x2x[3]x8xi32>
+// CHECK:         %[[V2:.+]] = vector.extract %[[IN]][0, 1] : vector<[3]x4xi64> from vector<1x2x[3]x4xi64>
+// CHECK:         %[[B2:.+]] = vector.bitcast %[[V2]] : vector<[3]x4xi64> to vector<[3]x8xi32>
+// CHECK:         %[[R2:.+]] = vector.insert %[[B2]], %[[R1]] [0, 1] : vector<[3]x8xi32> into vector<1x2x[3]x8xi32>
+// CHECK:         return %[[R2]] : vector<1x2x[3]x8xi32>
 
+func.func @vector_bitcast_2d_trailing_scalable_dim(%arg0: vector<2x[2]xi64>) -> vector<2x[4]xi32> {
+  %0 = vector.bitcast %arg0 : vector<2x[2]xi64> to vector<2x[4]xi32>
+  return %0 : vector<2x[4]xi32>
+}
----------------
banach-space wrote:

Could you add a negative test too? That would be `@vector_bitcast_2d_leading_scalable_dim` I guess.

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


More information about the Mlir-commits mailing list