@@ -303,13 +303,38 @@ func @invalid_cmp_shape(%idx : () -> ()) {
303
303
304
304
// -----
305
305
306
+ func @dma_start_not_enough_operands () {
307
+ // expected-error@+1 {{expected at least 4 operands}}
308
+ " std.dma_start" () : () -> ()
309
+ }
310
+
311
+ // -----
312
+
306
313
func @dma_no_src_memref (%m : f32 , %tag : f32 , %c0 : index ) {
307
314
// expected-error@+1 {{expected source to be of memref type}}
308
315
dma_start %m [%c0 ], %m [%c0 ], %c0 , %tag [%c0 ] : f32 , f32 , f32
309
316
}
310
317
311
318
// -----
312
319
320
+ func @dma_start_not_enough_operands_for_src (
321
+ %src: memref <2 x2 x2 xf32 >, %idx: index ) {
322
+ // expected-error@+1 {{expected at least 7 operands}}
323
+ " std.dma_start" (%src , %idx , %idx , %idx ) : (memref <2 x2 x2 xf32 >, index , index , index ) -> ()
324
+ }
325
+
326
+ // -----
327
+
328
+ func @dma_start_src_index_wrong_type (
329
+ %src: memref <2 x2 xf32 >, %idx: index , %dst: memref <2 xf32 ,1 >,
330
+ %tag: memref <i32 ,2 >, %flt: f32 ) {
331
+ // expected-error@+1 {{expected source indices to be of index type}}
332
+ " std.dma_start" (%src , %idx , %flt , %dst , %idx , %tag , %idx )
333
+ : (memref <2 x2 xf32 >, index , f32 , memref <2 xf32 ,1 >, index , memref <i32 ,2 >, index ) -> ()
334
+ }
335
+
336
+ // -----
337
+
313
338
func @dma_no_dst_memref (%m : f32 , %tag : f32 , %c0 : index ) {
314
339
%mref = alloc () : memref <8 x f32 >
315
340
// expected-error@+1 {{expected destination to be of memref type}}
@@ -318,6 +343,36 @@ func @dma_no_dst_memref(%m : f32, %tag : f32, %c0 : index) {
318
343
319
344
// -----
320
345
346
+ func @dma_start_not_enough_operands_for_dst (
347
+ %src: memref <2 x2 xf32 >, %idx: index , %dst: memref <2 xf32 ,1 >,
348
+ %tag: memref <i32 ,2 >) {
349
+ // expected-error@+1 {{expected at least 7 operands}}
350
+ " std.dma_start" (%src , %idx , %idx , %dst , %idx , %idx )
351
+ : (memref <2 x2 xf32 >, index , index , memref <2 xf32 ,1 >, index , index ) -> ()
352
+ }
353
+
354
+ // -----
355
+
356
+ func @dma_start_dst_index_wrong_type (
357
+ %src: memref <2 x2 xf32 >, %idx: index , %dst: memref <2 xf32 ,1 >,
358
+ %tag: memref <i32 ,2 >, %flt: f32 ) {
359
+ // expected-error@+1 {{expected destination indices to be of index type}}
360
+ " std.dma_start" (%src , %idx , %idx , %dst , %flt , %tag , %idx )
361
+ : (memref <2 x2 xf32 >, index , index , memref <2 xf32 ,1 >, f32 , memref <i32 ,2 >, index ) -> ()
362
+ }
363
+
364
+ // -----
365
+
366
+ func @dma_start_dst_index_wrong_type (
367
+ %src: memref <2 x2 xf32 >, %idx: index , %dst: memref <2 xf32 ,1 >,
368
+ %tag: memref <i32 ,2 >, %flt: f32 ) {
369
+ // expected-error@+1 {{expected num elements to be of index type}}
370
+ " std.dma_start" (%src , %idx , %idx , %dst , %idx , %flt , %tag )
371
+ : (memref <2 x2 xf32 >, index , index , memref <2 xf32 ,1 >, index , f32 , memref <i32 ,2 >) -> ()
372
+ }
373
+
374
+ // -----
375
+
321
376
func @dma_no_tag_memref (%tag : f32 , %c0 : index ) {
322
377
%mref = alloc () : memref <8 x f32 >
323
378
// expected-error@+1 {{expected tag to be of memref type}}
@@ -326,9 +381,80 @@ func @dma_no_tag_memref(%tag : f32, %c0 : index) {
326
381
327
382
// -----
328
383
384
+ func @dma_start_not_enough_operands_for_tag (
385
+ %src: memref <2 x2 xf32 >, %idx: index , %dst: memref <2 xf32 ,1 >,
386
+ %tag: memref <2 xi32 ,2 >) {
387
+ // expected-error@+1 {{expected at least 8 operands}}
388
+ " std.dma_start" (%src , %idx , %idx , %dst , %idx , %idx , %tag )
389
+ : (memref <2 x2 xf32 >, index , index , memref <2 xf32 ,1 >, index , index , memref <2 xi32 ,2 >) -> ()
390
+ }
391
+
392
+ // -----
393
+
394
+ func @dma_start_dst_index_wrong_type (
395
+ %src: memref <2 x2 xf32 >, %idx: index , %dst: memref <2 xf32 ,1 >,
396
+ %tag: memref <2 xi32 ,2 >, %flt: f32 ) {
397
+ // expected-error@+1 {{expected tag indices to be of index type}}
398
+ " std.dma_start" (%src , %idx , %idx , %dst , %idx , %idx , %tag , %flt )
399
+ : (memref <2 x2 xf32 >, index , index , memref <2 xf32 ,1 >, index , index , memref <2 xi32 ,2 >, f32 ) -> ()
400
+ }
401
+
402
+ // -----
403
+
404
+ func @dma_start_same_space (
405
+ %src: memref <2 x2 xf32 >, %idx: index , %dst: memref <2 xf32 >,
406
+ %tag: memref <i32 ,2 >) {
407
+ // expected-error@+1 {{DMA should be between different memory spaces}}
408
+ dma_start %src [%idx , %idx ], %dst [%idx ], %idx , %tag [] : memref <2 x2 xf32 >, memref <2 xf32 >, memref <i32 ,2 >
409
+ }
410
+
411
+ // -----
412
+
413
+ func @dma_start_too_many_operands (
414
+ %src: memref <2 x2 xf32 >, %idx: index , %dst: memref <2 xf32 ,1 >,
415
+ %tag: memref <i32 ,2 >) {
416
+ // expected-error@+1 {{incorrect number of operands}}
417
+ " std.dma_start" (%src , %idx , %idx , %dst , %idx , %idx , %tag , %idx , %idx , %idx )
418
+ : (memref <2 x2 xf32 >, index , index , memref <2 xf32 ,1 >, index , index , memref <i32 ,2 >, index , index , index ) -> ()
419
+ }
420
+
421
+
422
+ // -----
423
+
424
+ func @dma_start_wrong_stride_type (
425
+ %src: memref <2 x2 xf32 >, %idx: index , %dst: memref <2 xf32 ,1 >,
426
+ %tag: memref <i32 ,2 >, %flt: f32 ) {
427
+ // expected-error@+1 {{expected stride and num elements per stride to be of type index}}
428
+ " std.dma_start" (%src , %idx , %idx , %dst , %idx , %idx , %tag , %idx , %flt )
429
+ : (memref <2 x2 xf32 >, index , index , memref <2 xf32 ,1 >, index , index , memref <i32 ,2 >, index , f32 ) -> ()
430
+ }
431
+
432
+ // -----
433
+
434
+ func @dma_wait_not_enough_operands () {
435
+ // expected-error@+1 {{expected at least 2 operands}}
436
+ " std.dma_wait" () : () -> ()
437
+ }
438
+
439
+ // -----
440
+
329
441
func @dma_wait_no_tag_memref (%tag : f32 , %c0 : index ) {
330
442
// expected-error@+1 {{expected tag to be of memref type}}
331
- dma_wait %tag [%c0 ], %arg0 : f32
443
+ " std.dma_wait" (%tag , %c0 , %c0 ) : (f32 , index , index ) -> ()
444
+ }
445
+
446
+ // -----
447
+
448
+ func @dma_wait_wrong_index_type (%tag : memref <2 xi32 >, %idx: index , %flt: f32 ) {
449
+ // expected-error@+1 {{expected tag indices to be of index type}}
450
+ " std.dma_wait" (%tag , %flt , %idx ) : (memref <2 xi32 >, f32 , index ) -> ()
451
+ }
452
+
453
+ // -----
454
+
455
+ func @dma_wait_wrong_num_elements_type (%tag : memref <2 xi32 >, %idx: index , %flt: f32 ) {
456
+ // expected-error@+1 {{expected the number of elements to be of index type}}
457
+ " std.dma_wait" (%tag , %idx , %flt ) : (memref <2 xi32 >, index , f32 ) -> ()
332
458
}
333
459
334
460
// -----
0 commit comments