public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [committed 0/2] benchtests: libmvec cleanups
@ 2022-04-29  6:50 Siddhesh Poyarekar
  2022-04-29  6:50 ` [committed 1/2] benchtests: Add UNSUPPORTED benchmark status Siddhesh Poyarekar
  2022-04-29  6:50 ` [committed 2/2] benchtests: Better libmvec integration Siddhesh Poyarekar
  0 siblings, 2 replies; 3+ messages in thread
From: Siddhesh Poyarekar @ 2022-04-29  6:50 UTC (permalink / raw)
  To: libc-alpha

Fixes to integrate libmvec benchmarks better into `make bench`.

Siddhesh Poyarekar (2):
  benchtests: Add UNSUPPORTED benchmark status
  benchtests: Better libmvec integration

 benchtests/Makefile                         | 55 +++++++++++++--------
 sysdeps/x86_64/fpu/Makefile                 |  4 --
 sysdeps/x86_64/fpu/bench-libmvec-skeleton.c | 12 ++---
 3 files changed, 41 insertions(+), 30 deletions(-)

-- 
2.35.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [committed 1/2] benchtests: Add UNSUPPORTED benchmark status
  2022-04-29  6:50 [committed 0/2] benchtests: libmvec cleanups Siddhesh Poyarekar
@ 2022-04-29  6:50 ` Siddhesh Poyarekar
  2022-04-29  6:50 ` [committed 2/2] benchtests: Better libmvec integration Siddhesh Poyarekar
  1 sibling, 0 replies; 3+ messages in thread
From: Siddhesh Poyarekar @ 2022-04-29  6:50 UTC (permalink / raw)
  To: libc-alpha

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>
---
 benchtests/Makefile                         | 23 ++++++++++++++++-----
 sysdeps/x86_64/fpu/bench-libmvec-skeleton.c | 12 +++++------
 2 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/benchtests/Makefile b/benchtests/Makefile
index b477042e6c..7943d1c58a 100644
--- a/benchtests/Makefile
+++ b/benchtests/Makefile
@@ -1,4 +1,5 @@
 # Copyright (C) 2013-2022 Free Software Foundation, Inc.
+# Copyright The GNU Toolchain Authors.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -417,11 +418,23 @@ bench-func: $(binaries-bench)
 	  echo "{\"timing_type\": \"$${timing_type}\","; \
 	  echo " \"functions\": {"; \
 	  for run in $^; do \
-	    if ! [ "x$${run}" = "x$<" ]; then \
-	      echo ","; \
-	    fi; \
-	    echo "Running $${run}" >&2; \
-	    $(run-bench) $(DETAILED_OPT); \
+	    op=$$($(run-bench) $(DETAILED_OPT)); \
+	    ret=$$?; \
+	    case "$${ret}" in \
+	      77) \
+	      echo "UNSUPPORTED $${run}: $${op}" >&2; \
+		;; \
+	      0) \
+		echo "Running $${run}" >&2; \
+		if [ "$${run}" != "$<" ]; then \
+		  echo ","; \
+		fi; \
+		echo "$${op}"; \
+		;; \
+	      *) \
+		echo "FAILED $${run}" >&2; \
+		;; \
+	    esac; \
 	  done; \
 	  echo; \
 	  echo " }"; \
diff --git a/sysdeps/x86_64/fpu/bench-libmvec-skeleton.c b/sysdeps/x86_64/fpu/bench-libmvec-skeleton.c
index 8954abe8b8..e28249df91 100644
--- a/sysdeps/x86_64/fpu/bench-libmvec-skeleton.c
+++ b/sysdeps/x86_64/fpu/bench-libmvec-skeleton.c
@@ -40,20 +40,20 @@ main (int argc, char **argv)
 #if defined REQUIRE_AVX
   if (!CPU_FEATURE_ACTIVE (AVX))
     {
-      printf ("AVX not supported.\n");
-      return 0;
+      printf ("AVX not supported.");
+      return 77;
     }
 #elif defined REQUIRE_AVX2
   if (!CPU_FEATURE_ACTIVE (AVX2))
     {
-      printf ("AVX2 not supported.\n");
-      return 0;
+      printf ("AVX2 not supported.");
+      return 77;
     }
 #elif defined REQUIRE_AVX512F
   if (!CPU_FEATURE_ACTIVE (AVX512F))
     {
-      printf ("AVX512F not supported.\n");
-      return 0;
+      printf ("AVX512F not supported.");
+      return 77;
     }
 #endif
 
