Skip to content

Commit c3c4c8c

Browse files
committed
🐛 Fix benchmarks on GCC
Problem: - Benchmarks are using unknown command line options for GCC. - GCC cannot perform CTAD on pseudo-pext benchmark inputs properly. Solution: - The equivalent of Clang's `-fconstexpr-steps` is GCC's `-fconstexpr-ops-limit`. - Supply pseudo-pext benchmark inputs with explicit template arguments.
1 parent 6d65961 commit c3c4c8c

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

benchmark/lookup/CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,12 @@ function(gen_pp_benchmarks)
9191
cib_lookup
9292
mph
9393
frozen-headers)
94-
target_compile_options(${name} PRIVATE -fconstexpr-steps=4000000000
95-
--include=${HEADER})
94+
target_compile_options(
95+
${name}
96+
PRIVATE
97+
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:-fconstexpr-steps=4000000000>
98+
$<$<CXX_COMPILER_ID:GNU>:-fconstexpr-ops-limit=4000000000>
99+
--include=${HEADER})
96100
target_compile_definitions(
97101
${name} PRIVATE ALG_NAME=bench_${ALG_NAME} DATASET=${DATASET}
98102
ANKERL_NANOBENCH_IMPLEMENT)

benchmark/lookup/algorithms/pseudo_pext.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ template <auto data, typename T, bool indirect = true,
2626
std::size_t max_search_len = 2>
2727
constexpr auto make_pseudo_pext() {
2828
return lookup::pseudo_pext_lookup<indirect, max_search_len>::make(
29-
CX_VALUE(lookup::input{0, pp::input_data<data, T>}));
29+
CX_VALUE(lookup::input<T, T, data.size()>{0, pp::input_data<data, T>}));
3030
}
3131

3232
template <auto data, typename T, bool indirect = true,

benchmark/msg/CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
add_benchmark(handler_bench NANO FILES handler_bench.cpp SYSTEM_LIBRARIES cib)
2-
target_compile_options(handler_bench PRIVATE -fconstexpr-steps=4000000000
3-
-fbracket-depth=1024)
2+
target_compile_options(
3+
handler_bench
4+
PRIVATE
5+
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:-fconstexpr-steps=4000000000>
6+
$<$<CXX_COMPILER_ID:GNU>:-fconstexpr-ops-limit=4000000000>
7+
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:-fbracket-depth=1024>
8+
)

0 commit comments

Comments
 (0)