@@ -55,86 +55,72 @@ func.func @test_mul_scalar_wrong_type(%arg0: !ty) -> !ty {
55
55
// -----
56
56
57
57
#my_poly = #polynomial.int_polynomial <-1 + x **1024 >
58
- #ring = #polynomial.ring <coefficientType =i16 , coefficientModulus =256 :i16 , polynomialModulus =#my_poly , primitiveRoot = 31 : i16 >
58
+ #ring = #polynomial.ring <coefficientType =i16 , coefficientModulus =256 :i16 , polynomialModulus =#my_poly >
59
59
!poly_ty = !polynomial.polynomial <ring =#ring >
60
60
61
61
// CHECK-NOT: @test_invalid_ntt
62
62
// CHECK-NOT: polynomial.ntt
63
63
func.func @test_invalid_ntt (%0 : !poly_ty ) {
64
64
// expected-error@below {{expects a ring encoding to be provided to the tensor}}
65
- %1 = polynomial.ntt %0 : !poly_ty -> tensor <1024 xi32 >
65
+ %1 = polynomial.ntt %0 { root = #polynomial.primitive_root < value = 31 : i32 , degree = 8 : index >} : !poly_ty -> tensor <1024 xi32 >
66
66
return
67
67
}
68
68
69
69
// -----
70
70
71
71
#my_poly = #polynomial.int_polynomial <-1 + x **1024 >
72
- #ring = #polynomial.ring <coefficientType =i16 , coefficientModulus =256 :i16 , polynomialModulus =#my_poly , primitiveRoot = 31 : i16 >
72
+ #ring = #polynomial.ring <coefficientType =i16 , coefficientModulus =256 :i16 , polynomialModulus =#my_poly >
73
73
!poly_ty = !polynomial.polynomial <ring =#ring >
74
74
75
75
// CHECK-NOT: @test_invalid_ntt
76
76
// CHECK-NOT: polynomial.ntt
77
77
func.func @test_invalid_ntt (%0 : !poly_ty ) {
78
78
// expected-error@below {{tensor encoding is not a ring attribute}}
79
- %1 = polynomial.ntt %0 : !poly_ty -> tensor <1024 xi32 , #my_poly >
79
+ %1 = polynomial.ntt %0 { root = #polynomial.primitive_root < value = 31 : i32 , degree = 8 : index >} : !poly_ty -> tensor <1024 xi32 , #my_poly >
80
80
return
81
81
}
82
82
83
83
// -----
84
84
85
85
#my_poly = #polynomial.int_polynomial <-1 + x **1024 >
86
86
#ring = #polynomial.ring <coefficientType =i16 , coefficientModulus =256 :i16 , polynomialModulus =#my_poly >
87
- #ring1 = #polynomial.ring <coefficientType =i16 , coefficientModulus =257 :i16 , polynomialModulus =#my_poly , primitiveRoot = 31 : i16 >
87
+ #ring1 = #polynomial.ring <coefficientType =i16 , coefficientModulus =257 :i16 , polynomialModulus =#my_poly >
88
88
!poly_ty = !polynomial.polynomial <ring =#ring >
89
89
90
90
// CHECK-NOT: @test_invalid_intt
91
91
// CHECK-NOT: polynomial.intt
92
92
func.func @test_invalid_intt (%0 : tensor <1024 xi32 , #ring1 >) {
93
93
// expected-error@below {{not equivalent to the polynomial ring}}
94
- %1 = polynomial.intt %0 : tensor <1024 xi32 , #ring1 > -> !poly_ty
94
+ %1 = polynomial.intt %0 { root = #polynomial.primitive_root < value = 31 : i32 , degree = 8 : index >} : tensor <1024 xi32 , #ring1 > -> !poly_ty
95
95
return
96
96
}
97
97
98
98
// -----
99
99
100
100
#my_poly = #polynomial.int_polynomial <-1 + x **1024 >
101
- #ring = #polynomial.ring <coefficientType =i16 , coefficientModulus =256 :i16 , polynomialModulus =#my_poly , primitiveRoot = 31 : i16 >
101
+ #ring = #polynomial.ring <coefficientType =i16 , coefficientModulus =256 :i16 , polynomialModulus =#my_poly >
102
102
!poly_ty = !polynomial.polynomial <ring =#ring >
103
103
104
104
// CHECK-NOT: @test_invalid_intt
105
105
// CHECK-NOT: polynomial.intt
106
106
func.func @test_invalid_intt (%0 : tensor <1025 xi32 , #ring >) {
107
107
// expected-error@below {{does not match output type}}
108
108
// expected-note@below {{exactly the degree of the polynomialModulus of the polynomial type's ring attribute}}
109
- %1 = polynomial.intt %0 : tensor <1025 xi32 , #ring > -> !poly_ty
110
- return
111
- }
112
-
113
- // -----
114
-
115
- #my_poly = #polynomial.int_polynomial <-1 + x **1024 >
116
- #ring = #polynomial.ring <coefficientType =i16 , coefficientModulus =256 :i16 , polynomialModulus =#my_poly >
117
- !poly_ty = !polynomial.polynomial <ring =#ring >
118
-
119
- // CHECK-NOT: @test_invalid_ntt
120
- // CHECK-NOT: polynomial.ntt
121
- func.func @test_invalid_ntt (%0 : !poly_ty ) {
122
- // expected-error@below {{does not provide a primitive root of unity, which is required to express an NTT}}
123
- %1 = polynomial.ntt %0 : !poly_ty -> tensor <1024 xi32 , #ring >
109
+ %1 = polynomial.intt %0 {root =#polynomial.primitive_root <value =31 :i32 , degree =8 :index >} : tensor <1025 xi32 , #ring > -> !poly_ty
124
110
return
125
111
}
126
112
127
113
// -----
128
114
129
115
#my_poly = #polynomial.int_polynomial <-1 + x **8 >
130
116
// A valid root is 31
131
- #ring = #polynomial.ring <coefficientType =i16 , coefficientModulus =256 :i16 , polynomialModulus =#my_poly , primitiveRoot = 32 : i16 >
117
+ #ring = #polynomial.ring <coefficientType =i16 , coefficientModulus =256 :i16 , polynomialModulus =#my_poly >
132
118
!poly_ty = !polynomial.polynomial <ring =#ring >
133
119
134
120
// CHECK-NOT: @test_invalid_intt
135
121
// CHECK-NOT: polynomial.intt
136
122
func.func @test_invalid_intt (%0 : tensor <8 xi32 , #ring >) {
137
- // expected-error@below {{has a primitiveRoot attribute ' 32 : i16' that is not a primitive root of the coefficient ring }}
138
- %1 = polynomial.intt %0 : tensor <8 xi32 , #ring > -> !poly_ty
123
+ // expected-error@below {{provided root 32 is not a primitive root of unity mod 256, with the specified degree 8 }}
124
+ %1 = polynomial.intt %0 { root = #polynomial.primitive_root < value = 32 : i16 , degree = 8 : index >} : tensor <8 xi32 , #ring > -> !poly_ty
139
125
return
140
126
}
0 commit comments