[libc-commits] [PATCH] D147755: [libc][math] Update range reduction step for logf and reduce its latency.

Tue Ly via Phabricator via libc-commits libc-commits at lists.llvm.org
Fri Apr 7 09:17:31 PDT 2023


lntue added a comment.

In D147755#4251385 <https://reviews.llvm.org/D147755#4251385>, @zimmermann6 wrote:

> thanks all tests do pass now. For the reciprocal throughput I get:
>
>   zimmerma at biscotte:~/svn/core-math$ LIBM=/localdisk/zimmerma/llvm-project/build/projects/libc/lib/libllvmlibc.a ./perf.sh logf
>   GNU libc version: 2.36
>   GNU libc release: stable
>   [####################] 100 %
>   Ntrial = 20 ; Min = 10.839 + 0.378 clc/call; Median-Min = 0.304 clc/call; Max = 13.593 clc/call;
>   [####################] 100 %
>   Ntrial = 20 ; Min = 7.240 + 0.351 clc/call; Median-Min = 0.307 clc/call; Max = 9.576 clc/call;
>   [####################] 100 %
>   Ntrial = 20 ; Min = 18.822 + 0.339 clc/call; Median-Min = 0.314 clc/call; Max = 19.396 clc/call;
>
> and for the latency:
>
>   zimmerma at biscotte:~/svn/core-math$ PERF_ARGS=--latency LIBM=/localdisk/zimmerma/llvm-project/build/projects/libc/lib/libllvmlibc.a ./perf.sh logf
>   GNU libc version: 2.36
>   GNU libc release: stable
>   [####################] 100 %
>   Ntrial = 20 ; Min = 46.968 + 0.321 clc/call; Median-Min = 0.301 clc/call; Max = 47.649 clc/call;
>   [####################] 100 %
>   Ntrial = 20 ; Min = 38.243 + 0.328 clc/call; Median-Min = 0.318 clc/call; Max = 38.928 clc/call;
>   [####################] 100 %
>   Ntrial = 20 ; Min = 54.652 + 0.404 clc/call; Median-Min = 0.329 clc/call; Max = 55.396 clc/call;

Thanks for verifying this!  I'm a little surprised by the performance number that you got on EPYC.  I got the following results on Ryzen 5900X:
For reciprocal throughput:

  $ ./perf.sh logf
  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 = 9.396 + 0.158 clc/call; Median-Min = 0.140 clc/call; Max = 10.384 clc/call;
  -- System LIBC reciprocal throughput --
  [####################] 100 %
  Ntrial = 20 ; Min = 8.852 + 0.128 clc/call; Median-Min = 0.120 clc/call; Max = 9.382 clc/call;
  -- LIBC reciprocal throughput --
  [####################] 100 %
  Ntrial = 20 ; Min = 8.767 + 0.253 clc/call; Median-Min = 0.191 clc/call; Max = 9.264 clc/call;

And for latency:

  $ ./perf.sh logf --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 = 36.244 + 0.893 clc/call; Median-Min = 1.115 clc/call; Max = 38.248 clc/call;
  -- System LIBC reciprocal throughput --
  [####################] 100 %
  Ntrial = 20 ; Min = 29.517 + 0.647 clc/call; Median-Min = 0.851 clc/call; Max = 30.541 clc/call;
  -- LIBC reciprocal throughput --
  [####################] 100 %
  Ntrial = 20 ; Min = 33.060 + 0.774 clc/call; Median-Min = 0.972 clc/call; Max = 35.069 clc/call;

It's possible that LLVM libc was built without FMA on your machine.  But then it looks like a performance regression for non-FMA targets that I need to fix.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147755/new/

https://reviews.llvm.org/D147755



More information about the libc-commits mailing list