11// RUN: mlir-opt --test-convert-to-spirv="run-signature-conversion=false run-vector-unrolling=true" --split-input-file %s | FileCheck %s
22
3- // COM: This file tests the current behaviour of the SignatureConversion
4- // COM: and the unrolling of vector.to_elements to vectors of valid SPIR-V
5- // COM: sizes.
3+ // This file tests the current behaviour of the SignatureConversion
4+ // and the unrolling of vector.to_elements to vectors of valid SPIR-V
5+ // sizes.
66
7- // COM: vector's of rank 1 and size 1 will be changed
8- // COM: to scalars. Since vector.to_elements will also produce
9- // COM: a scalar, we expect the vector.to_elements to be folded
10- // COM: away. Please note that even if run-signature-conversion=false
11- // COM: The pattern FuncOpConversion will still run and change parameters
12- // COM: which fit this constraint.
7+ // vector's of rank 1 and size 1 will be changed
8+ // to scalars. Since vector.to_elements will also produce
9+ // a scalar, we expect the vector.to_elements to be folded
10+ // away. Please note that even if run-signature-conversion=false
11+ // The pattern FuncOpConversion will still run and change parameters
12+ // which fit this constraint.
1313
1414// CHECK-LABEL: spirv.func @vec_size_1
1515// CHECK-SAME: (%[[ARG0:.+]]: f32)
@@ -21,14 +21,14 @@ func.func @vec_size_1(%arg0: vector<1xf32>) -> (f32) {
2121
2222// -----
2323
24- // COM: vector's of rank 2, 3, 4 are allowed by SPIR-V.
24+ // vector's of rank 2, 3, 4 are allowed by SPIR-V.
2525// So they remain unchanged. FuncOpConversion will still
2626// run, but the signature converter will not convert these vectors.
2727
2828// CHECK-LABEL: spirv.func @vec_size_2
2929// CHECK-SAME: (%[[ARG0:.+]]: vector<2xf32>)
3030func.func @vec_size_2 (%arg0: vector <2 xf32 >) -> (f32 ) {
31- // COM: A single result type is enforced by the semantics
31+ // A single result type is enforced by the semantics
3232
3333 // CHECK-NEXT: %[[VAL:.+]] = spirv.CompositeExtract %[[ARG0]][0 : i32] : vector<2xf32>
3434 %0:2 = vector.to_elements %arg0 : vector <2 xf32 >
@@ -39,25 +39,25 @@ func.func @vec_size_2(%arg0: vector<2xf32>) -> (f32) {
3939
4040// -----
4141
42- // COM: vector of rank 5 is the first one that doesn't fit
43- // COM: into SPIR-V's vectors.
42+ // vector of rank 5 is the first one that doesn't fit
43+ // into SPIR-V's vectors.
4444
45- // COM: run-signature-conversion=false means that
46- // COM: this vector will not be unrolled.
45+ // run-signature-conversion=false means that
46+ // this vector will not be unrolled.
4747
4848// CHECK-LABEL: func.func @vec_size_5
4949// CHECK-SAME: (%[[ARG0:.+]]: vector<5xf32>)
5050func.func @vec_size_5 (%arg0: vector <5 xf32 >) -> (f32 ) {
5151
5252 // CHECK-NEXT: %[[VAL:.+]] = vector.extract_strided_slice %[[ARG0]] {offsets = [0], sizes = [1], strides = [1]} : vector<5xf32> to vector<1xf32>
5353
54- // COM: We have the following comment in VectorConvertToElementOp
55- // COM:
56- // COM: // Input vectors of size 1 are converted to scalars by the type converter.
57- // COM: // We cannot use `spirv::CompositeExtractOp` directly in this case.
58- // COM: // For a scalar source, the result is just the scalar itself.
59- // COM:
60- // COM: Which in this case means an unrealized conversion cast.
54+ // We have the following comment in VectorConvertToElementOp
55+ //
56+ // // Input vectors of size 1 are converted to scalars by the type converter.
57+ // // We cannot use `spirv::CompositeExtractOp` directly in this case.
58+ // // For a scalar source, the result is just the scalar itself.
59+ //
60+ // Which in this case means an unrealized conversion cast.
6161
6262 // CHECK-NEXT: %[[RETVAL:.+]] = builtin.unrealized_conversion_cast %[[VAL]] : vector<1xf32> to f32
6363 %0:5 = vector.to_elements %arg0 : vector <5 xf32 >
0 commit comments