Skip to content

Commit ec66724

Browse files
committed
additional test comments
1 parent 16edc53 commit ec66724

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

mlir/test/Dialect/Vector/canonicalize/vector-transpose.mlir

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ func.func @negative_broadcast_transpose_021(%arg0 : vector<3x1x3xi8>) -> vector<
140140

141141
// -----
142142

143+
// Test of FoldTransposeShapeCast
143144
// In this test, the permutation maps the non-unit dimensions (1 and 2) as follows:
144145
// 1 -> 0
145146
// 2 -> 4
@@ -158,6 +159,7 @@ func.func @transpose_shape_cast(%arg : vector<1x4x4x1x1xi8>) -> vector<4x4xi8> {
158159

159160
// -----
160161

162+
// Test of FoldTransposeShapeCast
161163
// In this test, the mapping of non-unit dimensions (1 and 2) is as follows:
162164
// 1 -> 2
163165
// 2 -> 1
@@ -177,6 +179,7 @@ func.func @negative_transpose_shape_cast(%arg : vector<1x4x4x1xi8>) -> vector<4x
177179

178180
// -----
179181

182+
// Test of FoldTransposeShapeCast
180183
// Currently the conversion shape_cast(transpose) -> shape_cast is disabled for
181184
// scalable vectors because of bad interaction with ConvertIllegalShapeCastOpsToTransposes
182185
// CHECK-LABEL: @negative_transpose_shape_cast_scalable
@@ -190,6 +193,7 @@ func.func @negative_transpose_shape_cast_scalable(%arg : vector<[4]x1xi8>) -> ve
190193

191194
// -----
192195

196+
// Test of shape_cast folding.
193197
// The conversion transpose(shape_cast) -> shape_cast is not disabled for scalable
194198
// vectors.
195199
// CHECK-LABEL: @shape_cast_transpose_scalable
@@ -203,18 +207,8 @@ func.func @shape_cast_transpose_scalable(%arg : vector<[4]xi8>) -> vector<[4]x1x
203207

204208
// -----
205209

206-
// Scalable dimensions should be treated as non-unit dimensions.
207-
// CHECK-LABEL: @shape_cast_transpose_scalable
208-
// CHECK: vector.shape_cast
209-
// CHECK: vector.transpose
210-
func.func @shape_cast_transpose_scalable_unit(%arg : vector<[1]x4x1xi8>) -> vector<4x[1]xi8> {
211-
%0 = vector.shape_cast %arg : vector<[1]x4x1xi8> to vector<[1]x4xi8>
212-
%1 = vector.transpose %0, [1, 0] : vector<[1]x4xi8> to vector<4x[1]xi8>
213-
return %1 : vector<4x[1]xi8>
214-
}
215-
216-
// -----
217-
210+
// Test of shape_cast folding.
211+
// A transpose that is 'order preserving' can be treated like a shape_cast.
218212
// CHECK-LABEL: @shape_cast_transpose
219213
// CHECK-SAME: %[[ARG:.*]]: vector<2x3x1x1xi8>) -> vector<6x1x1xi8> {
220214
// CHECK: %[[SHAPE_CAST:.*]] = vector.shape_cast %[[ARG]] :
@@ -229,6 +223,20 @@ func.func @shape_cast_transpose(%arg : vector<2x3x1x1xi8>) -> vector<6x1x1xi8>
229223

230224
// -----
231225

226+
// Test of shape_cast folding.
227+
// Scalable dimensions should be treated as non-unit dimensions.
228+
// CHECK-LABEL: @shape_cast_transpose_scalable
229+
// CHECK: vector.shape_cast
230+
// CHECK: vector.transpose
231+
func.func @shape_cast_transpose_scalable_unit(%arg : vector<[1]x4x1xi8>) -> vector<4x[1]xi8> {
232+
%0 = vector.shape_cast %arg : vector<[1]x4x1xi8> to vector<[1]x4xi8>
233+
%1 = vector.transpose %0, [1, 0] : vector<[1]x4xi8> to vector<4x[1]xi8>
234+
return %1 : vector<4x[1]xi8>
235+
}
236+
237+
// -----
238+
239+
// Test of shape_cast (not) folding.
232240
// CHECK-LABEL: @negative_shape_cast_transpose
233241
// CHECK-SAME: %[[ARG:.*]]: vector<6xi8>) -> vector<2x3xi8> {
234242
// CHECK: %[[SHAPE_CAST:.*]] = vector.shape_cast %[[ARG]] :

0 commit comments

Comments
 (0)