[all-commits] [llvm/llvm-project] a5466f: [libc] Improve the performance of expm1f.

lntue via All-commits all-commits at lists.llvm.org
Wed Mar 30 16:23:48 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a5466f0436d2c287a20882cd1beae3e6cf56fea4
      https://github.com/llvm/llvm-project/commit/a5466f0436d2c287a20882cd1beae3e6cf56fea4
  Author: Tue Ly <lntue.h at gmail.com>
  Date:   2022-03-30 (Wed, 30 Mar 2022)

  Changed paths:
    M libc/src/math/generic/expm1f.cpp
    M libc/test/src/math/exhaustive/exhaustive_test.cpp
    M libc/test/src/math/exhaustive/expm1f_test.cpp
    M libc/test/src/math/expm1f_test.cpp

  Log Message:
  -----------
  [libc] Improve the performance of expm1f.

Improve the performance of expm1f:
- Rearrange the selection logic for different cases to improve the overall
throughput.
- Use the same degree-4 polynomial for large inputs as `expf`
(https://reviews.llvm.org/D122418), reduced from a degree-7 polynomial.

Performance benchmark using perf tool from CORE-MATH project
(https://gitlab.inria.fr/core-math/core-math/-/tree/master):
Before this patch:
```
$ ./perf.sh expm1f

CORE-MATH reciprocal throughput   : 15.362
System LIBC reciprocal throughput : 53.288
LIBC reciprocal throughput        : 54.572

$ ./perf.sh expm1f --latency

CORE-MATH latency   : 57.759
System LIBC latency : 147.146
LIBC latency        : 118.057
```

After this patch:
```
$ ./perf.sh expm1f

CORE-MATH reciprocal throughput   : 15.359
System LIBC reciprocal throughput : 53.188
LIBC reciprocal throughput        : 14.600

$ ./perf.sh expm1f --latency

CORE-MATH latency   : 57.774
System LIBC latency : 147.119
LIBC latency        : 60.280

```

Reviewed By: michaelrj, santoshn, zimmermann6

Differential Revision: https://reviews.llvm.org/D122538




More information about the All-commits mailing list