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

Paul Zimmermann via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu Apr 6 02:16:06 PDT 2023


zimmermann6 requested changes to this revision.
zimmermann6 added a comment.
This revision now requires changes to proceed.

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;


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