Skip to content

Commit 98f1d06

Browse files
committed
better grouping of tests
1 parent f8b561d commit 98f1d06

File tree

1 file changed

+27
-11
lines changed

1 file changed

+27
-11
lines changed

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

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
// RUN: mlir-opt %s -canonicalize="test-convergence" -split-input-file -allow-unregistered-dialect | FileCheck %s
22

3-
// This file contains some canonicalizations tests involving vector.transpose.
3+
// This file contains some tests of canonicalizations and foldings involving vector.transpose.
4+
5+
// +----------------------------------------
6+
// Tests of FoldTransposeBroadcast
7+
// +----------------------------------------
48

59
// CHECK-LABEL: func @transpose_scalar_broadcast1
610
// CHECK-SAME: (%[[ARG:.+]]: vector<1xf32>)
@@ -140,7 +144,10 @@ func.func @negative_broadcast_transpose_021(%arg0 : vector<3x1x3xi8>) -> vector<
140144

141145
// -----
142146

143-
// Test of FoldTransposeShapeCast
147+
// +-------------------------------------------
148+
// Tests of FoldTransposeShapeCast
149+
// +-------------------------------------------
150+
144151
// In this test, the permutation maps the non-unit dimensions (1 and 2) as follows:
145152
// 1 -> 0
146153
// 2 -> 4
@@ -159,7 +166,6 @@ func.func @transpose_shape_cast(%arg : vector<1x4x4x1x1xi8>) -> vector<4x4xi8> {
159166

160167
// -----
161168

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

180186
// -----
181187

182-
// Test of FoldTransposeShapeCast
183188
// Currently the conversion shape_cast(transpose) -> shape_cast is disabled for
184189
// scalable vectors because of bad interaction with ConvertIllegalShapeCastOpsToTransposes
185190
// CHECK-LABEL: @negative_transpose_shape_cast_scalable
@@ -193,7 +198,10 @@ func.func @negative_transpose_shape_cast_scalable(%arg : vector<[4]x1xi8>) -> ve
193198

194199
// -----
195200

196-
// Test of shape_cast folding.
201+
// +----------------------------------------
202+
// Tests of shape_cast folding
203+
// +----------------------------------------
204+
197205
// The conversion transpose(shape_cast) -> shape_cast is not disabled for scalable
198206
// vectors.
199207
// CHECK-LABEL: @shape_cast_transpose_scalable
@@ -207,7 +215,6 @@ func.func @shape_cast_transpose_scalable(%arg : vector<[4]xi8>) -> vector<[4]x1x
207215

208216
// -----
209217

210-
// Test of shape_cast folding.
211218
// A transpose that is 'order preserving' can be treated like a shape_cast.
212219
// CHECK-LABEL: @shape_cast_transpose
213220
// CHECK-SAME: %[[ARG:.*]]: vector<2x3x1x1xi8>) -> vector<6x1x1xi8> {
@@ -223,7 +230,6 @@ func.func @shape_cast_transpose(%arg : vector<2x3x1x1xi8>) -> vector<6x1x1xi8>
223230

224231
// -----
225232

226-
// Test of shape_cast folding.
227233
// Scalable dimensions should be treated as non-unit dimensions.
228234
// CHECK-LABEL: @shape_cast_transpose_scalable
229235
// CHECK: vector.shape_cast
@@ -236,7 +242,6 @@ func.func @shape_cast_transpose_scalable_unit(%arg : vector<[1]x4x1xi8>) -> vect
236242

237243
// -----
238244

239-
// Test of shape_cast (not) folding.
240245
// CHECK-LABEL: @negative_shape_cast_transpose
241246
// CHECK-SAME: %[[ARG:.*]]: vector<6xi8>) -> vector<2x3xi8> {
242247
// CHECK: %[[SHAPE_CAST:.*]] = vector.shape_cast %[[ARG]] :
@@ -250,7 +255,10 @@ func.func @negative_shape_cast_transpose(%arg : vector<6xi8>) -> vector<2x3xi8>
250255

251256
// -----
252257

253-
// Test of transpose folding
258+
// +-----------------------------------
259+
// Tests of transpose folding
260+
// +-----------------------------------
261+
254262
// CHECK-LABEL: transpose_1D_identity
255263
// CHECK-SAME: [[ARG:%.*]]: vector<4xf32>
256264
// CHECK-NEXT: return [[ARG]]
@@ -261,7 +269,6 @@ func.func @transpose_1D_identity(%arg : vector<4xf32>) -> vector<4xf32> {
261269

262270
// -----
263271

264-
// Test of transpose folding
265272
// CHECK-LABEL: transpose_2D_identity
266273
// CHECK-SAME: [[ARG:%.*]]: vector<4x3xf32>
267274
// CHECK-NEXT: return [[ARG]]
@@ -272,11 +279,20 @@ func.func @transpose_2D_identity(%arg : vector<4x3xf32>) -> vector<4x3xf32> {
272279

273280
// -----
274281

275-
// Test of transpose folding
276282
// CHECK-LABEL: transpose_shape_and_order_preserving
277283
// CHECK-SAME: [[ARG:%.*]]: vector<6x1x1x4xi8>
278284
// CHECK-NEXT: return [[ARG]]
279285
func.func @transpose_shape_and_order_preserving(%arg : vector<6x1x1x4xi8>) -> vector<6x1x1x4xi8> {
280286
%0 = vector.transpose %arg, [0, 2, 1, 3] : vector<6x1x1x4xi8> to vector<6x1x1x4xi8>
281287
return %0 : vector<6x1x1x4xi8>
282288
}
289+
290+
// -----
291+
292+
// CHECK-LABEL: negative_transpose_fold
293+
// CHECK: [[TRANSP:%.*]] = vector.transpose
294+
// CHECK: return [[TRANSP]]
295+
func.func @negative_transpose_fold(%arg : vector<2x2xi8>) -> vector<2x2xi8> {
296+
%0 = vector.transpose %arg, [1, 0] : vector<2x2xi8> to vector<2x2xi8>
297+
return %0 : vector<2x2xi8>
298+
}

0 commit comments

Comments
 (0)