@@ -43,8 +43,8 @@ struct FunctionToTest {
43
43
TestRange2D extended;
44
44
std::function<Expr(Expr x, Expr y)> make_reference;
45
45
std::function<Expr(Expr x, Expr y, Halide::ApproximationPrecision)> make_approximation;
46
- int max_mulpe_precise{0 }; // max MULPE allowed when MAE query was <= 1e-6
47
- int max_mulpe_extended{0 }; // max MULPE allowed when MAE query was <= 1e-6
46
+ int max_mulpe_precise{0 }; // max MULPE allowed when MAE query was <= 1e-6
47
+ int max_mulpe_extended{0 }; // max MULPE allowed when MAE query was <= 1e-6
48
48
int test_bits{0xff };
49
49
} functions_to_test[] = {
50
50
// clang-format off
@@ -141,7 +141,6 @@ struct PrecisionToTest {
141
141
{{ApproximationPrecision::MULPE_MAE, 0 , 5e-7 }, " MULPE+MAE" },
142
142
};
143
143
144
-
145
144
int main (int argc, char **argv) {
146
145
Target target = get_jit_target_from_environment ();
147
146
setlocale (LC_NUMERIC, " " );
@@ -166,17 +165,17 @@ int main(int argc, char **argv) {
166
165
for (const std::pair<TestRange2D, std::string> &test_range_and_name : ranges) {
167
166
TestRange2D range = test_range_and_name.first ;
168
167
printf (" Testing fast_%s on its %s range ([%f, %f], [%f, %f])...\n " , ftt.name .c_str (), test_range_and_name.second .c_str (),
169
- range.x .l , range.x .u , range.y .l , range.y .u );
168
+ range.x .l , range.x .u , range.y .l , range.y .u );
170
169
// Reference:
171
170
Expr arg_x = range.x .l * (1 .0f - t0) + range.x .u * t0;
172
171
Expr arg_y = range.y .l * (1 .0f - t1) + range.y .u * t1;
173
172
Func ref_func{ftt.name + " _ref" };
174
173
ref_func (x, y) = ftt.make_reference (arg_x, arg_y);
175
- ref_func.realize (out_ref); // No schedule: scalar evaluation using libm calls on CPU.
174
+ ref_func.realize (out_ref); // No schedule: scalar evaluation using libm calls on CPU.
176
175
out_ref.copy_to_host ();
177
176
for (const PrecisionToTest &test : precisions_to_test) {
178
177
Halide::ApproximationPrecision prec = test.precision ;
179
- prec.allow_native_when_faster = false ; // We want to actually validate our approximation.
178
+ prec.allow_native_when_faster = false ; // We want to actually validate our approximation.
180
179
181
180
Func approx_func{ftt.name + " _approx" };
182
181
approx_func (x, y) = ftt.make_approximation (arg_x, arg_y, prec);
@@ -211,8 +210,8 @@ int main(int argc, char **argv) {
211
210
}
212
211
213
212
printf (" fast_%s Approx[%s-optimized, TargetMAE=%.0e] | MaxAbsError: %.4e | MaxULPError: %'14d | MaxMantissaError: %2d" ,
214
- ftt.name .c_str (), test.objective .c_str (), prec.constraint_max_absolute_error ,
215
- max_absolute_error, max_ulp_error, max_mantissa_error);
213
+ ftt.name .c_str (), test.objective .c_str (), prec.constraint_max_absolute_error ,
214
+ max_absolute_error, max_ulp_error, max_mantissa_error);
216
215
217
216
if (test_range_and_name.second == " precise" ) {
218
217
if ((ftt.test_bits & VALIDATE_MAE_ON_PRECISE)) {
@@ -261,4 +260,3 @@ int main(int argc, char **argv) {
261
260
printf (" Passed %d / %d accuracy tests.\n " , num_tests_passed, num_tests);
262
261
printf (" Success!\n " );
263
262
}
264
-
0 commit comments