diff --git a/mlir/test/Dialect/Vector/linearize-subject-to-bitwidth.mlir b/mlir/test/Dialect/Vector/linearize-subject-to-bitwidth.mlir new file mode 100644 index 0000000000000..739fb2fb8b68b --- /dev/null +++ b/mlir/test/Dialect/Vector/linearize-subject-to-bitwidth.mlir @@ -0,0 +1,58 @@ +// 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> +} + +// ----- + +// The size of the 'index' type is backend specific, so we cannot guarantee that +// the inner-most dimension below (of size 2*nbBits(index)) is below any bitwidth +// threshold. Test that operations with vectors of index type are not linearized. + +// ALL-LABEL: test_index_no_linearize +func.func @test_index_no_linearize(%arg0: vector<2x2xindex>, %arg1: vector<2x2xindex>) -> vector<2x2xindex> { + + // BW-128: %[[ADD:.*]] = arith.addi {{.*}} : vector<2x2xindex> + // BW-0: %[[ADD:.*]] = arith.addi {{.*}} : vector<2x2xindex> + %0 = arith.addi %arg0, %arg1 : vector<2x2xindex> + return %0 : vector<2x2xindex> +} + +// ----- + +// The logic for the insert op with regards to the bitwidth threshold is +// different to the other ops, so we test it here. Specifically, the logic +// is based on the bitwidth of the value to store. + +// ALL-LABEL: test_vector_insert +// ALL-SAME: (%[[DEST:.*]]: vector<2x8x4xf32>, %[[SRC:.*]]: vector<8x4xf32>) -> vector<2x8x4xf32> { +func.func @test_vector_insert(%arg0: vector<2x8x4xf32>, %arg1: vector<8x4xf32>) -> vector<2x8x4xf32> { + + // BW-128-DAG: %[[ARG_SRC:.*]] = vector.shape_cast %[[SRC]] : vector<8x4xf32> to vector<32xf32> + // BW-128-DAG: %[[ARG_DEST:.*]] = vector.shape_cast %[[DEST]] : vector<2x8x4xf32> to vector<64xf32> + // BW-128: %[[SHUFFLE:.*]] = vector.shuffle %[[ARG_DEST]], %[[ARG_SRC]] + // BW-128: %[[RES:.*]] = vector.shape_cast %[[SHUFFLE]] : vector<64xf32> to vector<2x8x4xf32> + // BW-128: return %[[RES]] : vector<2x8x4xf32> + + // BW-0: %[[RES:.*]] = vector.insert %[[SRC]], %[[DEST]] [0] : vector<8x4xf32> into vector<2x8x4xf32> + // BW-0: return %[[RES]] : vector<2x8x4xf32> + + %0 = vector.insert %arg1, %arg0[0]: vector<8x4xf32> into vector<2x8x4xf32> + return %0 : vector<2x8x4xf32> +} diff --git a/mlir/test/Dialect/Vector/linearize.mlir b/mlir/test/Dialect/Vector/linearize.mlir index 20169c15eb2c1..01ad1ac48b012 100644 --- a/mlir/test/Dialect/Vector/linearize.mlir +++ b/mlir/test/Dialect/Vector/linearize.mlir @@ -1,115 +1,77 @@ -// RUN: mlir-opt %s -split-input-file -test-vector-linearize -verify-diagnostics | FileCheck %s --check-prefixes=ALL,DEFAULT +// RUN: mlir-opt %s -split-input-file -test-vector-linearize -verify-diagnostics | FileCheck %s -// RUN: mlir-opt %s -split-input-file -test-bit-width-constrained-vector-linearize=target-vector-bitwidth=128 -verify-diagnostics | 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 - -// ALL-LABEL: test_linearize -// ALL-SAME: (%[[ORIG_ARG:.*]]: vector<2x2xf32>) +// CHECK-LABEL: test_linearize +// CHECK-SAME: (%[[ORIG_ARG:.*]]: vector<2x2xf32>) func.func @test_linearize(%arg0: vector<2x2xf32>) -> vector<2x2xf32> { - // DEFAULT: %[[ARG:.*]] = vector.shape_cast %[[ORIG_ARG]] : vector<2x2xf32> to vector<4xf32> - // DEFAULT: %[[CST:.*]] = arith.constant dense<[1.000000e+00, 2.000000e+00, 3.000000e+00, 4.000000e+00]> : vector<4xf32> - // DEFAULT: %[[RES:.*]] = vector.shape_cast %[[CST]] : vector<4xf32> to vector<2x2xf32> - - // BW-128: %[[ARG:.*]] = vector.shape_cast %[[ORIG_ARG]] : vector<2x2xf32> to vector<4xf32> - // BW-128: %[[CST:.*]] = arith.constant dense<[1.000000e+00, 2.000000e+00, 3.000000e+00, 4.000000e+00]> : vector<4xf32> - // BW-128: %[[RES:.*]] = vector.shape_cast %[[CST]] : vector<4xf32> to vector<2x2xf32> - // BW-0: %[[RES:.*]] = arith.constant dense<{{.*}}> : vector<2x2xf32> + // CHECK: %[[ARG:.*]] = vector.shape_cast %[[ORIG_ARG]] : vector<2x2xf32> to vector<4xf32> + // CHECK: %[[CST:.*]] = arith.constant dense<[1.000000e+00, 2.000000e+00, 3.000000e+00, 4.000000e+00]> : vector<4xf32> + // CHECK: %[[RES:.*]] = vector.shape_cast %[[CST]] : vector<4xf32> to vector<2x2xf32> %0 = arith.constant dense<[[1.0, 2.0], [3.0, 4.0]]> : vector<2x2xf32> - // DEFAULT: %{{.*}} = math.sin %[[ARG]] : vector<4xf32> - // BW-128: %{{.*}} = math.sin %[[ARG]] : vector<4xf32> - // BW-0: %{{.*}} = math.sin %{{.*}} : vector<2x2xf32> + // CHECK: %{{.*}} = math.sin %[[ARG]] : vector<4xf32> %1 = math.sin %arg0 : vector<2x2xf32> - // DEFAULT: %{{.*}} = arith.addf %[[ARG]], %[[CST]] : vector<4xf32> - // BW-128: %{{.*}} = arith.addf %[[ARG]], %[[CST]] : vector<4xf32> - // BW-0: %{{.*}} = arith.addf %{{.*}} : vector<2x2xf32> + // CHECK: %{{.*}} = arith.addf %[[ARG]], %[[CST]] : vector<4xf32> %2 = arith.addf %arg0, %0 : vector<2x2xf32> - // ALL: return %[[RES]] : vector<2x2xf32> + // CHECK: return %[[RES]] : vector<2x2xf32> return %0 : vector<2x2xf32> } // ----- -// ALL-LABEL: test_linearize_poison +// CHECK-LABEL: test_linearize_poison func.func @test_linearize_poison() -> vector<2x2xf32> { - // DEFAULT: %[[POISON:.*]] = ub.poison : vector<4xf32> - // DEFAULT: %[[RES:.*]] = vector.shape_cast %[[POISON]] : vector<4xf32> to vector<2x2xf32> - // BW-128: %[[POISON:.*]] = ub.poison : vector<4xf32> - // BW-128: %[[RES:.*]] = vector.shape_cast %[[POISON]] : vector<4xf32> to vector<2x2xf32> - - // BW-0: %[[RES:.*]] = ub.poison : vector<2x2xf32> + // CHECK: %[[POISON:.*]] = ub.poison : vector<4xf32> + // CHECK: %[[RES:.*]] = vector.shape_cast %[[POISON]] : vector<4xf32> to vector<2x2xf32> %0 = ub.poison : vector<2x2xf32> - // ALL: return %[[RES]] : vector<2x2xf32> + + // CHECK: return %[[RES]] : vector<2x2xf32> return %0 : vector<2x2xf32> } // ----- -// ALL-LABEL: test_partial_linearize -// ALL-SAME: (%[[ORIG_ARG:.*]]: vector<2x2xf32>, %[[ORIG_ARG2:.*]]: vector<4x4xf32>) +// CHECK-LABEL: test_partial_linearize +// CHECK-SAME: (%[[ORIG_ARG:.*]]: vector<2x2xf32>, %[[ORIG_ARG2:.*]]: vector<4x4xf32>) func.func @test_partial_linearize(%arg0: vector<2x2xf32>, %arg1: vector<4x4xf32>) -> vector<2x2xf32> { - // DEFAULT-DAG: %[[ARG:.*]] = vector.shape_cast %[[ORIG_ARG]] : vector<2x2xf32> to vector<4xf32> - // DEFAULT-DAG: %[[ARG2:.*]] = vector.shape_cast %[[ORIG_ARG2]] : vector<4x4xf32> to vector<16xf32> - // DEFAULT: %[[CST:.*]] = arith.constant dense<{{.*}}> : vector<4xf32> - // DEFAULT: %[[RES:.*]] = vector.shape_cast %[[CST]] : vector<4xf32> to vector<2x2xf32> - // BW-128: %[[ARG:.*]] = vector.shape_cast %[[ORIG_ARG]] : vector<2x2xf32> to vector<4xf32> - // BW-128: %[[CST:.*]] = arith.constant dense<{{.*}}> : vector<4xf32> - // BW-128: %[[RES:.*]] = vector.shape_cast %[[CST]] : vector<4xf32> to vector<2x2xf32> - - // BW-0: %[[RES:.*]] = arith.constant dense<{{.*}}> : vector<2x2xf32> + // CHECK-DAG: %[[ARG:.*]] = vector.shape_cast %[[ORIG_ARG]] : vector<2x2xf32> to vector<4xf32> + // CHECK-DAG: %[[ARG2:.*]] = vector.shape_cast %[[ORIG_ARG2]] : vector<4x4xf32> to vector<16xf32> + // CHECK: %[[CST:.*]] = arith.constant dense<{{.*}}> : vector<4xf32> + // CHECK: %[[RES:.*]] = vector.shape_cast %[[CST]] : vector<4xf32> to vector<2x2xf32> %0 = arith.constant dense<[[1.0, 2.0], [3.0, 4.0]]> : vector<2x2xf32> - // DEFAULT: %[[C2:.*]] = arith.constant dense<{{.*}}> : vector<16xf32> - // BW-128: %[[C2:.*]] = arith.constant dense<{{.*}}> : vector<4x4xf32> - // BW-0: %[[C2:.*]] = arith.constant dense<{{.*}}> : vector<4x4xf32> + // CHECK: %[[C2:.*]] = arith.constant dense<{{.*}}> : vector<16xf32> %5 = arith.constant dense<[[1.0, 2.0, 3.0, 4.0], [1.0, 2.0,3.0, 4.0], [1.0, 2.0, 3.0, 4.0], [1.0, 2.0, 5.0, 6.0]]> : vector<4x4xf32> // Arith and math ops are handled in generic way, check some of them - // DEFAULT: %[[SIN:.*]] = math.sin %[[ARG]] : vector<4xf32> - // BW-128: %[[SIN:.*]] = math.sin %[[ARG]] : vector<4xf32> - // BW-0: %[[SIN:.*]] = math.sin %[[ORIG_ARG]] : vector<2x2xf32> + // CHECK: %[[SIN:.*]] = math.sin %[[ARG]] : vector<4xf32> %1 = math.sin %arg0 : vector<2x2xf32> - // DEFAULT: %[[SIN1:.*]] = math.sin %[[ARG2]] : vector<16xf32> - // BW-128: %[[SIN1:.*]] = math.sin %[[ORIG_ARG2]] : vector<4x4xf32> - // BW-0: %[[SIN1:.*]] = math.sin %[[ORIG_ARG2]] : vector<4x4xf32> + // CHECK: %[[SIN1:.*]] = math.sin %[[ARG2]] : vector<16xf32> %6 = math.sin %arg1 : vector<4x4xf32> - // DEFAULT: %{{.*}} = arith.addf %[[ARG]], %[[CST]] : vector<4xf32> - // BW-128: %{{.*}} = arith.addf %[[ARG]], %[[CST]] : vector<4xf32> - // BW-0: %{{.*}} = arith.addf %{{.*}} : vector<2x2xf32> + // CHECK: %{{.*}} = arith.addf %[[ARG]], %[[CST]] : vector<4xf32> %2 = arith.addf %arg0, %0 : vector<2x2xf32> - // DEFAULT: %[[ADD2:.*]] = arith.addf %[[ARG2]], %[[C2]] : vector<16xf32> - // BW-128: %[[ADD2:.*]] = arith.addf %[[ORIG_ARG2]], %[[C2]] : vector<4x4xf32> - // BW-0: %[[ADD2:.*]] = arith.addf %[[ORIG_ARG2]], %[[C2]] : vector<4x4xf32> + // CHECK: %[[ADD2:.*]] = arith.addf %[[ARG2]], %[[C2]] : vector<16xf32> %7 = arith.addf %arg1, %5 : vector<4x4xf32> - // ALL: return %[[RES]] : vector<2x2xf32> + // CHECK: return %[[RES]] : vector<2x2xf32> return %0 : vector<2x2xf32> } // ----- -// ALL-LABEL: test_index_no_linearize -func.func @test_index_no_linearize(%arg0: vector<2x2xindex>, %arg1: vector<2x2xindex>) -> vector<2x2xindex> { - // BW-128: %[[ADD:.*]] = arith.addi {{.*}} : vector<2x2xindex> - %0 = arith.addi %arg0, %arg1 : vector<2x2xindex> - return %0 : vector<2x2xindex> -} - -// ----- - // vectorizable operation (arith.mulf) with tensor result types. -// ALL-LABEL: test_tensor_no_linearize +// CHECK-LABEL: test_tensor_no_linearize func.func @test_tensor_no_linearize(%arg0: tensor<2x2xf32>, %arg1: tensor<2x2xf32>) -> (tensor<2x2xf32>, tensor<2x2xf32>) { - // ALL: %[[MULF:.*]] = arith.mulf %arg0, %arg1 : tensor<2x2xf32> + + // CHECK: %[[MULF:.*]] = arith.mulf %arg0, %arg1 : tensor<2x2xf32> %0 = arith.mulf %arg0, %arg1 : tensor<2x2xf32> return %0, %arg0 : tensor<2x2xf32>, tensor<2x2xf32> @@ -117,79 +79,67 @@ func.func @test_tensor_no_linearize(%arg0: tensor<2x2xf32>, %arg1: tensor<2x2xf3 // ----- -// ALL-LABEL: func.func @test_scalable_linearize( -// ALL-SAME: %[[ARG_0:.*]]: vector<2x[2]xf32>) -> vector<2x[2]xf32> { +// CHECK-LABEL: func.func @test_scalable_linearize( +// CHECK-SAME: %[[ARG_0:.*]]: vector<2x[2]xf32>) -> vector<2x[2]xf32> { func.func @test_scalable_linearize(%arg0: vector<2x[2]xf32>) -> vector<2x[2]xf32> { - // DEFAULT: %[[SC:.*]] = vector.shape_cast %[[ARG_0]] : vector<2x[2]xf32> to vector<[4]xf32> - // DEFAULT: %[[CST:.*]] = arith.constant dense<3.000000e+00> : vector<[4]xf32> - // BW-128: %[[SC:.*]] = vector.shape_cast %[[ARG_0]] : vector<2x[2]xf32> to vector<[4]xf32> - // BW-128: %[[CST:.*]] = arith.constant dense<3.000000e+00> : vector<[4]xf32> - // BW-0: %[[CST:.*]] = arith.constant dense<3.000000e+00> : vector<2x[2]xf32> + + // CHECK: %[[SC:.*]] = vector.shape_cast %[[ARG_0]] : vector<2x[2]xf32> to vector<[4]xf32> + // CHECK: %[[CST:.*]] = arith.constant dense<3.000000e+00> : vector<[4]xf32> %0 = arith.constant dense<[[3., 3.], [3., 3.]]> : vector<2x[2]xf32> - // DEFAULT: %[[SIN:.*]] = math.sin %[[SC]] : vector<[4]xf32> - // BW-128: %[[SIN:.*]] = math.sin %[[SC]] : vector<[4]xf32> - // BW-0: %[[SIN:.*]] = math.sin %[[ARG_0]] : vector<2x[2]xf32> + // CHECK: %[[SIN:.*]] = math.sin %[[SC]] : vector<[4]xf32> %1 = math.sin %arg0 : vector<2x[2]xf32> - // DEFAULT: %[[ADDF:.*]] = arith.addf %[[SIN]], %[[CST]] : vector<[4]xf32> - // BW-128: %[[ADDF:.*]] = arith.addf %[[SIN]], %[[CST]] : vector<[4]xf32> - // BW-0: %[[RES:.*]] = arith.addf %[[CST]], %[[SIN]] : vector<2x[2]xf32> + // CHECK: %[[ADDF:.*]] = arith.addf %[[SIN]], %[[CST]] : vector<[4]xf32> %2 = arith.addf %0, %1 : vector<2x[2]xf32> - // DEFAULT: %[[RES:.*]] = vector.shape_cast %[[ADDF]] : vector<[4]xf32> to vector<2x[2]xf32> - // BW-128: %[[RES:.*]] = vector.shape_cast %[[ADDF]] : vector<[4]xf32> to vector<2x[2]xf32> - // ALL: return %[[RES]] : vector<2x[2]xf32> + // CHECK: %[[RES:.*]] = vector.shape_cast %[[ADDF]] : vector<[4]xf32> to vector<2x[2]xf32> + // CHECK: return %[[RES]] : vector<2x[2]xf32> return %2 : vector<2x[2]xf32> } // ----- -// ALL-LABEL: func.func @test_scalable_no_linearize( -// ALL-SAME: %[[VAL_0:.*]]: vector<[2]x[2]xf32>) -> vector<[2]x[2]xf32> { +// CHECK-LABEL: func.func @test_scalable_no_linearize( +// CHECK-SAME: %[[VAL_0:.*]]: vector<[2]x[2]xf32>) -> vector<[2]x[2]xf32> { func.func @test_scalable_no_linearize(%arg0: vector<[2]x[2]xf32>) -> vector<[2]x[2]xf32> { - // ALL: %[[CST:.*]] = arith.constant dense<2.000000e+00> : vector<[2]x[2]xf32> + + // CHECK: %[[CST:.*]] = arith.constant dense<2.000000e+00> : vector<[2]x[2]xf32> %0 = arith.constant dense<[[2., 2.], [2., 2.]]> : vector<[2]x[2]xf32> - // ALL: %[[SIN:.*]] = math.sin %[[VAL_0]] : vector<[2]x[2]xf32> + // CHECK: %[[SIN:.*]] = math.sin %[[VAL_0]] : vector<[2]x[2]xf32> %1 = math.sin %arg0 : vector<[2]x[2]xf32> - // ALL: %[[RES:.*]] = arith.addf %[[CST]], %[[SIN]] : vector<[2]x[2]xf32> + // CHECK: %[[RES:.*]] = arith.addf %[[CST]], %[[SIN]] : vector<[2]x[2]xf32> %2 = arith.addf %0, %1 : vector<[2]x[2]xf32> - // ALL: return %[[RES]] : vector<[2]x[2]xf32> + // CHECK: return %[[RES]] : vector<[2]x[2]xf32> return %2 : vector<[2]x[2]xf32> } // ----- -// ALL-LABEL: func.func @test_0d_vector +// CHECK-LABEL: func.func @test_0d_vector func.func @test_0d_vector() -> vector { - // ALL: %[[CST:.+]] = arith.constant dense<0.000000e+00> : vector + + // CHECK: %[[CST:.+]] = arith.constant dense<0.000000e+00> : vector %0 = arith.constant dense<0.0> : vector - // ALL: return %[[CST]] + + // CHECK: return %[[CST]] return %0 : vector } // ----- -// ALL-LABEL: test_extract_strided_slice_1 -// ALL-SAME: (%[[ORIG_ARG:.*]]: vector<4x8xf32>) -> vector<2x2xf32> { +// CHECK-LABEL: test_extract_strided_slice_1 +// CHECK-SAME: (%[[ORIG_ARG:.*]]: vector<4x8xf32>) -> vector<2x2xf32> { func.func @test_extract_strided_slice_1(%arg0 : vector<4x8xf32>) -> vector<2x2xf32> { - // DEFAULT: %[[ARG:.*]] = vector.shape_cast %[[ORIG_ARG]] : vector<4x8xf32> to vector<32xf32> - // DEFAULT: %[[SHUFFLE:.*]] = vector.shuffle %[[ARG]], %[[ARG]] - // DEFAULT-SAME: [4, 5, 12, 13] : vector<32xf32>, vector<32xf32> - // DEFAULT: %[[RES:.*]] = vector.shape_cast %[[SHUFFLE]] : vector<4xf32> to vector<2x2xf32> - // DEFAULT: return %[[RES]] : vector<2x2xf32 - - // BW-128: %[[ARG:.*]] = vector.shape_cast %[[ORIG_ARG]] : vector<4x8xf32> to vector<32xf32> - // BW-128: %[[SHUFFLE:.*]] = vector.shuffle %[[ARG]], %[[ARG]] - // BW-128-SAME: [4, 5, 12, 13] : vector<32xf32>, vector<32xf32> - // BW-128: %[[RES:.*]] = vector.shape_cast %[[SHUFFLE]] : vector<4xf32> to vector<2x2xf32> - // BW-128: return %[[RES]] : vector<2x2xf32> - - // BW-0: %[[RES:.*]] = vector.extract_strided_slice %[[ARG:.*]] {offsets = [0, 4], sizes = [2, 2], strides = [1, 1]} : vector<4x8xf32> to vector<2x2xf32> - // BW-0: return %[[RES]] : vector<2x2xf32> + + // CHECK: %[[ARG:.*]] = vector.shape_cast %[[ORIG_ARG]] : vector<4x8xf32> to vector<32xf32> + // CHECK: %[[SHUFFLE:.*]] = vector.shuffle %[[ARG]], %[[ARG]] + // CHECK-SAME: [4, 5, 12, 13] : vector<32xf32>, vector<32xf32> + // CHECK: %[[RES:.*]] = vector.shape_cast %[[SHUFFLE]] : vector<4xf32> to vector<2x2xf32> + // CHECK: return %[[RES]] : vector<2x2xf32 %0 = vector.extract_strided_slice %arg0 { sizes = [2, 2], strides = [1, 1], offsets = [0, 4]} : vector<4x8xf32> to vector<2x2xf32> return %0 : vector<2x2xf32> @@ -197,36 +147,30 @@ func.func @test_extract_strided_slice_1(%arg0 : vector<4x8xf32>) -> vector<2x2xf // ----- -// ALL-LABEL: func.func @test_extract_strided_slice_1_scalable( -// ALL-SAME: %[[VAL_0:.*]]: vector<4x[8]xf32>) -> vector<2x[8]xf32> { +// CHECK-LABEL: func.func @test_extract_strided_slice_1_scalable( +// CHECK-SAME: %[[VAL_0:.*]]: vector<4x[8]xf32>) -> vector<2x[8]xf32> { func.func @test_extract_strided_slice_1_scalable(%arg0: vector<4x[8]xf32>) -> vector<2x[8]xf32> { - // ALL-NOT: vector.shuffle - // ALL-NOT: vector.shape_cast - // ALL: %[[RES:.*]] = vector.extract_strided_slice %[[VAL_0]] {offsets = [1, 0], sizes = [2, 8], strides = [1, 1]} : vector<4x[8]xf32> to vector<2x[8]xf32> + + // CHECK-NOT: vector.shuffle + // CHECK-NOT: vector.shape_cast + // CHECK: %[[RES:.*]] = vector.extract_strided_slice %[[VAL_0]] {offsets = [1, 0], sizes = [2, 8], strides = [1, 1]} : vector<4x[8]xf32> to vector<2x[8]xf32> %0 = vector.extract_strided_slice %arg0 { sizes = [2, 8], strides = [1, 1], offsets = [1, 0] } : vector<4x[8]xf32> to vector<2x[8]xf32> - // ALL: return %[[RES]] : vector<2x[8]xf32> + + // CHECK: return %[[RES]] : vector<2x[8]xf32> return %0 : vector<2x[8]xf32> } // ----- -// ALL-LABEL: test_extract_strided_slice_2 -// ALL-SAME: (%[[ORIG_ARG:.*]]: vector<2x8x2xf32>) -> vector<1x4x2xf32> { +// CHECK-LABEL: test_extract_strided_slice_2 +// CHECK-SAME: (%[[ORIG_ARG:.*]]: vector<2x8x2xf32>) -> vector<1x4x2xf32> { func.func @test_extract_strided_slice_2(%arg0 : vector<2x8x2xf32>) -> vector<1x4x2xf32> { - // DEFAULT: %[[ARG:.*]] = vector.shape_cast %[[ORIG_ARG]] : vector<2x8x2xf32> to vector<32xf32> - // DEFAULT: %[[SHUFFLE:.*]] = vector.shuffle %[[ARG]], %[[ARG]] - // DEFAULT-SAME: [20, 21, 22, 23, 24, 25, 26, 27] : vector<32xf32>, vector<32xf32> - // DEFAULT: %[[RES:.*]] = vector.shape_cast %[[SHUFFLE]] : vector<8xf32> to vector<1x4x2xf32> - // DEFAULT: return %[[RES]] : vector<1x4x2xf32> - - // BW-128: %[[ARG:.*]] = vector.shape_cast %[[ORIG_ARG]] : vector<2x8x2xf32> to vector<32xf32> - // BW-128: %[[SHUFFLE:.*]] = vector.shuffle %[[ARG]], %[[ARG]] - // BW-128-SAME: [20, 21, 22, 23, 24, 25, 26, 27] : vector<32xf32>, vector<32xf32> - // BW-128: %[[RES:.*]] = vector.shape_cast %[[SHUFFLE]] : vector<8xf32> to vector<1x4x2xf32> - // BW-128: return %[[RES]] : vector<1x4x2xf32> - - // BW-0: %[[RES:.*]] = vector.extract_strided_slice %[[ORIG_ARG]] {offsets = [1, 2], sizes = [1, 4], strides = [1, 1]} : vector<2x8x2xf32> to vector<1x4x2xf32> - // BW-0: return %[[RES]] : vector<1x4x2xf32> + + // CHECK: %[[ARG:.*]] = vector.shape_cast %[[ORIG_ARG]] : vector<2x8x2xf32> to vector<32xf32> + // CHECK: %[[SHUFFLE:.*]] = vector.shuffle %[[ARG]], %[[ARG]] + // CHECK-SAME: [20, 21, 22, 23, 24, 25, 26, 27] : vector<32xf32>, vector<32xf32> + // CHECK: %[[RES:.*]] = vector.shape_cast %[[SHUFFLE]] : vector<8xf32> to vector<1x4x2xf32> + // CHECK: return %[[RES]] : vector<1x4x2xf32> %0 = vector.extract_strided_slice %arg0 { offsets = [1, 2], strides = [1, 1], sizes = [1, 4] } : vector<2x8x2xf32> to vector<1x4x2xf32> return %0 : vector<1x4x2xf32> @@ -234,216 +178,170 @@ func.func @test_extract_strided_slice_2(%arg0 : vector<2x8x2xf32>) -> vector<1x4 // ----- -// ALL-LABEL: test_vector_shuffle -// ALL-SAME: (%[[ORIG_ARG0:.*]]: vector<4x2xf32>, %[[ORIG_ARG1:.*]]: vector<4x2xf32>) -> vector<8x2xf32> { +// CHECK-LABEL: test_vector_shuffle +// CHECK-SAME: (%[[ORIG_ARG0:.*]]: vector<4x2xf32>, %[[ORIG_ARG1:.*]]: vector<4x2xf32>) -> vector<8x2xf32> { func.func @test_vector_shuffle(%arg0: vector<4x2xf32>, %arg1: vector<4x2xf32>) -> vector<8x2xf32> { - // DEFAULT-DAG: %[[ARG0:.*]] = vector.shape_cast %[[ORIG_ARG0]] : vector<4x2xf32> to vector<8xf32> - // DEFAULT-DAG: %[[ARG1:.*]] = vector.shape_cast %[[ORIG_ARG1]] : vector<4x2xf32> to vector<8xf32> - // DEFAULT: %[[SHUFFLE:.*]] = vector.shuffle %[[ARG0]], %[[ARG1]] - // DEFAULT-SAME: [0, 1, 8, 9, 2, 3, 10, 11, 4, 5, 12, 13, 6, 7, 14, 15] : vector<8xf32>, vector<8xf32> - // DEFAULT: %[[RES:.*]] = vector.shape_cast %[[SHUFFLE]] : vector<16xf32> to vector<8x2xf32> - // DEFAULT: return %[[RES]] : vector<8x2xf32> - - // BW-128-DAG: %[[ARG0:.*]] = vector.shape_cast %[[ORIG_ARG0]] : vector<4x2xf32> to vector<8xf32> - // BW-128-DAG: %[[ARG1:.*]] = vector.shape_cast %[[ORIG_ARG1]] : vector<4x2xf32> to vector<8xf32> - // BW-128: %[[SHUFFLE:.*]] = vector.shuffle %[[ARG0]], %[[ARG1]] - // BW-128-SAME: [0, 1, 8, 9, 2, 3, 10, 11, 4, 5, 12, 13, 6, 7, 14, 15] : vector<8xf32>, vector<8xf32> - // BW-128: %[[RES:.*]] = vector.shape_cast %[[SHUFFLE]] : vector<16xf32> to vector<8x2xf32> - // BW-128: return %[[RES]] : vector<8x2xf32> - - // BW-0: %[[RES:.*]] = vector.shuffle %[[ORIG_ARG0]], %[[ORIG_ARG1]] [0, 4, 1, 5, 2, 6, 3, 7] : vector<4x2xf32>, vector<4x2xf32> - // BW-0: return %[[RES]] : vector<8x2xf32> + + // CHECK-DAG: %[[ARG0:.*]] = vector.shape_cast %[[ORIG_ARG0]] : vector<4x2xf32> to vector<8xf32> + // CHECK-DAG: %[[ARG1:.*]] = vector.shape_cast %[[ORIG_ARG1]] : vector<4x2xf32> to vector<8xf32> + // CHECK: %[[SHUFFLE:.*]] = vector.shuffle %[[ARG0]], %[[ARG1]] + // CHECK-SAME: [0, 1, 8, 9, 2, 3, 10, 11, 4, 5, 12, 13, 6, 7, 14, 15] : vector<8xf32>, vector<8xf32> + // CHECK: %[[RES:.*]] = vector.shape_cast %[[SHUFFLE]] : vector<16xf32> to vector<8x2xf32> + // CHECK: return %[[RES]] : vector<8x2xf32> %0 = vector.shuffle %arg0, %arg1 [0, 4, 1, 5, 2, 6, 3, 7] : vector<4x2xf32>, vector<4x2xf32> return %0 : vector<8x2xf32> } // ----- -// ALL-LABEL: test_vector_extract -// ALL-SAME: (%[[ORIG_ARG:.*]]: vector<2x8x2xf32>) -> vector<8x2xf32> { +// CHECK-LABEL: test_vector_extract +// CHECK-SAME: (%[[ORIG_ARG:.*]]: vector<2x8x2xf32>) -> vector<8x2xf32> { func.func @test_vector_extract(%arg0: vector<2x8x2xf32>) -> vector<8x2xf32> { - // DEFAULT: %[[ARG:.*]] = vector.shape_cast %[[ORIG_ARG]] : vector<2x8x2xf32> to vector<32xf32> - // DEFAULT: %[[SHUFFLE:.*]] = vector.shuffle %[[ARG]], %[[ARG]] - // DEFAULT-SAME: [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31] : vector<32xf32>, vector<32xf32> - // DEFAULT: %[[RES:.*]] = vector.shape_cast %[[SHUFFLE]] : vector<16xf32> to vector<8x2xf32> - // DEFAULT: return %[[RES]] : vector<8x2xf32> - - // BW-128: %[[ARG:.*]] = vector.shape_cast %[[ORIG_ARG]] : vector<2x8x2xf32> to vector<32xf32> - // BW-128: %[[SHUFFLE:.*]] = vector.shuffle %[[ARG]], %[[ARG]] - // BW-128-SAME: [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31] : vector<32xf32>, vector<32xf32> - // BW-128: %[[RES:.*]] = vector.shape_cast %[[SHUFFLE]] : vector<16xf32> to vector<8x2xf32> - // BW-128: return %[[RES]] : vector<8x2xf32> - - // BW-0: %[[RES:.*]] = vector.extract %[[ORIG_ARG]][1] : vector<8x2xf32> from vector<2x8x2xf32> - // BW-0: return %[[RES]] : vector<8x2xf32> + + // CHECK: %[[ARG:.*]] = vector.shape_cast %[[ORIG_ARG]] : vector<2x8x2xf32> to vector<32xf32> + // CHECK: %[[SHUFFLE:.*]] = vector.shuffle %[[ARG]], %[[ARG]] + // CHECK-SAME: [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31] : vector<32xf32>, vector<32xf32> + // CHECK: %[[RES:.*]] = vector.shape_cast %[[SHUFFLE]] : vector<16xf32> to vector<8x2xf32> + // CHECK: return %[[RES]] : vector<8x2xf32> %0 = vector.extract %arg0[1]: vector<8x2xf32> from vector<2x8x2xf32> return %0 : vector<8x2xf32> } // ----- -// ALL-LABEL: func.func @test_vector_extract_scalable( -// ALL-SAME: %[[VAL_0:.*]]: vector<2x8x[2]xf32>) -> vector<8x[2]xf32> { +// CHECK-LABEL: func.func @test_vector_extract_scalable( +// CHECK-SAME: %[[VAL_0:.*]]: vector<2x8x[2]xf32>) -> vector<8x[2]xf32> { func.func @test_vector_extract_scalable(%arg0: vector<2x8x[2]xf32>) -> vector<8x[2]xf32> { - // ALL-NOT: vector.shuffle - // ALL-NOT: vector.shape_cast - // ALL: %[[RES:.*]] = vector.extract %[[VAL_0]][1] : vector<8x[2]xf32> from vector<2x8x[2]xf32> + + // CHECK-NOT: vector.shuffle + // CHECK-NOT: vector.shape_cast + // CHECK: %[[RES:.*]] = vector.extract %[[VAL_0]][1] : vector<8x[2]xf32> from vector<2x8x[2]xf32> %0 = vector.extract %arg0[1]: vector<8x[2]xf32> from vector<2x8x[2]xf32> - // ALL: return %[[RES]] : vector<8x[2]xf32> + + // CHECK: return %[[RES]] : vector<8x[2]xf32> return %0 : vector<8x[2]xf32> } // ----- -// ALL-LABEL: test_vector_insert -// ALL-SAME: (%[[DEST:.*]]: vector<2x8x4xf32>, %[[SRC:.*]]: vector<8x4xf32>) -> vector<2x8x4xf32> { +// CHECK-LABEL: test_vector_insert +// CHECK-SAME: (%[[DEST:.*]]: vector<2x8x4xf32>, %[[SRC:.*]]: vector<8x4xf32>) -> vector<2x8x4xf32> { func.func @test_vector_insert(%arg0: vector<2x8x4xf32>, %arg1: vector<8x4xf32>) -> vector<2x8x4xf32> { - // DEFAULT-DAG: %[[ARG_SRC:.*]] = vector.shape_cast %[[SRC]] : vector<8x4xf32> to vector<32xf32> - // DEFAULT-DAG: %[[ARG_DEST:.*]] = vector.shape_cast %[[DEST]] : vector<2x8x4xf32> to vector<64xf32> - // DEFAULT: %[[SHUFFLE:.*]] = vector.shuffle %[[ARG_DEST]], %[[ARG_SRC]] - // DEFAULT-SAME: [64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - // DEFAULT-SAME: 88, 89, 90, 91, 92, 93, 94, 95, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - // DEFAULT-SAME: 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63] : vector<64xf32>, vector<32xf32> - // DEFAULT: %[[RES:.*]] = vector.shape_cast %[[SHUFFLE]] : vector<64xf32> to vector<2x8x4xf32> - // DEFAULT: return %[[RES]] : vector<2x8x4xf32> - - // BW-128-DAG: %[[ARG_SRC:.*]] = vector.shape_cast %[[SRC]] : vector<8x4xf32> to vector<32xf32> - // BW-128-DAG: %[[ARG_DEST:.*]] = vector.shape_cast %[[DEST]] : vector<2x8x4xf32> to vector<64xf32> - // BW-128: %[[SHUFFLE:.*]] = vector.shuffle %[[ARG_DEST]], %[[ARG_SRC]] - // BW-128-SAME: [64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - // BW-128-SAME: 88, 89, 90, 91, 92, 93, 94, 95, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - // BW-128-SAME: 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63] : vector<64xf32>, vector<32xf32> - // BW-128: %[[RES:.*]] = vector.shape_cast %[[SHUFFLE]] : vector<64xf32> to vector<2x8x4xf32> - // BW-128: return %[[RES]] : vector<2x8x4xf32> - - // BW-0: %[[RES:.*]] = vector.insert %[[SRC]], %[[DEST]] [0] : vector<8x4xf32> into vector<2x8x4xf32> - // BW-0: return %[[RES]] : vector<2x8x4xf32> + // CHECK-DAG: %[[ARG_SRC:.*]] = vector.shape_cast %[[SRC]] : vector<8x4xf32> to vector<32xf32> + // CHECK-DAG: %[[ARG_DEST:.*]] = vector.shape_cast %[[DEST]] : vector<2x8x4xf32> to vector<64xf32> + // CHECK: %[[SHUFFLE:.*]] = vector.shuffle %[[ARG_DEST]], %[[ARG_SRC]] + // CHECK-SAME: [64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, + // CHECK-SAME: 88, 89, 90, 91, 92, 93, 94, 95, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + // CHECK-SAME: 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63] : vector<64xf32>, vector<32xf32> + // CHECK: %[[RES:.*]] = vector.shape_cast %[[SHUFFLE]] : vector<64xf32> to vector<2x8x4xf32> + // CHECK: return %[[RES]] : vector<2x8x4xf32> %0 = vector.insert %arg1, %arg0[0]: vector<8x4xf32> into vector<2x8x4xf32> return %0 : vector<2x8x4xf32> } // ----- -// ALL-LABEL: func.func @test_vector_insert_scalable( -// ALL-SAME: %[[VAL_0:.*]]: vector<2x8x[4]xf32>, %[[VAL_1:.*]]: vector<8x[4]xf32>) -> vector<2x8x[4]xf32> { +// CHECK-LABEL: func.func @test_vector_insert_scalable( +// CHECK-SAME: %[[VAL_0:.*]]: vector<2x8x[4]xf32>, %[[VAL_1:.*]]: vector<8x[4]xf32>) -> vector<2x8x[4]xf32> { func.func @test_vector_insert_scalable(%arg0: vector<2x8x[4]xf32>, %arg1: vector<8x[4]xf32>) -> vector<2x8x[4]xf32> { - // ALL-NOT: vector.shuffle - // ALL-NOT: vector.shape_cast - // ALL: %[[RES:.*]] = vector.insert %[[VAL_1]], %[[VAL_0]] [0] : vector<8x[4]xf32> into vector<2x8x[4]xf32> + + // CHECK-NOT: vector.shuffle + // CHECK-NOT: vector.shape_cast + // CHECK: %[[RES:.*]] = vector.insert %[[VAL_1]], %[[VAL_0]] [0] : vector<8x[4]xf32> into vector<2x8x[4]xf32> + %0 = vector.insert %arg1, %arg0[0]: vector<8x[4]xf32> into vector<2x8x[4]xf32> - // ALL: return %[[RES]] : vector<2x8x[4]xf32> + // CHECK: return %[[RES]] : vector<2x8x[4]xf32> return %0 : vector<2x8x[4]xf32> } // ----- -// ALL-LABEL: test_vector_extract_scalar +// CHECK-LABEL: test_vector_extract_scalar func.func @test_vector_extract_scalar(%idx : index) { %cst = arith.constant dense<[1, 2, 3, 4]> : vector<4xi32> - // ALL-NOT: vector.shuffle - // ALL: vector.extract - // ALL-NOT: vector.shuffle + + // CHECK-NOT: vector.shuffle + // CHECK: vector.extract + // CHECK-NOT: vector.shuffle %0 = vector.extract %cst[%idx] : i32 from vector<4xi32> return } // ----- -// ALL-LABEL: test_vector_bitcast -// ALL-SAME: %[[ARG_0:.*]]: vector<4x4xf32> +// CHECK-LABEL: test_vector_bitcast +// CHECK-SAME: %[[ARG_0:.*]]: vector<4x4xf32> func.func @test_vector_bitcast(%arg0: vector<4x4xf32>) -> vector<4x8xf16> { - // DEFAULT: %[[DOWNCAST:.*]] = vector.shape_cast %[[ARG_0]] : vector<4x4xf32> to vector<16xf32> - // DEFAULT: %[[BITCAST:.*]] = vector.bitcast %[[DOWNCAST]] : vector<16xf32> to vector<32xf16> - // DEFAULT: %[[UPCAST:.*]] = vector.shape_cast %[[BITCAST]] : vector<32xf16> to vector<4x8xf16> - // BW-128: %[[UPCAST:.*]] = vector.bitcast %[[ARG_0]] : vector<4x4xf32> to vector<4x8xf16> - // BW-0: %[[BITCAST:.*]] = vector.bitcast %[[ARG_0]] : vector<4x4xf32> to vector<4x8xf16> + // CHECK: %[[DOWNCAST:.*]] = vector.shape_cast %[[ARG_0]] : vector<4x4xf32> to vector<16xf32> + // CHECK: %[[BITCAST:.*]] = vector.bitcast %[[DOWNCAST]] : vector<16xf32> to vector<32xf16> + // CHECK: %[[UPCAST:.*]] = vector.shape_cast %[[BITCAST]] : vector<32xf16> to vector<4x8xf16> %1 = vector.bitcast %arg0 : vector<4x4xf32> to vector<4x8xf16> return %1 : vector<4x8xf16> } // ----- -// ALL-LABEL: test_vector_bitcast -// ALL-SAME: %[[ARG_0:.*]]: vector<4x2xf32> +// CHECK-LABEL: test_vector_bitcast +// CHECK-SAME: %[[ARG_0:.*]]: vector<4x2xf32> func.func @test_vector_bitcast(%arg0: vector<4x2xf32>) -> vector<4x4xf16> { - // DEFAULT: %[[DOWNCAST:.*]] = vector.shape_cast %[[ARG_0]] : vector<4x2xf32> to vector<8xf32> - // DEFAULT: %[[BITCAST:.*]] = vector.bitcast %[[DOWNCAST]] : vector<8xf32> to vector<16xf16> - // DEFAULT: %[[UPCAST:.*]] = vector.shape_cast %[[BITCAST]] : vector<16xf16> to vector<4x4xf16> - // BW-128: %[[DOWNCAST:.*]] = vector.shape_cast %[[ARG_0]] : vector<4x2xf32> to vector<8xf32> - // BW-128: %[[BITCAST:.*]] = vector.bitcast %[[DOWNCAST]] : vector<8xf32> to vector<16xf16> - // BW-128: %[[UPCAST:.*]] = vector.shape_cast %[[BITCAST]] : vector<16xf16> to vector<4x4xf16> - - // BW-0: %[[BITCAST:.*]] = vector.bitcast %[[ARG_0]] : vector<4x2xf32> to vector<4x4xf16> + + // CHECK: %[[DOWNCAST:.*]] = vector.shape_cast %[[ARG_0]] : vector<4x2xf32> to vector<8xf32> + // CHECK: %[[BITCAST:.*]] = vector.bitcast %[[DOWNCAST]] : vector<8xf32> to vector<16xf16> + // CHECK: %[[UPCAST:.*]] = vector.shape_cast %[[BITCAST]] : vector<16xf16> to vector<4x4xf16> %1 = vector.bitcast %arg0 : vector<4x2xf32> to vector<4x4xf16> return %1 : vector<4x4xf16> } // ----- -// ALL-LABEL: test_vector_bitcast -// ALL-SAME: %[[ARG_0:.*]]: vector<4x[2]xf32> +// CHECK-LABEL: test_vector_bitcast +// CHECK-SAME: %[[ARG_0:.*]]: vector<4x[2]xf32> func.func @test_vector_bitcast(%arg0: vector<4x[2]xf32>) -> vector<4x[4]xf16> { - // DEFAULT: %[[DOWNCAST:.*]] = vector.shape_cast %[[ARG_0]] : vector<4x[2]xf32> to vector<[8]xf32> - // DEFAULT: %[[BITCAST:.*]] = vector.bitcast %[[DOWNCAST]] : vector<[8]xf32> to vector<[16]xf16> - // DEFAULT: %[[UPCAST:.*]] = vector.shape_cast %[[BITCAST]] : vector<[16]xf16> to vector<4x[4]xf16> - // BW-128: %[[DOWNCAST:.*]] = vector.shape_cast %[[ARG_0]] : vector<4x[2]xf32> to vector<[8]xf32> - // BW-128: %[[BITCAST:.*]] = vector.bitcast %[[DOWNCAST]] : vector<[8]xf32> to vector<[16]xf16> - // BW-128: %[[UPCAST:.*]] = vector.shape_cast %[[BITCAST]] : vector<[16]xf16> to vector<4x[4]xf16> - - // BW-0: %[[BITCAST:.*]] = vector.bitcast %[[ARG_0]] : vector<4x[2]xf32> to vector<4x[4]xf16> + + // CHECK: %[[DOWNCAST:.*]] = vector.shape_cast %[[ARG_0]] : vector<4x[2]xf32> to vector<[8]xf32> + // CHECK: %[[BITCAST:.*]] = vector.bitcast %[[DOWNCAST]] : vector<[8]xf32> to vector<[16]xf16> + // CHECK: %[[UPCAST:.*]] = vector.shape_cast %[[BITCAST]] : vector<[16]xf16> to vector<4x[4]xf16> %1 = vector.bitcast %arg0 : vector<4x[2]xf32> to vector<4x[4]xf16> return %1 : vector<4x[4]xf16> } // ----- -// ALL-LABEL: test_vector_bitcast -// ALL-SAME: %[[ARG_0:.*]]: vector<[4]x2xf32> +// CHECK-LABEL: test_vector_bitcast +// CHECK-SAME: %[[ARG_0:.*]]: vector<[4]x2xf32> func.func @test_vector_bitcast(%arg0: vector<[4]x2xf32>) -> vector<[4]x4xf16> { - // DEFAULT: %[[DOWNCAST:.*]] = vector.shape_cast %[[ARG_0]] : vector<[4]x2xf32> to vector<[8]xf32> - // DEFAULT: %[[BITCAST:.*]] = vector.bitcast %[[DOWNCAST]] : vector<[8]xf32> to vector<[16]xf16> - // DEFAULT: %[[UPCAST:.*]] = vector.shape_cast %[[BITCAST]] : vector<[16]xf16> to vector<[4]x4xf16> - // BW-128: %[[DOWNCAST:.*]] = vector.shape_cast %[[ARG_0]] : vector<[4]x2xf32> to vector<[8]xf32> - // BW-128: %[[BITCAST:.*]] = vector.bitcast %[[DOWNCAST]] : vector<[8]xf32> to vector<[16]xf16> - // BW-128: %[[UPCAST:.*]] = vector.shape_cast %[[BITCAST]] : vector<[16]xf16> to vector<[4]x4xf16> - - // BW-0: %[[BITCAST:.*]] = vector.bitcast %[[ARG_0]] : vector<[4]x2xf32> to vector<[4]x4xf16> + + // CHECK: %[[DOWNCAST:.*]] = vector.shape_cast %[[ARG_0]] : vector<[4]x2xf32> to vector<[8]xf32> + // CHECK: %[[BITCAST:.*]] = vector.bitcast %[[DOWNCAST]] : vector<[8]xf32> to vector<[16]xf16> + // CHECK: %[[UPCAST:.*]] = vector.shape_cast %[[BITCAST]] : vector<[16]xf16> to vector<[4]x4xf16> %1 = vector.bitcast %arg0 : vector<[4]x2xf32> to vector<[4]x4xf16> return %1 : vector<[4]x4xf16> } // ----- -// ALL-LABEL: linearize_vector_splat -// ALL-SAME: (%[[ARG:.*]]: i32) -> vector<4x2xi32> + +// CHECK-LABEL: linearize_vector_splat +// CHECK-SAME: (%[[ARG:.*]]: i32) -> vector<4x2xi32> func.func @linearize_vector_splat(%arg0: i32) -> vector<4x2xi32> { - // DEFAULT: %[[SPLAT:.*]] = vector.splat %[[ARG]] : vector<8xi32> - // DEFAULT: %[[CAST:.*]] = vector.shape_cast %[[SPLAT]] : vector<8xi32> to vector<4x2xi32> - // DEFAULT: return %[[CAST]] : vector<4x2xi32> - // BW-128: %[[SPLAT:.*]] = vector.splat %[[ARG]] : vector<8xi32> - // BW-128: %[[CAST:.*]] = vector.shape_cast %[[SPLAT]] : vector<8xi32> to vector<4x2xi32> - // BW-128: return %[[CAST]] : vector<4x2xi32> - - // BW-0: %[[SPLAT:.*]] = vector.splat %[[ARG]] : vector<4x2xi32> - // BW-0: return %[[SPLAT]] : vector<4x2xi32> + + // CHECK: %[[SPLAT:.*]] = vector.splat %[[ARG]] : vector<8xi32> + // CHECK: %[[CAST:.*]] = vector.shape_cast %[[SPLAT]] : vector<8xi32> to vector<4x2xi32> + // CHECK: return %[[CAST]] : vector<4x2xi32> %0 = vector.splat %arg0 : vector<4x2xi32> return %0 : vector<4x2xi32> } // ----- -// ALL-LABEL: linearize_scalable_vector_splat -// ALL-SAME: (%[[ARG:.*]]: i32) -> vector<4x[2]xi32> + +// CHECK-LABEL: linearize_scalable_vector_splat +// CHECK-SAME: (%[[ARG:.*]]: i32) -> vector<4x[2]xi32> func.func @linearize_scalable_vector_splat(%arg0: i32) -> vector<4x[2]xi32> { - // DEFAULT: %[[SPLAT:.*]] = vector.splat %[[ARG]] : vector<[8]xi32> - // DEFAULT: %[[CAST:.*]] = vector.shape_cast %[[SPLAT]] : vector<[8]xi32> to vector<4x[2]xi32> - // DEFAULT: return %[[CAST]] : vector<4x[2]xi32> - // BW-128: %[[SPLAT:.*]] = vector.splat %[[ARG]] : vector<[8]xi32> - // BW-128: %[[CAST:.*]] = vector.shape_cast %[[SPLAT]] : vector<[8]xi32> to vector<4x[2]xi32> - // BW-128: return %[[CAST]] : vector<4x[2]xi32> - - // BW-0: %[[SPLAT:.*]] = vector.splat %[[ARG]] : vector<4x[2]xi32> - // BW-0: return %[[SPLAT]] : vector<4x[2]xi32> + + // CHECK: %[[SPLAT:.*]] = vector.splat %[[ARG]] : vector<[8]xi32> + // CHECK: %[[CAST:.*]] = vector.shape_cast %[[SPLAT]] : vector<[8]xi32> to vector<4x[2]xi32> + // CHECK: return %[[CAST]] : vector<4x[2]xi32> %0 = vector.splat %arg0 : vector<4x[2]xi32> return %0 : vector<4x[2]xi32> }