[cfe-dev] [test-suite] making polybench/symm succeed with "-Ofast" and "-ffp-contract=on"

Sebastian Pop via cfe-dev cfe-dev at lists.llvm.org
Fri Oct 14 06:59:55 PDT 2016


On Wed, Oct 12, 2016 at 11:29 AM, Sebastian Pop <sebpop.llvm at gmail.com> wrote:
> The following 2 tests still require increased FP_ABSTOLERANCE to pass
> compare between "-O3", "-O3 -ffp-contract=on" vs. "-O0 -ffp-contract=off"
>
> polybench/medley/reg_detect, FP_ABSTOLERANCE=1e4
> polybench/stencils/adi, FP_ABSTOLERANCE=1e4
>
> The reference output of these two is also not matching when compiled at
> "-O3" or "-O3 -ffp-contract=on".  When configuring the test-suite without
> specifying CFLAGS, Polybench is compiled at no optimization level.

For these two, I had an error in my patch when initializing the data
for the array_StrictFP.
With the following fix, they both pass with FP_ABSTOLERANCE=1e-5.

diff --git a/SingleSource/Benchmarks/Polybench/stencils/adi/adi.c
b/SingleSource/Benchmarks/Polybench/stencils/adi/adi.c
index d491535..eb00da9 100644
--- a/SingleSource/Benchmarks/Polybench/stencils/adi/adi.c
+++ b/SingleSource/Benchmarks/Polybench/stencils/adi/adi.c
@@ -195,7 +195,7 @@ int main(int argc, char** argv)
   polybench_stop_instruments;
   polybench_print_instruments;

-  init_array (n, POLYBENCH_ARRAY(X), POLYBENCH_ARRAY(A), POLYBENCH_ARRAY(B));
+  init_array (n, POLYBENCH_ARRAY(X_StrictFP), POLYBENCH_ARRAY(A),
POLYBENCH_ARRAY(B));
   kernel_adi (tsteps, n, POLYBENCH_ARRAY(X_StrictFP),
              POLYBENCH_ARRAY(A), POLYBENCH_ARRAY(B));
   if (!check_FP(n, POLYBENCH_ARRAY(X), POLYBENCH_ARRAY(X_StrictFP)))
diff --git a/SingleSource/Benchmarks/Polybench/medley/reg_detect/reg_detect.c
b/SingleSource/Benchmarks/Polybench/medley/reg_detect/reg_detect.c
index 6f6fbaf..ce7d2c5 100644
--- a/SingleSource/Benchmarks/Polybench/medley/reg_detect/reg_detect.c
+++ b/SingleSource/Benchmarks/Polybench/medley/reg_detect/reg_detect.c
@@ -202,7 +202,7 @@ int main(int argc, char** argv)
   init_array (maxgrid,
              POLYBENCH_ARRAY(sum_tang),
              POLYBENCH_ARRAY(mean),
-             POLYBENCH_ARRAY(path));
+             POLYBENCH_ARRAY(path_StrictFP));
   kernel_reg_detect_StrictFP(niter, maxgrid, length,
                              POLYBENCH_ARRAY(sum_tang),
                              POLYBENCH_ARRAY(mean),



More information about the cfe-dev mailing list