Bug#1031500: numerical differences in x87 fpu code generated by clang-14 and clang-15

Sylvestre Ledru sylvestre at debian.org
Fri Feb 17 10:55:14 GMT 2023


Hello

Could you please forward this upstream?

Thanks
Sylvestre

Le 17/02/2023 à 10:55, Andreas Beckmann a écrit :
> Package: clang-15
> Version: 1:15.0.6-4
> Severity: important
> Control: block 1031414 with -1
> 
> While analyzing some autopkgtest regressions when pocl gets built with
> llvm-15 instead of llvm-14 (#1030298, #1031414), I finally managed to
> extract some parts of the kernel code generated by pocl (parts of the
> pocl OpenCL fmod(float, float) implementation, pocl_cl_fmod.ll) and
> added a small C wrapper to call the function (main.c, Makefile).
> The resulting program produces numeric results that differ in more than
> just the last digit depending on whether it was built with clang-14
> or clang-15.
> 
> $ ./test_pocl_cl_fmod_llvm14
> a=0 b=0.1 c=0 d=0 abserr=0 relerr=0
> a=0.1 b=0.1221239 c=0.1 d=0.1 abserr=0 relerr=0
> a=0.2 b=0.14424779 c=0.055752218 d=0.055752218 abserr=0 relerr=0
> a=0.3 b=0.16637169 c=0.13362832 d=0.13362832 abserr=0 relerr=0
> a=0.4 b=0.18849558 c=0.023008853 d=0.023008853 abserr=0 relerr=0
> a=0.5 b=0.21061946 c=0.078761071 d=0.078761071 abserr=0 relerr=0
> a=0.6 b=0.23274337 c=0.13451329 d=0.13451329 abserr=0 relerr=0
> a=0.7 b=0.25486726 c=0.19026548 d=0.19026548 abserr=0 relerr=0
> a=0.8 b=0.27699116 c=0.24601769 d=0.24601769 abserr=0 relerr=0
> a=0.9 b=0.29911503 c=0.0026548803 d=0.0026548803 abserr=0 relerr=0
> 
> $ ./test_pocl_cl_fmod_llvm15
> a=0 b=0.1 c=0 d=0 abserr=0 relerr=0
> a=0.1 b=0.1221239 c=0.1 d=0.1 abserr=0 relerr=0
> a=0.2 b=0.14424779 c=0.055752218 d=0.055752218 abserr=0 relerr=0
> a=0.3 b=0.16637169 c=0.13362832 d=0.13362832 abserr=0 relerr=0
> a=0.4 b=0.18849558 c=0.023008853 d=0.023008853 abserr=0 relerr=0
> a=0.5 b=0.21061946 c=0.078761071 d=0.078761071 abserr=0 relerr=0
> a=0.6 b=0.23274337 c=0.13451327 d=0.13451329 abserr=1.49012e-08 relerr=6.4024e-08
> a=0.7 b=0.25486726 c=0.19026548 d=0.19026548 abserr=0 relerr=0
> a=0.8 b=0.27699116 c=0.24601772 d=0.24601769 abserr=-2.98023e-08 relerr=-1.07593e-07 FAIL
> a=0.9 b=0.29911503 c=0.0026548505 d=0.0026548803 abserr=2.98023e-08 relerr=9.9635e-08
> 
> c = _Z8_cl_fmodff(a, b)  # from pocl
> d = fmodf(a, b)          # from libc, as reference
> 
> This happens on i386 with -march=i686, i.e. it generates x87 fpu code,
> not sse fpu code. The attached Makefile also works for creating 32-bit
> binaries on amd64 showing the behavior.
> 
> Andreas



More information about the Pkg-llvm-team mailing list