Skip to content

Commit faa6696

Browse files
committed
adapt tests now handling negative scales
1 parent d1993ab commit faa6696

File tree

4 files changed

+36
-10
lines changed

4 files changed

+36
-10
lines changed

mlir/test/Dialect/Quant/parse-quantile-invalid.mlir

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,6 @@ func.func @parse() -> !qalias {
142142
// expected-error@+1 {{expected non-function type}}
143143
!qalias = !quant.quantile<i8<-4:3>:f16:f33, {-1.0,1.0}:0.99872:127>
144144

145-
// -----
146-
// Illegal scale: negative
147-
// expected-error@+1 {{illegal scale: -1.000000}}
148-
!qalias = !quant.quantile<i8<-4:3>:f16:f32, {-1.0,1.0}:-1.0:127>
149-
150145
// -----
151146
// Illegal uniform params: missing quantized dimension
152147
// expected-error@+1 {{expected integer value}}

mlir/test/Dialect/Quant/parse-quantile.mlir

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,3 +163,21 @@ func.func @parse() -> !qalias {
163163
%0 = "foo"() : () -> !qalias
164164
return %0 : !qalias
165165
}
166+
167+
// -----
168+
// Negative scale checking
169+
// CHECK: !quant.quantile<i4:f16:f32, {-1.000000e+00,-8.667000e-01,-7.333000e-01,-6.000000e-01,-4.667000e-01,-3.333000e-01,-2.000000e-01,-0.066699999999999995,0.066699999999999995,2.000000e-01,3.333000e-01,4.667000e-01,6.000000e-01,7.333000e-01,8.667000e-01,1.000000e+00}:{-2.000000e+02,-9.987200e-01:120}>
170+
!qalias = !quant.quantile<i4:f16:f32, {-1.0000,-0.8667,-0.7333,-0.6000,-0.4667,-0.3333,-0.2000,-0.0667,0.0667,0.2000,0.3333,0.4667,0.6000,0.7333,0.8667,1.0000}:{-2.0e+2,-0.99872:120}>
171+
func.func @parse() -> !qalias {
172+
%0 = "foo"() : () -> !qalias
173+
return %0 : !qalias
174+
}
175+
176+
// -----
177+
// Per-axis negative scale checking
178+
// CHECK: !quant.quantile<i4:f16:f32:1, {-1.000000e+00,-8.667000e-01,-7.333000e-01,-6.000000e-01,-4.667000e-01,-3.333000e-01,-2.000000e-01,-0.066699999999999995,0.066699999999999995,2.000000e-01,3.333000e-01,4.667000e-01,6.000000e-01,7.333000e-01,8.667000e-01,1.000000e+00}:{-2.000000e+02,-9.987200e-01:120}>
179+
!qalias = !quant.quantile<i4:f16:f32:1, {-1.0000,-0.8667,-0.7333,-0.6000,-0.4667,-0.3333,-0.2000,-0.0667,0.0667,0.2000,0.3333,0.4667,0.6000,0.7333,0.8667,1.0000}:{-2.0e+2,-0.99872:120}>
180+
func.func @parse() -> !qalias {
181+
%0 = "foo"() : () -> !qalias
182+
return %0 : !qalias
183+
}

mlir/test/Dialect/Quant/parse-uniform-invalid.mlir

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,6 @@
125125
// expected-error@+1 {{expected non-function type}}
126126
!qalias = !quant.uniform<i8<-4:3>:f33, 0.99872:127>
127127

128-
// -----
129-
// Illegal scale: negative
130-
// expected-error@+1 {{illegal scale: -1.000000}}
131-
!qalias = !quant.uniform<i8<-4:3>:f32, -1.0:127>
132-
133128
// -----
134129
// Illegal uniform params: missing quantized dimension
135130
// expected-error@+1 {{expected integer value}}

mlir/test/Dialect/Quant/parse-uniform.mlir

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,3 +199,21 @@ func.func @parse() -> !qalias {
199199
%0 = "foo"() : () -> !qalias
200200
return %0 : !qalias
201201
}
202+
203+
// -----
204+
// Negative scale checking
205+
// CHECK: !quant.uniform<i8:f32, {-2.000000e+02,-9.987200e-01:120}>
206+
!qalias = !quant.uniform<i8:f32, {-2.0e+2,-0.99872:120}>
207+
func.func @parse() -> !qalias {
208+
%0 = "foo"() : () -> !qalias
209+
return %0 : !qalias
210+
}
211+
212+
// -----
213+
// Per axis negative scale checking
214+
// CHECK: !quant.uniform<i8:f32:1, {-2.000000e+02,-9.987200e-01:120}>
215+
!qalias = !quant.uniform<i8:f32:1, {-2.0e+2,-0.99872:120}>
216+
func.func @parse() -> !qalias {
217+
%0 = "foo"() : () -> !qalias
218+
return %0 : !qalias
219+
}

0 commit comments

Comments
 (0)