Commit Graph

169 Commits

Author SHA1 Message Date
Adhemerval Zanella
48767cbb76 benchtests: Add log10p1f benchmark
It is based on log2f data.

Reviewed-by: DJ Delorie <dj@redhat.com>
2024-11-01 11:17:20 -03:00
Adhemerval Zanella
ef2485c5fe benchtests: Add log1p benchmark
Random inputs x*2^e where x is random in [1/2,1] and e in [-29,127].

Reviewed-by: DJ Delorie <dj@redhat.com>
2024-11-01 11:17:19 -03:00
Adhemerval Zanella
acc2137382 benchtests: Add log2p1f benchmark
It is based on log2f data.

Reviewed-by: DJ Delorie <dj@redhat.com>
2024-11-01 11:17:18 -03:00
Adhemerval Zanella
1e262f80dd benchtests: Add log10f benchmark
The inputs are random numbers in the form x*2^e where x is random
in [0x1p-1,0x1p+0] and e in [-126,127].

Reviewed-by: DJ Delorie <dj@redhat.com>
2024-11-01 11:17:16 -03:00
Adhemerval Zanella
2dbf7c4bf1 benchtests: Add expm1f benchmark
The inputs are modeled based on expm1-inputs, with the range
adapted to binary32 range.

Reviewed-by: DJ Delorie <dj@redhat.com>
2024-11-01 11:17:15 -03:00
Adhemerval Zanella
19ab8bbd71 benchtests: Add exp2m1f benchmark
The input is based on exp2f benchmark.

Reviewed-by: DJ Delorie <dj@redhat.com>
2024-11-01 11:17:13 -03:00
Adhemerval Zanella
ad53c12798 benchtests: Add exp10m1f benchmark
The input is based on exp10f benchmark.

Reviewed-by: DJ Delorie <dj@redhat.com>
2024-11-01 11:17:09 -03:00
Paul Zimmermann
392b3f0971 replace tgammaf by the CORE-MATH implementation
The CORE-MATH implementation is correctly rounded (for any rounding mode).
This can be checked by exhaustive tests in a few minutes since there are
less than 2^32 values to check against for example GNU MPFR.
This patch also adds some bench values for tgammaf.

Tested on x86_64 and x86 (cfarm26).

With the initial GNU libc code it gave on an Intel(R) Core(TM) i7-8700:

      "tgammaf": {
       "": {
        "duration": 3.50188e+09,
        "iterations": 2e+07,
        "max": 602.891,
        "min": 65.1415,
        "mean": 175.094
       }
      }

With the new code:

      "tgammaf": {
       "": {
        "duration": 3.30825e+09,
        "iterations": 5e+07,
        "max": 211.592,
        "min": 32.0325,
        "mean": 66.1649
       }
      }

With the initial GNU libc code it gave on cfarm26 (i686):

  "tgammaf": {
   "": {
    "duration": 3.70505e+09,
    "iterations": 6e+06,
    "max": 2420.23,
    "min": 243.154,
    "mean": 617.509
   }
  }

With the new code:

  "tgammaf": {
   "": {
    "duration": 3.24497e+09,
    "iterations": 1.8e+07,
    "max": 1238.15,
    "min": 101.155,
    "mean": 180.276
   }
  }

Signed-off-by: Alexei Sibidanov <sibid@uvic.ca>
Signed-off-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>

