Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small improvements to new benchmark tool #596

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ option(SLEEF_ENABLE_CXX "Enable C++" OFF)

#

if (SLEEF_BUILD_BENCH)
set(SLEEF_ENABLE_CXX ON)
endif ()

if (DEFINED SLEEF_BUILD_SHARED_LIBS)
set(BUILD_SHARED_LIBS ${SLEEF_BUILD_SHARED_LIBS})
endif ()
Expand Down
10 changes: 10 additions & 0 deletions docs/4-tools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,16 @@ and corresponds to all the benchmarks listed in
./build/bin/benchsleef128 --benchmark_filter=vectorf
```
Note: all corresponds to all functions available in SLEEF and enabled in the benchmarks in this context.

This tool also supports multiple output formats, a feature
also inherited from googlebench framework.
The output formats available are `console`(default), `json` and `csv`.
```sh
# Examples:
# * This will print output in the terminal in json format:
./build/bin/benchsleef128 --benchmark_format=json
```

<h3 id="benchmark">Benchmarking on aarch64</h3>
If you're running SLEEF on a machine with SVE support the executable generated will have SVE benchmarks
available for functions specified in `benchsleef.cpp`.
Expand Down
8 changes: 4 additions & 4 deletions src/benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,28 @@ include_directories(${sleef_BINARY_DIR}/include) # sleef.h
link_directories(${sleef_BINARY_DIR}/lib) # libsleef


set(Extra_CFLAGS -Wall -O3 -Wno-attributes)
set(EXTRA_CFLAGS -Wall -O2 -Wno-attributes)
set(BENCH_SRC_FILE "benchsleef.cpp" "benchmark_callers.hpp" "benchmark_templates.hpp" "gen_input.hpp" "type_defs.hpp")
set(BENCH_PROPERTIES C_STANDARD 99 CXX_STANDARD 17)
set(BENCH_LIBS benchmark sleef Threads::Threads) # Link Google Benchmark and sleef to the project

# Add source to this project's executable.
add_executable (benchsleef128 ${BENCH_SRC_FILE})
set_target_properties(benchsleef128 PROPERTIES ${BENCH_PROPERTIES})
target_compile_options(benchsleef128 PRIVATE ${Extra_CFLAGS} -march=native)
target_compile_options(benchsleef128 PRIVATE ${EXTRA_CFLAGS} -march=native)
target_link_libraries(benchsleef128 ${BENCH_LIBS})
add_dependencies(benchsleef128 googlebenchmark)

if(CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)")
add_executable (benchsleef256 ${BENCH_SRC_FILE})
set_target_properties(benchsleef256 PROPERTIES ${BENCH_PROPERTIES})
target_compile_options(benchsleef256 PRIVATE ${Extra_CFLAGS} "-march=native" "-DARCH_VECT_LEN=256")
target_compile_options(benchsleef256 PRIVATE ${EXTRA_CFLAGS} "-march=native" "-DARCH_VECT_LEN=256")
target_link_libraries(benchsleef256 ${BENCH_LIBS})
add_dependencies(benchsleef256 googlebenchmark)

add_executable (benchsleef512 ${BENCH_SRC_FILE})
set_target_properties(benchsleef512 PROPERTIES ${BENCH_PROPERTIES})
target_compile_options(benchsleef512 PRIVATE ${Extra_CFLAGS} "-mavx512f" "-DARCH_VECT_LEN=512")
target_compile_options(benchsleef512 PRIVATE ${EXTRA_CFLAGS} "-mavx512f" "-DARCH_VECT_LEN=512")
target_link_libraries(benchsleef512 ${BENCH_LIBS})
add_dependencies(benchsleef512 googlebenchmark)
endif()
10 changes: 10 additions & 0 deletions src/benchmarks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ and corresponds to all the benchmarks listed in
./build/bin/benchsleef128 --benchmark_filter=vectorf
```
Note: all corresponds to all functions available in SLEEF and enabled in the benchmarks in this context.

This tool also supports multiple output formats, a feature
also inherited from googlebench framework.
The output formats available are `console`(default), `json` and `csv`.
```sh
# Examples:
# * This will print output in the terminal in json format:
./build/bin/benchsleef128 --benchmark_format=json
```

<h3 id="benchmark">Benchmarking on aarch64</h3>
If you're running SLEEF on a machine with SVE support the executable generated will have SVE benchmarks
available for functions specified in `benchsleef.cpp`.
Expand Down
4 changes: 2 additions & 2 deletions src/benchmarks/benchmark_callers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@
// Generate benchmarks for SVE function implementations
#ifdef ENABLE_SVECTOR_BENCHMARKS
#define BENCH_SINGLE_SVE(fun, ulp, min, max) \
BENCH(Sleef_##fun##fx_##ulp##sve, scalarf, min, max);
BENCH(Sleef_##fun##fx_##ulp##sve, svef, min, max);
#define BENCH_DOUBLE_SVE(fun, ulp, min, max) \
BENCH(Sleef_##fun##dx_##ulp##sve, scalard, min, max);
BENCH(Sleef_##fun##dx_##ulp##sve, sved, min, max);
#define BENCH_SVE(fun, ulp, min, max) \
BENCH_SINGLE_SVE(fun, ulp, min, max); \
BENCH_DOUBLE_SVE(fun, ulp, min, max);
Expand Down
Loading