[libc-commits] [PATCH] D147676: [libc][math] Update range reduction step for log10f and reduce its latency.
Tue Ly via Phabricator via libc-commits
libc-commits at lists.llvm.org
Thu Apr 6 07:47:23 PDT 2023
lntue added a comment.
In D147676#4248087 <https://reviews.llvm.org/D147676#4248087>, @zimmermann6 wrote:
> I get a failure for rounding down:
>
> zimmerma at biscotte:~/svn/core-math$ CORE_MATH_CHECK_STD=true LIBM=/localdisk/zimmerma/llvm-project/build/projects/libc/lib/libllvmlibc.a ./check.sh log10f
> Running exhaustive check in --rndn mode...
> all ok
> Running exhaustive check in --rndz mode...
> all ok
> Running exhaustive check in --rndu mode...
> all ok
> Running exhaustive check in --rndd mode...
> FAIL x=0x1p+0 ref=0x0p+0 y=-0x0p+0
>
> Also, on an AMD EPYC 7282 I get a regression in speed. With master:
>
> zimmerma at biscotte:~/svn/core-math$ LIBM=/localdisk/zimmerma/llvm-project/build/projects/libc/lib/libllvmlibc.a ./perf.sh log10f
> GNU libc version: 2.36
> GNU libc release: stable
> [####################] 100 %
> Ntrial = 20 ; Min = 10.531 + 0.273 clc/call; Median-Min = 0.281 clc/call; Max = 13.047 clc/call;
> [####################] 100 %
> Ntrial = 20 ; Min = 18.529 + 0.342 clc/call; Median-Min = 0.309 clc/call; Max = 19.811 clc/call;
> [####################] 100 %
> Ntrial = 20 ; Min = 13.059 + 0.526 clc/call; Median-Min = 0.290 clc/call; Max = 15.586 clc/call;
>
> With this patch:
>
> zimmerma at biscotte:~/svn/core-math$ LIBM=/localdisk/zimmerma/llvm-project/build/projects/libc/lib/libllvmlibc.a ./perf.sh log10f
> GNU libc version: 2.36
> GNU libc release: stable
> [####################] 100 %
> Ntrial = 20 ; Min = 10.534 + 0.297 clc/call; Median-Min = 0.303 clc/call; Max = 11.415 clc/call;
> [####################] 100 %
> Ntrial = 20 ; Min = 18.529 + 0.561 clc/call; Median-Min = 0.327 clc/call; Max = 20.729 clc/call;
> [####################] 100 %
> Ntrial = 20 ; Min = 19.791 + 0.313 clc/call; Median-Min = 0.338 clc/call; Max = 22.809 clc/call;
I've fixed the issue with signed zero, and here are the current performance numbers I got on Ryzen 5900X:
$ ./perf.sh log10f --path2
LIBC-location: /home/lnt/experiment/llvm/llvm-project/build/projects/libc/lib/libllvmlibc.a
GNU libc version: 2.35
GNU libc release: stable
-- CORE-MATH reciprocal throughput --
[####################] 100 %
Ntrial = 20 ; Min = 10.004 + 0.159 clc/call; Median-Min = 0.198 clc/call; Max = 10.279 clc/call;
-- System LIBC reciprocal throughput --
[####################] 100 %
Ntrial = 20 ; Min = 16.652 + 0.222 clc/call; Median-Min = 0.264 clc/call; Max = 16.999 clc/call;
-- LIBC reciprocal throughput --
[####################] 100 %
Ntrial = 20 ; Min = 8.586 + 0.194 clc/call; Median-Min = 0.204 clc/call; Max = 8.921 clc/call;
And for latency:
$ ./perf.sh log10f --path2 --latency
LIBC-location: /home/lnt/experiment/llvm/llvm-project/build/projects/libc/lib/libllvmlibc.a
GNU libc version: 2.35
GNU libc release: stable
-- CORE-MATH reciprocal throughput --
[####################] 100 %
Ntrial = 20 ; Min = 35.298 + 0.314 clc/call; Median-Min = 0.312 clc/call; Max = 35.782 clc/call;
-- System LIBC reciprocal throughput --
[####################] 100 %
Ntrial = 20 ; Min = 48.766 + 0.755 clc/call; Median-Min = 0.917 clc/call; Max = 49.771 clc/call;
-- LIBC reciprocal throughput --
[####################] 100 %
Ntrial = 20 ; Min = 34.878 + 0.203 clc/call; Median-Min = 0.246 clc/call; Max = 35.256 clc/call;
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D147676/new/
https://reviews.llvm.org/D147676
More information about the libc-commits
mailing list