@@ -29,6 +29,27 @@ func.func @test_create_nd_tdesc_vc_4(%src: memref<2x24x32xf32, 3>) {
2929 return
3030}
3131
32+ // -----
33+ func.func @test_create_nd_tdesc_subgroup_1 (%src: memref <128 x128 xf32 >) {
34+ // expected-error@+1 {{cannot distribute [128, 128] using #xegpu.layout<sg_layout = [4, 2], sg_data = [24, 48]>}}
35+ %1 = xegpu.create_nd_tdesc %src [0 , 0 ] : memref <128 x128 xf32 > -> !xegpu.tensor_desc <128 x128 xf32 , #xegpu.layout <sg_layout = [4 , 2 ], sg_data = [24 , 48 ]>>
36+ return
37+ }
38+
39+ // -----
40+ func.func @test_create_nd_tdesc_subgroup_1 (%src: memref <128 x128 xf32 >) {
41+ // expected-error@+1 {{cannot distribute [128, 128] using #xegpu.layout<sg_layout = [4, 2], sg_data = [32, 64], inst_data = [24, 48]>}}
42+ %1 = xegpu.create_nd_tdesc %src [0 , 0 ] : memref <128 x128 xf32 > -> !xegpu.tensor_desc <128 x128 xf32 , #xegpu.layout <sg_layout = [4 , 2 ], sg_data = [32 , 64 ], inst_data = [24 , 48 ]>>
43+ return
44+ }
45+
46+ // -----
47+ func.func @test_create_nd_tdesc_subgroup_1 (%src: memref <128 x128 xf32 >) {
48+ // expected-error@+1 {{cannot distribute [128, 128] using #xegpu.layout<sg_layout = [4, 2], sg_data = [32, 64], inst_data = [64, 32]>}}
49+ %1 = xegpu.create_nd_tdesc %src [0 , 0 ] : memref <128 x128 xf32 > -> !xegpu.tensor_desc <128 x128 xf32 , #xegpu.layout <sg_layout = [4 , 2 ], sg_data = [32 , 64 ], inst_data = [64 , 32 ]>>
50+ return
51+ }
52+
3253// -----
3354func.func @test_prefetch_nd_vc_1 (%src: memref <24 x32 xf16 >) {
3455 %1 = xegpu.create_nd_tdesc %src [0 , 0 ] : memref <24 x32 xf16 > -> !xegpu.tensor_desc <8 x16 xf16 >
@@ -77,6 +98,17 @@ func.func @test_load_nd_vc_3(%src: memref<8x16xf16>) {
7798 return
7899}
79100
101+ // -----
102+ func.func @test_load_nd_vc_4 (%src: memref <24 x32 xf32 >) {
103+ %1 = xegpu.create_nd_tdesc %src [0 , 0 ] : memref <24 x32 xf32 > ->
104+ !xegpu.tensor_desc <8 x16 xf32 >
105+ // expected-error@+1 {{Result shape [8, 1] is not consistent with tensor descriptor}}
106+ %2 = xegpu.load_nd %1 <{l1_hint = #xegpu.cache_hint <cached >,
107+ l2_hint = #xegpu.cache_hint <uncached >}>
108+ : !xegpu.tensor_desc <8 x16 xf32 > -> vector <8 x1 xf32 >
109+ return
110+ }
111+
80112// -----
81113func.func @test_load_nd_layout (%src: memref <24 x32 xf32 >) {
82114 %1 = xegpu.create_nd_tdesc %src [0 , 0 ] : memref <24 x32 xf32 > -> !xegpu.tensor_desc <16 xf32 >
@@ -87,13 +119,10 @@ func.func @test_load_nd_layout(%src: memref<24x32xf32>) {
87119}
88120
89121// -----
90- func.func @test_load_nd_vc_6 (%src: memref <24 x32 xf32 >) {
91- %1 = xegpu.create_nd_tdesc %src [0 , 0 ] : memref <24 x32 xf32 > ->
92- !xegpu.tensor_desc <8 x16 xf32 >
93- // expected-error@+1 {{Result shape [8, 1] is not consistent with tensor descriptor}}
94- %2 = xegpu.load_nd %1 <{l1_hint = #xegpu.cache_hint <cached >,
95- l2_hint = #xegpu.cache_hint <uncached >}>
96- : !xegpu.tensor_desc <8 x16 xf32 > -> vector <8 x1 xf32 >
122+ func.func @test_load_nd_simt (%src: memref <24 x32 xf32 >) {
123+ %1 = xegpu.create_nd_tdesc %src [0 , 0 ] : memref <24 x32 xf32 > -> !xegpu.tensor_desc <8 x16 xf32 , #xegpu.layout <lane_layout = [1 , 16 ], lane_data = [1 , 1 ]>>
124+ // expected-error@+1 {{TensorDesc doesn't need LayoutAttr for SIMT code}}
125+ %2 = xegpu.load_nd %1 : !xegpu.tensor_desc <8 x16 xf32 , #xegpu.layout <lane_layout = [1 , 16 ], lane_data = [1 , 1 ]>> -> vector <8 xf32 >
97126 return
98127}
99128
@@ -135,6 +164,14 @@ func.func @test_store_nd_simt(%dst: memref<24x32xf32>, %data: vector<3xf32>) {
135164 return
136165}
137166
167+ // -----
168+ func.func @test_store_nd_simt (%src: memref <24 x32 xf32 >, %data: vector <8 xf32 >) {
169+ %1 = xegpu.create_nd_tdesc %src [0 , 0 ] : memref <24 x32 xf32 > -> !xegpu.tensor_desc <8 x16 xf32 , #xegpu.layout <lane_layout = [1 , 16 ], lane_data = [1 , 1 ]>>
170+ // expected-error@+1 {{TensorDesc doesn't need LayoutAttr for SIMT code}}
171+ xegpu.store_nd %data , %1 : vector <8 xf32 >, !xegpu.tensor_desc <8 x16 xf32 , #xegpu.layout <lane_layout = [1 , 16 ], lane_data = [1 , 1 ]>>
172+ return
173+ }
174+
138175// -----
139176func.func @test_store_nd_vc_5 (%dst: memref <24 x32 xf32 >, %data: vector <8 x1 xf32 >) {
140177 %1 = xegpu.create_nd_tdesc %dst [0 , 0 ] : memref <24 x32 xf32 > ->
@@ -404,31 +441,31 @@ func.func @tensor_desc_1D_invalid_map_data(%src: memref<24x32xf32>) {
404441// -----
405442func.func @tensor_desc_invalid_map_layout (%src: memref <24 x32 xf32 >) {
406443 %0 = xegpu.create_nd_tdesc %src [0 , 0 ] : memref <24 x32 xf32 > ->
407- // expected-error@+1 {{cannot distribute 8 over 16 work items with 1 elements each }}
444+ // expected-error@+1 {{cannot distribute [4, 8] using #xegpu.layout<lane_layout = [1, 16], lane_data = [1, 1]> }}
408445 !xegpu.tensor_desc <4 x8 xf32 , #xegpu.layout <lane_layout = [1 , 16 ], lane_data = [1 , 1 ]>>
409446 return
410447}
411448
412449// -----
413450func.func @tensor_desc_invalid_map_layout_1 (%src: memref <24 x32 xf32 >) {
414451 %0 = xegpu.create_nd_tdesc %src [0 , 0 ] : memref <24 x32 xf32 > ->
415- // expected-error@+1 {{cannot distribute 4 over 8 work items with 1 elements each }}
452+ // expected-error@+1 {{cannot distribute [4, 8] using #xegpu.layout<lane_layout = [8, 2], lane_data = [1, 1]> }}
416453 !xegpu.tensor_desc <4 x8 xf32 , #xegpu.layout <lane_layout = [8 , 2 ], lane_data = [1 , 1 ]>>
417454 return
418455}
419456
420457// -----
421458func.func @tensor_desc_invalid_map_data (%src: memref <24 x32 xf32 >) {
422459 %0 = xegpu.create_nd_tdesc %src [0 , 0 ] : memref <24 x32 xf32 > ->
423- // expected-error@+1 {{cannot distribute 4 over 2 work items with 4 elements each }}
460+ // expected-error@+1 {{cannot distribute [4, 8] using #xegpu.layout<lane_layout = [2, 8], lane_data = [4, 1]> }}
424461 !xegpu.tensor_desc <4 x8 xf32 , #xegpu.layout <lane_layout = [2 , 8 ], lane_data = [4 , 1 ]>>
425462 return
426463}
427464
428465// -----
429466func.func @tensor_desc_invalid_map_data_1 (%src: memref <24 x32 xf32 >) {
430467 %0 = xegpu.create_nd_tdesc %src [0 , 0 ] : memref <24 x32 xf32 > ->
431- // expected-error@+1 {{cannot distribute 4 over 8 work items with 1 elements each }}
468+ // expected-error@+1 {{cannot distribute [4, 8] using #xegpu.layout<lane_layout = [8, 2], lane_data = [1, 2]> }}
432469 !xegpu.tensor_desc <4 x8 xf32 , #xegpu.layout <lane_layout = [8 , 2 ], lane_data = [1 , 2 ]>>
433470 return
434471}
0 commit comments