Skip to content

Commit 1b779b7

Browse files
committed
Add 2D test case
1 parent e77eddd commit 1b779b7

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,4 +475,34 @@ gpu.module @test_distribution {
475475
%cst = arith.constant {layout_result_0 = #xegpu.layout<sg_layout = [32, 1], sg_data = [1, 1]>} dense<[[0], [16], [32], [48], [64], [80], [96], [112], [128], [144], [160], [176], [192], [208], [224], [240], [256], [272], [288], [304], [320], [336], [352], [368], [384], [400], [416], [432], [448], [464], [480], [496]]> : vector<32x1xindex>
476476
gpu.return
477477
}
478+
479+
// CHECK-LABEL: non_splat_constant_2D_non_unit_dim
480+
gpu.func @non_splat_constant_2D_non_unit_dim() {
481+
// CHECK-DAG: %[[BASECST:.*]] = arith.constant dense<{{.*}} : vector<2x2xindex>
482+
// CHECK-DAG: %[[SGID:.*]] = gpu.subgroup_id : index
483+
// CHECK-DAG: %[[IDY:.*]] = affine.apply #map()[%[[SGID]]]
484+
// CHECK-DAG: %[[IDX:.*]] = affine.apply #map1()[%[[SGID]]]
485+
// CHECK-DAG: %[[MULY:.*]] = index.mul %[[IDY]], %[[C2:.*]]
486+
// CHECK-DAG: %[[C2_2:.*]] = arith.constant 2 : index
487+
// CHECK-DAG: %[[MULX:.*]] = index.mul %[[IDX]], %[[C2:.*]]
488+
// CHECK-DAG: %[[REMU_Y:.*]] = index.remu %[[MULY]], %[[C8:.*]]
489+
// CHECK-DAG: %[[C8_2:.*]] = arith.constant 8 : index
490+
// CHECK-DAG: %[[REMU_X:.*]] = index.remu %[[MULX]], %[[C8:.*]]
491+
// CHECK-DAG: %[[MUL5:.*]] = arith.muli %[[REMU_Y]], %[[C8:.*]] : index
492+
// CHECK-DAG: %[[MUL6:.*]] = arith.muli %[[REMU_X]], %[[C16:.*]] : index
493+
// CHECK-DAG: %[[ADDIDX:.*]] = arith.addi %[[MUL5]], %[[MUL6]] : index
494+
// CHECK-DAG: %[[BCAST:.*]] = vector.broadcast %[[ADDIDX]] : index to vector<2x2xindex>
495+
// CHECK-DAG: %[[ADDCST:.*]] = arith.addi %[[BASECST]], %[[BCAST]] : vector<2x2xindex>
496+
%cst_8x8 = arith.constant {layout_result_0 = #xegpu.layout<sg_layout = [4, 4], sg_data = [2, 2]>} dense<[
497+
[0, 16, 32, 48, 64, 80, 96, 112],
498+
[8, 24, 40, 56, 72, 88, 104, 120],
499+
[16, 32, 48, 64, 80, 96, 112, 128],
500+
[24, 40, 56, 72, 88, 104, 120, 136],
501+
[32, 48, 64, 80, 96, 112, 128, 144],
502+
[40, 56, 72, 88, 104, 120, 136, 152],
503+
[48, 64, 80, 96, 112, 128, 144, 160],
504+
[56, 72, 88, 104, 120, 136, 152, 168]
505+
]> : vector<8x8xindex>
506+
gpu.return
507+
}
478508
}

0 commit comments

Comments
 (0)