Skip to content

Commit 3f5d692

Browse files
committed
add unit test
1 parent a368430 commit 3f5d692

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

mlir/test/Dialect/XeGPU/xegpu-wg-to-sg.mlir

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,33 @@ gpu.module @test_1_1_assignment {
2626
gpu.return
2727
}
2828

29+
// CHECK-LABEL: create_nd_tdesc_from_higher_rank_memref
30+
// CHECK-SAME: [[ARG_0:%.*]]: memref<3x256x128xf32>
31+
gpu.func @create_nd_tdesc_from_higher_rank_memref(%src: memref<3x256x128xf32>) {
32+
//CHECK: [[SGID:%.+]] = gpu.subgroup_id : index
33+
//CHECK: [[SGIDY:%.+]] = affine.apply #map()[[[SGID]]]
34+
//CHECK: [[SGIDX:%.+]] = affine.apply #map1()[[[SGID]]]
35+
//CHECK: [[C32:%.+]] = arith.constant 32 : index
36+
//CHECK: [[LY:%.+]] = index.mul [[SGIDY]], [[C32]]
37+
//CHECK: [[LX:%.+]] = index.mul [[SGIDX]], [[C32]]
38+
//CHECK: [[C0:%.+]] = arith.constant 0 : index
39+
//CHECK: [[C0_2:%.+]] = arith.constant 0 : index
40+
//CHECK: [[UY:%.+]] = arith.addi [[LY]], [[C0]] : index
41+
//CHECK: [[UX:%.+]] = arith.addi [[LX]], [[C0_2]] : index
42+
//CHECK: [[C256:%.+]] = arith.constant 256 : index
43+
//CHECK: [[MODY:%.+]] = index.remu [[UY]], [[C256]]
44+
//CHECK: [[C128:%.+]] = arith.constant 128 : index
45+
//CHECK: [[MODX:%.+]] = index.remu [[UX]], [[C128]]
46+
//CHECK: [[C0_3:%.+]] = arith.constant 0 : index
47+
//CHECK: [[Y:%.+]] = index.add [[MODY]], [[C0_3]]
48+
//CHECK: [[C0_4:%.+]] = arith.constant 0 : index
49+
//CHECK: [[X:%.+]] = index.add [[MODX]], [[C0_4]]
50+
//CHECK: [[TDESC:%.+]] = xegpu.create_nd_tdesc [[ARG_0]][1, [[Y]], [[X]]] : memref<3x256x128xf32> -> !xegpu.tensor_desc<32x32xf32, #xegpu.layout<lane_layout = [1, 16], lane_data = [1, 1]>>
51+
%tdesc = xegpu.create_nd_tdesc %src[1, 0, 0] : memref<3x256x128xf32>
52+
-> !xegpu.tensor_desc<256x128xf32, #xegpu.layout<sg_layout = [8, 4], sg_data = [32, 32], lane_layout = [1, 16], lane_data = [1, 1]>>
53+
gpu.return
54+
}
55+
2956
// CHECK-LABEL: load_nd_tdesc
3057
// CHECK-SAME: %[[ARG_0:.*]]: memref<256x128xf32>
3158
gpu.func @load_nd_tdesc(%src: memref<256x128xf32>) {

0 commit comments

Comments
 (0)