Changes in v2:
    - include <math.h> (fix the linknamespace failures)
    - restored original benchtests/strcoll-inputs/filelist#en_US.UTF-8 file
    - restored original wrapper code (math/w_tgammaf_compat.c),
      except for the dealing with the sign
    - removed the tgammaf/float entries in all libm-test-ulps files
    - address other comments from Joseph Myers
      (https://sourceware.org/pipermail/libc-alpha/2024-July/158736.html)

Changes in v3:
    - pass NULL argument for signgam from w_tgammaf_compat.c
    - use of math_narrow_eval
    - added more comments

Changes in v4:
    - initialize local_signgam to 0 in math/w_tgamma_template.c
    - replace sysdeps/ieee754/dbl-64/gamma_productf.c by dummy file

Changes in v5:
    - do not mention local_signgam any more in math/w_tgammaf_compat.c
    - initialize local_signgam to 1 instead of 0 in w_tgamma_template.c
      and added comment

Changes in v6:
    - pass NULL as 2nd argument of __ieee754_gammaf_r in
      w_tgammaf_compat.c, and check for NULL in e_gammaf_r.c

Changes in v7:
    - added Signed-off-by line for Alexei Sibidanov (author of the code)

Changes in v8:
    - added Signed-off-by line for Paul Zimmermann (submitted of the patch)

Changes in v9:
    - address comments from review by Adhemerval Zanella
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2024-10-11 11:12:32 +02:00
Wilco Dijkstra
79e472f0f8 benchtests: Add random memset benchmark
Add a new randomized memset test similar to bench-random-memcpy.  Instead of
repeating the same call to memset over and over again, it times a large number
of different inputs.  The distribution of memset length and alignment is based
on SPEC2017 (length up to 4096 and alignment up to 64).

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2024-08-07 14:58:46 +01:00
Wilco Dijkstra
5aa2f79691 Benchtests: Remove broken walk benchmarks
The walk benchmarks don't measure anything useful - memory is not initialized
properly so doing a single walk in 32MB just measures reading the 4KB zero
page for reads and clear_page overhead for writes.  The memset variants don't
even manage to do a walk in the 32MB region due to using incorrect pointer
increments...  Neither is it clear why it is walking backwards since this
won't confuse modern prefetchers.  If you fix the benchmark and print the
bandwidth, the results are identical for all sizes larger than ~1KB since it
is just testing memory bandwidth of a single 32MB block.  This case is already
tested by the large benchmark, so overall it doesn't seem useful to keep these.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2024-06-21 14:41:42 +01:00
H.J. Lu
fa9aecc045 benchtests: Add fclose benchmark
Measure duration of 100 fclose calls after opening 1 million FILEs.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2024-05-16 08:12:59 -07:00
Wilco Dijkstra
0997c3d0c8 benchtests: Add random() benchmark
Add a simple benchmark to measure the overhead of internal libc locks in
the random() implementation on both single- and multi-threaded cases.
This relies on the implementation of random using internal locks to
access shared global data, and that the runtime uses multi-threaded
locking once a thread has been created (even after it finishes).

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2024-04-18 14:30:21 +01:00
Junxian Zhu
0a4d6c8254 benchtests: Add more benchtests for rounding functions.
This patch adds more benchtests for rounding functions.
The double inputs are copied from trunc-inputs, the float inputs are copied from truncf-inputs. and the rintf is copied from rint-inputs.
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2024-02-23 08:50:00 -03:00
Paul Eggert
dff8da6b3e Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
Carlos O'Donell
85c3569cf4 benchtests: Reformat Makefile.
Reflow all long lines adding comment terminators.
Sort all reflowed text using scripts/sort-makefile-lines.py.

No regressions running microbenchmarks.
No code generation changes observed in binary artifacts.
No regressions on x86_64 and i686.
2023-05-18 13:11:48 -04:00
Adhemerval Zanella Netto
5c11701c51 benchtests: Add fmodf benchmark
1. Subnormals: 128 inputs.
2. Normal numbers with large exponent difference (|x/y| > 2^8):
   1024 inputs between FLT_MIN and FLT_MAX;
3. Close exponents (ey >= -103 and |x/y| < 2^8): 1024 inputs with
   exponents between -10 and 10.
Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2023-04-03 16:13:55 -03:00
Adhemerval Zanella Netto
3ba0c9593f benchtests: Add fmod benchmark
Add three different dataset, from random floating point numbers:

1. Subnormals: 128 inputs.
2. Normal numbers with large exponent difference (|x/y| > 2^52):
   1024 inputs between DBL_MIN and DBL_MAX;
3. Close exponents (ey >= -907 and |x/y| < 2^52): 1024 inputs with
   exponents between -10 and 10.
Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2023-04-03 16:13:55 -03:00
Joseph Myers
6d7e8eda9b Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
Adhemerval Zanella
5c5a8b99cf Disable use of -fsignaling-nans if compiler does not support it
Reviewed-by: Fangrui Song <maskray@google.com>
2022-11-01 09:46:08 -03:00
Noah Goldstein
10c779f44a Benchtests: Add bench for pthread_spin_{try}lock and mutex_trylock
Reuses infrastructure from previous pthread_mutex_lock benchmarks to
test other performance sensitive functions.
2022-10-03 14:13:49 -07:00
Adhemerval Zanella Netto
5d765ada01 benchtests: Add arc4random benchtest
It shows both throughput (total bytes obtained in the test duration)
and latecy for both arc4random and arc4random_buf with different
sizes.

Checked on x86_64-linux-gnu, aarch64-linux, and powerpc64le-linux-gnu.
2022-07-22 11:58:27 -03:00
Noah Goldstein
319dddc143 benchtests: Add benchtests for dl_elf_hash, dl_new_hash and nss_hash
Benchtests are for throughput and include random / fixed size
benchmarks.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2022-05-23 10:38:40 -05:00
Siddhesh Poyarekar
050cc5f7c1 benchtests: Add wcrtomb microbenchmark
Add a simple benchmark that measures wcrtomb performance with various
locales with 1-4 byte characters.

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2022-05-06 18:16:43 +05:30
Siddhesh Poyarekar
5b5b1012d5 benchtests: Better libmvec integration
Improve libmvec benchmark integration so that in future other
architectures may be able to run their libmvec benchmarks as well.  This
now allows libmvec benchmarks to be run with `make BENCHSET=bench-math`.

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2022-04-29 11:48:18 +05:30
Siddhesh Poyarekar
944afe6d95 benchtests: Add UNSUPPORTED benchmark status
The libmvec benchmarks print a message indicating that a certain CPU
feature is unsupported and exit prematurelyi, which breaks the JSON in
bench.out.

Handle this more elegantly in the bench makefile target by adding
support for an UNSUPPORTED exit status (77) so that bench.out continues
to have output for valid tests.

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2022-04-29 11:48:16 +05:30
Wangyang Guo
9e5daa1f6a benchtests: Add pthread-mutex-locks bench
Benchmark for testing pthread mutex locks performance with different
threads and critical sections.

The test configuration consists of 3 parts:
1. thread number
2. critical-section length
3. non-critical-section length

Thread number starts from 1 and increased by 2x until num of CPU cores
(nprocs). An additional over-saturation case (1.25 * nprocs) is also
included.
Critical-section is represented by a loop of shared do_filler(),
length can be determined by the loop iters.
Non-critical-section is similiar to the critical-section, except it's
based on non-shared do_filler().

Currently, adaptive pthread_mutex lock is tested.
2022-04-27 13:41:57 -07:00
H.J. Lu
564f7ae7b4 benchtests: Use "=" instead of ":=" [BZ #28970]
Use "=" instead of ":=" to allow sysdeps Makefiles to add more benches
to bench and benchset.  This fixes BZ #28970.
Reviewed-by: Sunil K Pandey <skpgkp2@gmail.com>
2022-03-16 08:48:36 -07:00
H.J. Lu
c12c2a41b0 benchtests: Generate .d dependency files [BZ #28922]
1. Add all .o files to extra-objs.
2. Include ../Rules after extra-objs has been set.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2022-02-25 10:35:25 -08:00
H.J. Lu
cf97591313 benchtests: Add benches for memset with 0 value
memset with zero as the value to set is by far the majority value (99%+
for Python3 and GCC).  Add bench-memset-zero-large.c,
bench-memset-zero-walk.c and bench-memset-zero.c to measure memset
implementations for zeroing.

Reviewed-by: Sunil K Pandey <skpgkp2@gmail.com>
2022-02-23 12:07:06 -08:00
H.J. Lu
dc98eeeb95 benchtests: Add benches for bzero
Add bench-bzero-large.c, bench-bzero-walk.c and bench-bzero.c.
2022-02-08 14:41:58 -08:00
H.J. Lu
03c9c4fce4 benchtests: Sort benches in Makefile
Put one bench per line and sort them.
2022-02-07 07:09:38 -08:00
Paul Eggert
581c785bf3 Update copyright dates with scripts/update-copyrights
I used these shell commands:

../glibc/scripts/update-copyrights $PWD/../gnulib/build-aux/update-copyright
(cd ../glibc && git commit -am"[this commit message]")

and then ignored the output, which consisted lines saying "FOO: warning:
copyright statement not found" for each of 7061 files FOO.

I then removed trailing white space from math/tgmath.h,
support/tst-support-open-dev-null-range.c, and
sysdeps/x86_64/multiarch/strlen-vec.S, to work around the following
obscure pre-commit check failure diagnostics from Savannah.  I don't
know why I run into these diagnostics whereas others evidently do not.

remote: *** 912-#endif
remote: *** 913:
remote: *** 914-
remote: *** error: lines with trailing whitespace found
...
remote: *** error: sysdeps/unix/sysv/linux/statx_cp.c: trailing lines
2022-01-01 11:40:24 -08:00
Sunil K Pandey
2856829ee7 Revert "benchtests: Add acosf function to bench-math"
This reverts commit 79d0fc6539.
2021-11-05 16:13:12 -07:00
Adhemerval Zanella
b8a6ee43bb benchtests: Add hypotf
Based on random input arguments.  About 85% tuples have exponents
of the two arguments close together (+-1 range).

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2021-11-01 16:23:39 -03:00
Sunil K Pandey
79d0fc6539 benchtests: Add acosf function to bench-math
Add acosf function to bench-math and copy acosf-inputs to benchtests.
Motivation for this patch is to prepare for upcoming libmvec new
functions.  Float and double version of libmvec functions stays
together.

acosf-inputs file generated from acos-inputs file using following
scaling formula:

f = d * (FLT_MAX/DBL_MAX)

Where d is input(double) and f is output(float).  If scaled float value
is duplicate in new input file, nextafterf() function used to find next
float value, ensuring no duplicates.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2021-10-29 08:52:30 -07:00
Noah Goldstein
cf3acd774f Benchtests: Add benchtests for __memcmpeq
No bug. This commit adds __memcmpeq benchmarks. The benchmarks just
use the existing ones in memcmp. This will be useful for testing
implementations of __memcmpeq that do not just alias memcmp.
2021-10-27 13:03:46 -05:00
H.J. Lu
d8e7d06381 bench-math: Sort and put each bench per line
Sort and put each math bench per line to prepare for new math benches.

Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
2021-10-23 05:20:25 -07:00
H.J. Lu
de0a7c5a0b benchtests: Building benchmarks as static executables
Building benchmarks as static executables:
=========================================

To build benchmarks as static executables, on the build system, run:

  $ make STATIC-BENCHTESTS=yes bench-build

You can copy benchmark executables to another machine and run them
without copying the source nor build directories.
2021-10-04 10:09:13 -07:00
Paul Zimmermann
8d0985b055 add workload traces for cbrtl
These workload traces cover the whole "long double" range.
This patch was prepared with the help of Adhemerval Zanella.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2021-05-10 18:45:34 +02:00
Paul Zimmermann
934d88d862 add workload traces for missing functions (double format)
This patch adds workload traces for all double format functions where such
files are missing.  For each function, a set of 1000 random values is
generated at random using SageMath, such that the output values are
meaningful (for example avoiding too large inputs for exp10 where the
output would be +Inf).  More details about the generated values are
given at the beginning of each file.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2021-03-29 16:23:19 +02:00
Raphael Moreira Zinsly
6cf1911122 benchtests: Add ilogb* tests
Add a benchtest to ilogb, ilogbf and ilogbf128 based on the logb* benchtests.
2021-03-16 12:19:09 -03:00
Arjun Shankar
3725ee39db benchtests: Do not build bench-timing-type with MODULE_NAME=libc
Since commit 2682695e5c, `make bench-build' with `--enable-static-pie'
fails due to bench-timing-type being incorrectly built with MODULE_NAME
set to `libc'.  This commit sets MODULE_NAME to nonlib, thus fixing the
build failure.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2021-01-26 18:14:19 +01:00
Paul Eggert
2b778ceb40 Update copyright dates with scripts/update-copyrights
I used these shell commands:

../glibc/scripts/update-copyrights $PWD/../gnulib/build-aux/update-copyright
(cd ../glibc && git commit -am"[this commit message]")

and then ignored the output, which consisted lines saying "FOO: warning:
copyright statement not found" for each of 6694 files FOO.
I then removed trailing white space from benchtests/bench-pthread-locks.c
and iconvdata/tst-iconv-big5-hkscs-to-2ucs4.c, to work around this
diagnostic from Savannah:
remote: *** pre-commit check failed ...
remote: *** error: lines with trailing whitespace found
remote: error: hook declined to update refs/heads/master
2021-01-02 12:17:34 -08:00
DJ Delorie
4be44c3208 New benchtest: pthread locks
Performance benchmarks for various posix locks: mutex, rwlock,
spinlock, condvar, and semaphore.  Each test is performed with
an empty loop body or with a computationally "interesting" (i.e.
difficult to optimize away, and used just to allow lock code to
be "hidden" in the filler's CPU cycles).
2020-10-21 11:03:52 -04:00
Arjun Shankar
03e26098b1 benchtests: Run _Float128 tests only on architectures that support it
__float128 is a non-standard name and is not available on some architectures
(like aarch64 or s390x) even though they may support the standard _Float128
type.  Other architectures (like armv7) don't support quad-precision
floating-point operations at all.

This commit replaces benchtests references to __float128 with _Float128 and
runs the corresponding tests only on architectures that support it.
2020-09-23 16:11:57 +02:00
Paul Zimmermann
26fbd74059 benchtests: Add "workload" traces for sinf128
This patch adds workload traces for sinf128 in binary32.  The trace is
made of 1000 random numbers, generated with SageMath.
2020-09-10 15:25:22 -03:00
Paul Zimmermann
e24b248dcb benchtests: Add "workload" traces for powf128
This patch adds workload traces for pow in binary128.  The trace is
made of 1000 random numbers, generated with SageMath.
2020-09-10 15:25:22 -03:00
Paul Zimmermann
abc9732aee benchtests: Add "workload" traces for expf128
This patch adds workload traces for exp in binary128.  The trace is
made of 1000 random numbers, generated with SageMath.
2020-09-10 15:25:22 -03:00
Adhemerval Zanella
2004063fb4 benchtests: Add exp10f benchmark
It is based on expf one by converting each line with the formula:

  new_val = (float) log10 (exp ((double) old_val))
2020-06-19 10:48:15 -03:00
H.J. Lu
e52434a2e4 benchtests: Restore the clock_gettime option
commit 7621e38bf3
Author: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Date:   Tue Jan 29 17:43:45 2019 +0000

    Add generic hp-timing support

removed the clock_gettime option.  Restore the clock_gettime option for
some x86 CPUs on which value from RDTSC may not be incremented at a fixed
rate.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2020-06-05 09:48:07 -07:00