@@ -482,7 +482,9 @@ def Tosa_ErfOp : Tosa_ElementwiseUnaryOp<"erf"> {
482
482
//===----------------------------------------------------------------------===//
483
483
def Tosa_AddOp : Tosa_ElementwiseOp<"add", [
484
484
Commutative,
485
- SameOperandsAndResultElementType]> {
485
+ ResultsBroadcastableShape,
486
+ SameOperandsAndResultElementType,
487
+ SameOperandsAndResultRank]> {
486
488
let summary = "Elementwise addition operator";
487
489
488
490
let description = [{
@@ -515,8 +517,10 @@ def Tosa_AddOp : Tosa_ElementwiseOp<"add", [
515
517
//===----------------------------------------------------------------------===//
516
518
// Operator: arithmetic_right_shift
517
519
//===----------------------------------------------------------------------===//
518
- def Tosa_ArithmeticRightShiftOp : Tosa_ElementwiseOp<"arithmetic_right_shift",
519
- [SameOperandsAndResultElementType]> {
520
+ def Tosa_ArithmeticRightShiftOp : Tosa_ElementwiseOp<"arithmetic_right_shift", [
521
+ ResultsBroadcastableShape,
522
+ SameOperandsAndResultElementType,
523
+ SameOperandsAndResultRank]> {
520
524
let summary = "Elementwise Arithmetic Right Shift";
521
525
522
526
let description = [{
@@ -540,7 +544,9 @@ def Tosa_ArithmeticRightShiftOp : Tosa_ElementwiseOp<"arithmetic_right_shift",
540
544
//===----------------------------------------------------------------------===//
541
545
def Tosa_BitwiseAndOp : Tosa_ElementwiseOp<"bitwise_and", [
542
546
Commutative,
543
- SameOperandsAndResultElementType]> {
547
+ ResultsBroadcastableShape,
548
+ SameOperandsAndResultElementType,
549
+ SameOperandsAndResultRank]> {
544
550
let summary = "Bitwise AND operator";
545
551
546
552
let description = [{
@@ -563,7 +569,9 @@ def Tosa_BitwiseAndOp : Tosa_ElementwiseOp<"bitwise_and", [
563
569
//===----------------------------------------------------------------------===//
564
570
def Tosa_BitwiseOrOp : Tosa_ElementwiseOp<"bitwise_or", [
565
571
Commutative,
566
- SameOperandsAndResultElementType]> {
572
+ ResultsBroadcastableShape,
573
+ SameOperandsAndResultElementType,
574
+ SameOperandsAndResultRank]> {
567
575
let summary = "Bitwise OR operator";
568
576
569
577
let description = [{
@@ -586,7 +594,9 @@ def Tosa_BitwiseOrOp : Tosa_ElementwiseOp<"bitwise_or", [
586
594
//===----------------------------------------------------------------------===//
587
595
def Tosa_BitwiseXorOp : Tosa_ElementwiseOp<"bitwise_xor", [
588
596
Commutative,
589
- SameOperandsAndResultElementType]> {
597
+ ResultsBroadcastableShape,
598
+ SameOperandsAndResultElementType,
599
+ SameOperandsAndResultRank]> {
590
600
let summary = "Bitwise XOR operator";
591
601
592
602
let description = [{
@@ -607,7 +617,10 @@ def Tosa_BitwiseXorOp : Tosa_ElementwiseOp<"bitwise_xor", [
607
617
//===----------------------------------------------------------------------===//
608
618
// Operator: int_div
609
619
//===----------------------------------------------------------------------===//
610
- def Tosa_IntDivOp : Tosa_ElementwiseOp<"int_div", [SameOperandsAndResultElementType]> {
620
+ def Tosa_IntDivOp : Tosa_ElementwiseOp<"int_div", [
621
+ ResultsBroadcastableShape,
622
+ SameOperandsAndResultRank,
623
+ SameOperandsAndResultElementType]> {
611
624
let summary = "Integer divide operator";
612
625
613
626
let description = [{
@@ -632,7 +645,9 @@ def Tosa_IntDivOp : Tosa_ElementwiseOp<"int_div", [SameOperandsAndResultElementT
632
645
//===----------------------------------------------------------------------===//
633
646
def Tosa_LogicalAndOp : Tosa_ElementwiseOp<"logical_and", [
634
647
Commutative,
635
- SameOperandsAndResultElementType]> {
648
+ ResultsBroadcastableShape,
649
+ SameOperandsAndResultElementType,
650
+ SameOperandsAndResultRank]> {
636
651
let summary = "Returns the truth value of x AND y element-wise.";
637
652
638
653
let description = [{
@@ -653,8 +668,10 @@ def Tosa_LogicalAndOp : Tosa_ElementwiseOp<"logical_and", [
653
668
//===----------------------------------------------------------------------===//
654
669
// Operator: logical_left_shift
655
670
//===----------------------------------------------------------------------===//
656
- def Tosa_LogicalLeftShiftOp : Tosa_ElementwiseOp<"logical_left_shift",
657
- [SameOperandsAndResultElementType]> {
671
+ def Tosa_LogicalLeftShiftOp : Tosa_ElementwiseOp<"logical_left_shift", [
672
+ ResultsBroadcastableShape,
673
+ SameOperandsAndResultElementType,
674
+ SameOperandsAndResultRank]> {
658
675
let summary = "Elementwise Logical Left Shift";
659
676
660
677
let description = [{
@@ -675,8 +692,10 @@ def Tosa_LogicalLeftShiftOp : Tosa_ElementwiseOp<"logical_left_shift",
675
692
//===----------------------------------------------------------------------===//
676
693
// Operator: logical_right_shift
677
694
//===----------------------------------------------------------------------===//
678
- def Tosa_LogicalRightShiftOp : Tosa_ElementwiseOp<"logical_right_shift",
679
- [SameOperandsAndResultElementType]> {
695
+ def Tosa_LogicalRightShiftOp : Tosa_ElementwiseOp<"logical_right_shift", [
696
+ ResultsBroadcastableShape,
697
+ SameOperandsAndResultElementType,
698
+ SameOperandsAndResultRank]> {
680
699
let summary = "Elementwise Logical Right Shift";
681
700
682
701
let description = [{
@@ -699,7 +718,9 @@ def Tosa_LogicalRightShiftOp : Tosa_ElementwiseOp<"logical_right_shift",
699
718
//===----------------------------------------------------------------------===//
700
719
def Tosa_LogicalOrOp : Tosa_ElementwiseOp<"logical_or", [
701
720
Commutative,
702
- SameOperandsAndResultElementType]> {
721
+ ResultsBroadcastableShape,
722
+ SameOperandsAndResultElementType,
723
+ SameOperandsAndResultRank]> {
703
724
let summary = "Returns the truth value of x OR y element-wise.";
704
725
705
726
let description = [{
@@ -722,7 +743,9 @@ def Tosa_LogicalOrOp : Tosa_ElementwiseOp<"logical_or", [
722
743
//===----------------------------------------------------------------------===//
723
744
def Tosa_LogicalXorOp : Tosa_ElementwiseOp<"logical_xor", [
724
745
Commutative,
725
- SameOperandsAndResultElementType]> {
746
+ ResultsBroadcastableShape,
747
+ SameOperandsAndResultElementType,
748
+ SameOperandsAndResultRank]> {
726
749
let summary = "Returns the truth value of x XOR y element-wise.";
727
750
728
751
let description = [{
@@ -745,7 +768,9 @@ def Tosa_LogicalXorOp : Tosa_ElementwiseOp<"logical_xor", [
745
768
//===----------------------------------------------------------------------===//
746
769
def Tosa_MaximumOp : Tosa_ElementwiseOp<"maximum", [
747
770
Commutative,
748
- SameOperandsAndResultElementType]> {
771
+ ResultsBroadcastableShape,
772
+ SameOperandsAndResultElementType,
773
+ SameOperandsAndResultRank]> {
749
774
let summary = "Elementwise Maximum";
750
775
751
776
let description = [{
@@ -769,7 +794,9 @@ def Tosa_MaximumOp : Tosa_ElementwiseOp<"maximum", [
769
794
//===----------------------------------------------------------------------===//
770
795
def Tosa_MinimumOp : Tosa_ElementwiseOp<"minimum", [
771
796
Commutative,
772
- SameOperandsAndResultElementType]> {
797
+ ResultsBroadcastableShape,
798
+ SameOperandsAndResultElementType,
799
+ SameOperandsAndResultRank]> {
773
800
let summary = "Elementwise Minimum";
774
801
775
802
let description = [{
@@ -810,7 +837,7 @@ def Tosa_MulOp : Tosa_ElementwiseOp<"mul", [
810
837
let arguments = (ins
811
838
Tosa_Tensor:$input1,
812
839
Tosa_Tensor:$input2,
813
- I8Attr :$shift
840
+ Optional<TosaTensorRankOf<[Tosa_Int8], [1]>> :$shift
814
841
);
815
842
816
843
let results = (outs
@@ -824,7 +851,10 @@ def Tosa_MulOp : Tosa_ElementwiseOp<"mul", [
824
851
//===----------------------------------------------------------------------===//
825
852
// Operator: pow
826
853
//===----------------------------------------------------------------------===//
827
- def Tosa_PowOp : Tosa_ElementwiseOp<"pow", [SameOperandsAndResultElementType]> {
854
+ def Tosa_PowOp : Tosa_ElementwiseOp<"pow", [
855
+ ResultsBroadcastableShape,
856
+ SameOperandsAndResultElementType,
857
+ SameOperandsAndResultRank]> {
828
858
let summary = "Computes the power of one value to another.";
829
859
830
860
let description = [{
@@ -845,7 +875,10 @@ def Tosa_PowOp : Tosa_ElementwiseOp<"pow", [SameOperandsAndResultElementType]> {
845
875
//===----------------------------------------------------------------------===//
846
876
// Operator: sub
847
877
//===----------------------------------------------------------------------===//
848
- def Tosa_SubOp : Tosa_ElementwiseOp<"sub", [SameOperandsAndResultElementType]> {
878
+ def Tosa_SubOp : Tosa_ElementwiseOp<"sub", [
879
+ ResultsBroadcastableShape,
880
+ SameOperandsAndResultElementType,
881
+ SameOperandsAndResultRank]> {
849
882
let summary = "Elementwise subtraction operator";
850
883
851
884
let description = [{
@@ -1196,7 +1229,9 @@ def Tosa_SinOp : Tosa_ElementwiseUnaryOp<"sin"> {
1196
1229
//===----------------------------------------------------------------------===//
1197
1230
// Operator: select
1198
1231
//===----------------------------------------------------------------------===//
1199
- def Tosa_SelectOp : Tosa_ElementwiseOp<"select"> {
1232
+ def Tosa_SelectOp : Tosa_ElementwiseOp<"select", [
1233
+ ResultsBroadcastableShape,
1234
+ SameOperandsAndResultRank]> {
1200
1235
let summary = "Elementwise select operator";
1201
1236
1202
1237
let description = [{
@@ -1232,7 +1267,9 @@ def Tosa_SelectOp : Tosa_ElementwiseOp<"select"> {
1232
1267
def Tosa_EqualOp : Tosa_ElementwiseOp<"equal", [
1233
1268
InferTensorType,
1234
1269
Commutative,
1235
- SameOperandsElementType]> {
1270
+ ResultsBroadcastableShape,
1271
+ SameOperandsElementType,
1272
+ SameOperandsAndResultRank]> {
1236
1273
let summary = "Returns the truth value of (x == y) element-wise.";
1237
1274
1238
1275
let description = [{
@@ -1260,7 +1297,10 @@ def Tosa_EqualOp : Tosa_ElementwiseOp<"equal", [
1260
1297
//===----------------------------------------------------------------------===//
1261
1298
// Operator: greater
1262
1299
//===----------------------------------------------------------------------===//
1263
- def Tosa_GreaterOp : Tosa_ElementwiseOp<"greater", [SameOperandsElementType]> {
1300
+ def Tosa_GreaterOp : Tosa_ElementwiseOp<"greater", [
1301
+ ResultsBroadcastableShape,
1302
+ SameOperandsElementType,
1303
+ SameOperandsAndResultRank]> {
1264
1304
let summary = "Returns the truth value of (x > y) element-wise.";
1265
1305
1266
1306
let description = [{
@@ -1282,8 +1322,11 @@ def Tosa_GreaterOp : Tosa_ElementwiseOp<"greater", [SameOperandsElementType]> {
1282
1322
//===----------------------------------------------------------------------===//
1283
1323
// Operator: greater_equal
1284
1324
//===----------------------------------------------------------------------===//
1285
- def Tosa_GreaterEqualOp : Tosa_ElementwiseOp<"greater_equal",
1286
- [SameOperandsElementType]> {
1325
+ def Tosa_GreaterEqualOp : Tosa_ElementwiseOp<"greater_equal", [
1326
+ ResultsBroadcastableShape,
1327
+ SameOperandsElementType,
1328
+ SameOperandsAndResultRank
1329
+ ]> {
1287
1330
let summary = "Returns the truth value of (x >= y) element-wise.";
1288
1331
1289
1332
let description = [{
0 commit comments