Skip to content

Commit bbd6530

Browse files
committed
add more invalid tests
1 parent 871e4d4 commit bbd6530

File tree

1 file changed

+29
-4
lines changed

1 file changed

+29
-4
lines changed

mlir/test/Dialect/XeGPU/invalid.mlir

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,14 @@ func.func @load_gather_vc_3(%src: ui64) {
384384
return
385385
}
386386

387+
// -----
388+
func.func @prefetch_offset_wi_1(%src: memref<4x4xf32>) {
389+
%offsets = arith.constant dense<[0]> : vector<1xindex>
390+
// expected-error@+1 {{Expecting the source is a 1D memref or pointer}}
391+
xegpu.prefetch %src[%offsets]: memref<4x4xf32>, vector<1xindex>
392+
return
393+
}
394+
387395
// -----
388396
func.func @load_gather_offset_sg(%src: memref<?xf16>) {
389397
%offsets = arith.constant dense<[0, 8, 16, 24]> : vector<4xindex>
@@ -405,7 +413,7 @@ func.func @load_gather_offset_wi(%src: ui64) {
405413
}
406414

407415
// -----
408-
func.func @store_scatter_offset_wi(%src: memref<?xf16>) {
416+
func.func @store_scatter_offset_wi_1(%src: memref<?xf16>) {
409417
%val = arith.constant dense<2.9>: vector<4xf16>
410418
%offsets = arith.constant dense<[0]> : vector<1xindex>
411419
%mask = arith.constant dense<1>: vector<1xi1>
@@ -415,17 +423,34 @@ func.func @store_scatter_offset_wi(%src: memref<?xf16>) {
415423
return
416424
}
417425

426+
// -----
427+
func.func @store_scatter_offset_wi_2(%src: memref<4x4xf16>) {
428+
%val = arith.constant dense<2.9>: vector<4xf16>
429+
%offsets = arith.constant dense<[0]> : vector<1xindex>
430+
%mask = arith.constant dense<1>: vector<1xi1>
431+
// expected-error@+1 {{Expecting the dest is a 1D memref or pointer}}
432+
xegpu.store %val, %src[%offsets], %mask
433+
: vector<4xf16>, memref<4x4xf16>, vector<1xindex>, vector<1xi1>
434+
return
435+
}
418436

419437
// -----
420-
func.func @load_gather_offset_wi(%src: ui64) {
421-
%val = arith.constant dense<2.9>: vector<4x2xf16>
438+
func.func @load_gather_offset_wi_2(%src: ui64) {
422439
%mask = arith.constant dense<1>: vector<1xi1>
423440
%offsets = arith.constant dense<[0]> : vector<1xindex>
424441
// expected-error@+1 {{value elements must match chunk size}}
425-
%2 = xegpu.load %src[%offsets], %mask <{chunk_size = 2}> : ui64, vector<1xindex>, vector<1xi1> -> vector<4xf32>
442+
%2 = xegpu.load %src[%offsets], %mask <{chunk_size = 2}> : ui64, vector<1xindex>, vector<1xi1> -> vector<4xf16>
426443
return
427444
}
428445

446+
// -----
447+
func.func @load_gather_offset_wi_1(%src: memref<4x4xf32>) {
448+
%mask = arith.constant dense<1>: vector<1xi1>
449+
%offsets = arith.constant dense<[0]> : vector<1xindex>
450+
// expected-error@+1 {{Expecting the source is a 1D memref or pointer}}
451+
%2 = xegpu.load %src[%offsets], %mask <{chunk_size = 2}> : memref<4x4xf32>, vector<1xindex>, vector<1xi1> -> vector<2xf32>
452+
return
453+
}
429454

430455
// -----
431456
func.func @store_scatter_vc_1(%src: memref<24x32xf32>) {

0 commit comments

Comments
 (0)