-- 
2.35.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [committed 2/2] benchtests: Better libmvec integration
  2022-04-29  6:50 [committed 0/2] benchtests: libmvec cleanups Siddhesh Poyarekar
  2022-04-29  6:50 ` [committed 1/2] benchtests: Add UNSUPPORTED benchmark status Siddhesh Poyarekar
@ 2022-04-29  6:50 ` Siddhesh Poyarekar
  1 sibling, 0 replies; 3+ messages in thread
From: Siddhesh Poyarekar @ 2022-04-29  6:50 UTC (permalink / raw)
  To: libc-alpha

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>
---
 benchtests/Makefile         | 32 +++++++++++++++++---------------
 sysdeps/x86_64/fpu/Makefile |  4 ----
 2 files changed, 17 insertions(+), 19 deletions(-)

diff --git a/benchtests/Makefile b/benchtests/Makefile
index 7943d1c58a..149d87e22e 100644
--- a/benchtests/Makefile
+++ b/benchtests/Makefile
@@ -113,12 +113,6 @@ bench-string := \
   ffsll \
 # bench-string
 
-ifeq (${BENCHSET},)
-bench := $(bench-math) $(bench-pthread) $(bench-string)
-else
-bench := $(foreach B,$(filter bench-%,${BENCHSET}), ${${B}})
-endif
-
 # String function benchmarks.
 string-benchset := \
   bzero \
@@ -299,15 +293,6 @@ bench-extra-objs = json-lib.o
 extra-objs += $(bench-extra-objs)
 others-extras = $(bench-extra-objs)
 
-# NB: Use "=" instead of ":=" since sysdeps Makefiles may add more
-# benches.
-binaries-bench = $(addprefix $(objpfx)bench-,$(bench))
-extra-objs += $(addsuffix .o,$(addprefix bench-,$(bench)))
-binaries-benchset = $(addprefix $(objpfx)bench-,$(benchset))
-extra-objs += $(addsuffix .o,$(addprefix bench-,$(benchset)))
-binaries-bench-malloc := $(addprefix $(objpfx)bench-,$(bench-malloc))
-extra-objs += $(addsuffix .o,$(addprefix bench-,$(bench-malloc)))
-
 # The default duration: 1 seconds.
 ifndef BENCH_DURATION
 BENCH_DURATION := 1
@@ -344,6 +329,23 @@ extra-objs += bench-timing-type.o
 
 include ../Rules
 
+bench-math += $(bench-libmvec)
+
+ifeq (${BENCHSET},)
+bench := $(bench-math) $(bench-pthread) $(bench-string)
+else
+bench := $(foreach B,$(filter bench-%,${BENCHSET}), ${${B}})
+endif
+
+# NB: Use "=" instead of ":=" since sysdeps Makefiles may add more
+# benches.
+binaries-bench = $(addprefix $(objpfx)bench-,$(bench))
+extra-objs += $(addsuffix .o,$(addprefix bench-,$(bench)))
+binaries-benchset = $(addprefix $(objpfx)bench-,$(benchset))
+extra-objs += $(addsuffix .o,$(addprefix bench-,$(benchset)))
+binaries-bench-malloc := $(addprefix $(objpfx)bench-,$(bench-malloc))
+extra-objs += $(addsuffix .o,$(addprefix bench-,$(bench-malloc)))
+
 # This makes sure CPPFLAGS-nonlib and CFLAGS-nonlib are passed
 # for all these modules.
 cpp-srcs-left := $(binaries-benchset:=.c) $(binaries-bench:=.c) \
diff --git a/sysdeps/x86_64/fpu/Makefile b/sysdeps/x86_64/fpu/Makefile
index 24af49e068..7233174ede 100644
--- a/sysdeps/x86_64/fpu/Makefile
+++ b/sysdeps/x86_64/fpu/Makefile
@@ -86,10 +86,6 @@ float-vlen16-arch-ext-cflags = -mavx512f
 
 bench-libmvec := $(bench-libmvec-double) $(bench-libmvec-float)
 
-ifeq (${BENCHSET},)
-bench += $(bench-libmvec)
-endif
-
 ifeq (${STATIC-BENCHTESTS},yes)
 libmvec-benchtests = $(common-objpfx)mathvec/libmvec.a $(common-objpfx)math/libm.a
 else
-- 
2.35.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-04-29  6:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-29  6:50 [committed 0/2] benchtests: libmvec cleanups Siddhesh Poyarekar
2022-04-29  6:50 ` [committed 1/2] benchtests: Add UNSUPPORTED benchmark status Siddhesh Poyarekar
2022-04-29  6:50 ` [committed 2/2] benchtests: Better libmvec integration Siddhesh Poyarekar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).