@@ -443,3 +443,75 @@ func.func private @NOutOfM(%arg0: tensor<?x?x?xf64, #NOutOfM>) {
443
443
func.func private @NOutOfM (%arg0: tensor <?x?x?xf64 , #NOutOfM >) {
444
444
return
445
445
}
446
+
447
+ // -----
448
+
449
+ #CSR_ExpType = #sparse_tensor.encoding <{
450
+ map = (d0 , d1 ) -> (d0 : dense , d1 : compressed),
451
+ posWidth = 32 ,
452
+ crdWidth = 32 ,
453
+ explicitVal = 1 : i32 ,
454
+ implicitVal = 0.0 : f32
455
+ }>
456
+
457
+ // expected-error@+1 {{explicit value type mismatch between encoding and tensor element type: 'i32' != 'f32'}}
458
+ func.func private @sparse_csr (tensor <?x?xf32 , #CSR_ExpType >)
459
+
460
+ // -----
461
+
462
+ #CSR_ImpType = #sparse_tensor.encoding <{
463
+ map = (d0 , d1 ) -> (d0 : dense , d1 : compressed),
464
+ posWidth = 32 ,
465
+ crdWidth = 32 ,
466
+ explicitVal = 1 : i32 ,
467
+ implicitVal = 0.0 : f32
468
+ }>
469
+
470
+ // expected-error@+1 {{implicit value type mismatch between encoding and tensor element type: 'f32' != 'i32'}}
471
+ func.func private @sparse_csr (tensor <?x?xi32 , #CSR_ImpType >)
472
+
473
+ // -----
474
+
475
+ // expected-error@+1 {{expected a numeric value for explicitVal}}
476
+ #CSR_ExpType = #sparse_tensor.encoding <{
477
+ map = (d0 , d1 ) -> (d0 : dense , d1 : compressed),
478
+ posWidth = 32 ,
479
+ crdWidth = 32 ,
480
+ explicitVal = " str"
481
+ }>
482
+ func.func private @sparse_csr (tensor <?x?xi32 , #CSR_ExpType >)
483
+
484
+ // -----
485
+
486
+ // expected-error@+1 {{expected a numeric value for implicitVal}}
487
+ #CSR_ImpType = #sparse_tensor.encoding <{
488
+ map = (d0 , d1 ) -> (d0 : dense , d1 : compressed),
489
+ posWidth = 32 ,
490
+ crdWidth = 32 ,
491
+ implicitVal = " str"
492
+ }>
493
+ func.func private @sparse_csr (tensor <?x?xi32 , #CSR_ImpType >)
494
+
495
+ // -----
496
+
497
+ #CSR_ImpVal = #sparse_tensor.encoding <{
498
+ map = (d0 , d1 ) -> (d0 : dense , d1 : compressed),
499
+ posWidth = 32 ,
500
+ crdWidth = 32 ,
501
+ implicitVal = 1 : i32
502
+ }>
503
+
504
+ // expected-error@+1 {{implicit value must be zero}}
505
+ func.func private @sparse_csr (tensor <?x?xi32 , #CSR_ImpVal >)
506
+
507
+ // -----
508
+
509
+ #CSR_ImpVal = #sparse_tensor.encoding <{
510
+ map = (d0 , d1 ) -> (d0 : dense , d1 : compressed),
511
+ posWidth = 32 ,
512
+ crdWidth = 32 ,
513
+ implicitVal = 1.0 : f32
514
+ }>
515
+
516
+ // expected-error@+1 {{implicit value must be zero}}
517
+ func.func private @sparse_csr (tensor <?x?xf32 , #CSR_ImpVal >)
0 commit comments