Skip to content

Commit

Permalink
Decrease optimization level for compiling benchmarks
Browse files Browse the repository at this point in the history
Calls to functions which return two values (for example sincos),
were being optimized away in new benchmark tool. Fixed by
decreasing optimization level (O3 -> O2).
  • Loading branch information
joanaxcruz committed Oct 18, 2024
1 parent c8b726f commit ad582e4
Showing 1 changed file with 4 additions and 4 deletions.
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()

0 comments on commit ad582e4

Please sign in to comment.