From d53189f9a4d776620ab5204593a20eb9f51c796a Mon Sep 17 00:00:00 2001 From: Alex Guteniev Date: Fri, 23 May 2025 09:04:19 +0300 Subject: [PATCH 1/7] Make benchmarks compiling in clang-cl --- benchmarks/src/bitset_from_string.cpp | 2 +- benchmarks/src/bitset_to_string.cpp | 9 ++--- benchmarks/src/filesystem.cpp | 4 +-- benchmarks/src/has_single_bit.cpp | 4 +-- benchmarks/src/locale_classic.cpp | 3 +- benchmarks/src/move_only_function.cpp | 4 +++ benchmarks/src/priority_queue_push_range.cpp | 6 ++-- benchmarks/src/search.cpp | 35 ++++++++++---------- benchmarks/src/sv_equal.cpp | 2 +- 9 files changed, 37 insertions(+), 32 deletions(-) diff --git a/benchmarks/src/bitset_from_string.cpp b/benchmarks/src/bitset_from_string.cpp index cf0c48b52d3..26703ecd803 100644 --- a/benchmarks/src/bitset_from_string.cpp +++ b/benchmarks/src/bitset_from_string.cpp @@ -42,7 +42,7 @@ const auto random_digits = random_digits_init(); template void bitset_from_string(benchmark::State& state) { - const auto& digit_array = random_digits; + auto digit_array = random_digits; for (auto _ : state) { benchmark::DoNotOptimize(digit_array); const auto arr_data = digit_array.data(); diff --git a/benchmarks/src/bitset_to_string.cpp b/benchmarks/src/bitset_to_string.cpp index 0dcc1031a7a..43a54c2b1d1 100644 --- a/benchmarks/src/bitset_to_string.cpp +++ b/benchmarks/src/bitset_to_string.cpp @@ -30,10 +30,11 @@ void BM_bitset_to_string(benchmark::State& state) { static_assert(N <= 64); for (auto _ : state) { - for (const auto& bits : random_bits<>) { + // make a copy, so that it can be potentially modified by DoNotOptimize + for (auto bits : random_bits<>) { benchmark::DoNotOptimize(bits); bitset bs{bits}; - benchmark::DoNotOptimize(bs.to_string()); + benchmark::DoNotOptimize(bs.template to_string()); } } } @@ -43,10 +44,10 @@ void BM_bitset_to_string_large_single(benchmark::State& state) { static_assert(N % 64 == 0 && N >= 64); const auto& bitset_data = random_bits; - const auto large_bitset = bit_cast>(bitset_data); + auto large_bitset = bit_cast>(bitset_data); for (auto _ : state) { benchmark::DoNotOptimize(large_bitset); - benchmark::DoNotOptimize(large_bitset.to_string()); + benchmark::DoNotOptimize(large_bitset.template to_string()); } } diff --git a/benchmarks/src/filesystem.cpp b/benchmarks/src/filesystem.cpp index 33c8e69e875..120aa107ca9 100644 --- a/benchmarks/src/filesystem.cpp +++ b/benchmarks/src/filesystem.cpp @@ -6,12 +6,12 @@ #include void symlink_status(benchmark::State& state) { - const auto path = std::filesystem::temp_directory_path(); + auto path = std::filesystem::temp_directory_path(); for (auto _ : state) { std::error_code ec; benchmark::DoNotOptimize(path); - const auto status = std::filesystem::symlink_status(path, ec); + auto status = std::filesystem::symlink_status(path, ec); benchmark::DoNotOptimize(status); benchmark::DoNotOptimize(ec); } diff --git a/benchmarks/src/has_single_bit.cpp b/benchmarks/src/has_single_bit.cpp index 7f2519e0a1c..3e8255b5343 100644 --- a/benchmarks/src/has_single_bit.cpp +++ b/benchmarks/src/has_single_bit.cpp @@ -11,7 +11,7 @@ using namespace std; template void bm_has_single_bit_if(benchmark::State& state) { - const auto random_v = random_vector(8); + auto random_v = random_vector(8); for (auto _ : state) { benchmark::DoNotOptimize(random_v); unsigned int count_true = 0; @@ -28,7 +28,7 @@ void bm_has_single_bit_if(benchmark::State& state) { template void bm_has_single_bit(benchmark::State& state) { - const auto random_v = random_vector(8); + auto random_v = random_vector(8); for (auto _ : state) { benchmark::DoNotOptimize(random_v); unsigned int r = 0; diff --git a/benchmarks/src/locale_classic.cpp b/benchmarks/src/locale_classic.cpp index cac18e5a15f..aa4a739a27e 100644 --- a/benchmarks/src/locale_classic.cpp +++ b/benchmarks/src/locale_classic.cpp @@ -8,7 +8,8 @@ using namespace std; // GH-3048 : Double-checked locking for locale::classic void BM_locale_classic(benchmark::State& state) { for (auto _ : state) { - benchmark::DoNotOptimize(locale::classic()); + auto v = locale::classic(); + benchmark::DoNotOptimize(v); } } BENCHMARK(BM_locale_classic); diff --git a/benchmarks/src/move_only_function.cpp b/benchmarks/src/move_only_function.cpp index 9760a602b25..c5f108d25c8 100644 --- a/benchmarks/src/move_only_function.cpp +++ b/benchmarks/src/move_only_function.cpp @@ -5,6 +5,10 @@ #include #include +#ifdef __clang__ +#pragma clang diagnostic ignored "-Wunqualified-std-cast-call" +#endif // defined(__clang__) + using namespace std; void mof_none(benchmark::State& state) { diff --git a/benchmarks/src/priority_queue_push_range.cpp b/benchmarks/src/priority_queue_push_range.cpp index c15663c90e4..1001aa6c9dc 100644 --- a/benchmarks/src/priority_queue_push_range.cpp +++ b/benchmarks/src/priority_queue_push_range.cpp @@ -59,10 +59,8 @@ void BM_push_range(benchmark::State& state) { template void putln(const benchmark::State&) { - static bool b = [] { - puts(""); - return true; - }(); + static once_flag f; + call_once(f, [] { puts(""); }); } #define TEST_PUSH_RANGE(T, source) \ diff --git a/benchmarks/src/search.cpp b/benchmarks/src/search.cpp index 47583b8214b..4f803cec3a2 100644 --- a/benchmarks/src/search.cpp +++ b/benchmarks/src/search.cpp @@ -32,7 +32,8 @@ template constexpr std::array fill_pattern_array = make_fill_pattern_array(); template -constexpr std::string_view fill_pattern_view = fill_pattern_array; +constexpr std::string_view fill_pattern_view{ + fill_pattern_array.data(), fill_pattern_array.size()}; struct data_and_pattern { std::string_view data; @@ -60,8 +61,8 @@ void c_strstr(benchmark::State& state) { const auto& src_haystack = patterns[static_cast(state.range())].data; const auto& src_needle = patterns[static_cast(state.range())].pattern; - const not_highly_aligned_string haystack(src_haystack); - const not_highly_aligned_string needle(src_needle); + not_highly_aligned_string haystack(src_haystack); + not_highly_aligned_string needle(src_needle); for (auto _ : state) { benchmark::DoNotOptimize(haystack); @@ -76,8 +77,8 @@ void classic_search(benchmark::State& state) { const auto& src_haystack = patterns[static_cast(state.range())].data; const auto& src_needle = patterns[static_cast(state.range())].pattern; - const std::vector> haystack(src_haystack.begin(), src_haystack.end()); - const std::vector> needle(src_needle.begin(), src_needle.end()); + std::vector> haystack(src_haystack.begin(), src_haystack.end()); + std::vector> needle(src_needle.begin(), src_needle.end()); for (auto _ : state) { benchmark::DoNotOptimize(haystack); @@ -92,8 +93,8 @@ void ranges_search(benchmark::State& state) { const auto& src_haystack = patterns[static_cast(state.range())].data; const auto& src_needle = patterns[static_cast(state.range())].pattern; - const std::vector> haystack(src_haystack.begin(), src_haystack.end()); - const std::vector> needle(src_needle.begin(), src_needle.end()); + std::vector> haystack(src_haystack.begin(), src_haystack.end()); + std::vector> needle(src_needle.begin(), src_needle.end()); for (auto _ : state) { benchmark::DoNotOptimize(haystack); @@ -108,8 +109,8 @@ void search_default_searcher(benchmark::State& state) { const auto& src_haystack = patterns[static_cast(state.range())].data; const auto& src_needle = patterns[static_cast(state.range())].pattern; - const std::vector> haystack(src_haystack.begin(), src_haystack.end()); - const std::vector> needle(src_needle.begin(), src_needle.end()); + std::vector> haystack(src_haystack.begin(), src_haystack.end()); + std::vector> needle(src_needle.begin(), src_needle.end()); for (auto _ : state) { benchmark::DoNotOptimize(haystack); @@ -124,8 +125,8 @@ void member_find(benchmark::State& state) { const auto& src_haystack = patterns[static_cast(state.range())].data; const auto& src_needle = patterns[static_cast(state.range())].pattern; - const T haystack(src_haystack.begin(), src_haystack.end()); - const T needle(src_needle.begin(), src_needle.end()); + T haystack(src_haystack.begin(), src_haystack.end()); + T needle(src_needle.begin(), src_needle.end()); for (auto _ : state) { benchmark::DoNotOptimize(haystack); @@ -140,8 +141,8 @@ void classic_find_end(benchmark::State& state) { const auto& src_haystack = patterns[static_cast(state.range())].data; const auto& src_needle = patterns[static_cast(state.range())].pattern; - const std::vector> haystack(src_haystack.begin(), src_haystack.end()); - const std::vector> needle(src_needle.begin(), src_needle.end()); + std::vector> haystack(src_haystack.begin(), src_haystack.end()); + std::vector> needle(src_needle.begin(), src_needle.end()); for (auto _ : state) { benchmark::DoNotOptimize(haystack); @@ -156,8 +157,8 @@ void ranges_find_end(benchmark::State& state) { const auto& src_haystack = patterns[static_cast(state.range())].data; const auto& src_needle = patterns[static_cast(state.range())].pattern; - const std::vector> haystack(src_haystack.begin(), src_haystack.end()); - const std::vector> needle(src_needle.begin(), src_needle.end()); + std::vector> haystack(src_haystack.begin(), src_haystack.end()); + std::vector> needle(src_needle.begin(), src_needle.end()); for (auto _ : state) { benchmark::DoNotOptimize(haystack); @@ -172,8 +173,8 @@ void member_rfind(benchmark::State& state) { const auto& src_haystack = patterns[static_cast(state.range())].data; const auto& src_needle = patterns[static_cast(state.range())].pattern; - const T haystack(src_haystack.begin(), src_haystack.end()); - const T needle(src_needle.begin(), src_needle.end()); + T haystack(src_haystack.begin(), src_haystack.end()); + T needle(src_needle.begin(), src_needle.end()); for (auto _ : state) { benchmark::DoNotOptimize(haystack); diff --git a/benchmarks/src/sv_equal.cpp b/benchmarks/src/sv_equal.cpp index 219b6b927c1..67e09846ccc 100644 --- a/benchmarks/src/sv_equal.cpp +++ b/benchmarks/src/sv_equal.cpp @@ -31,7 +31,7 @@ constexpr std::array make_svs() { template void sv_equal(benchmark::State& state) { - constexpr auto arr = make_svs(); + auto arr = make_svs(); benchmark::DoNotOptimize(arr); for (auto _ : state) { From 81d6234b7cd0722aec9478415850df6c062b0938 Mon Sep 17 00:00:00 2001 From: Alex Guteniev Date: Sat, 24 May 2025 11:24:38 +0300 Subject: [PATCH 2/7] exclude `/Zc:preprocessor` from clang-cl --- benchmarks/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt index 719d7deec21..9ffada2db5f 100644 --- a/benchmarks/CMakeLists.txt +++ b/benchmarks/CMakeLists.txt @@ -57,7 +57,8 @@ set(CMAKE_MSVC_RUNTIME_LIBRARY "${STL_BENCHMARK_MSVC_RUNTIME_LIBRARY}") set(CMAKE_BUILD_TYPE Release) # /utf-8 affects . -add_compile_options("$<$:/Zi;/nologo;/diagnostics:caret;/W4;/WX;/w14265;/w15038;/w15262;/utf-8;/Zc:preprocessor>") +add_compile_options("$<$:/Zi;/nologo;/diagnostics:caret;/W4;/WX;/w14265;/w15038;/w15262;/utf-8>") +add_compile_options("$<$:/Zc:preprocessor>") add_link_options("/DEBUG") From a4bc7a5a4ad41f4d09e5950b92846c6aa4a51024 Mon Sep 17 00:00:00 2001 From: Alex Guteniev Date: Sat, 24 May 2025 12:08:02 +0300 Subject: [PATCH 3/7] TRANSITION comment --- benchmarks/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt index 9ffada2db5f..a0cf915ea1f 100644 --- a/benchmarks/CMakeLists.txt +++ b/benchmarks/CMakeLists.txt @@ -58,7 +58,7 @@ set(CMAKE_BUILD_TYPE Release) # /utf-8 affects . add_compile_options("$<$:/Zi;/nologo;/diagnostics:caret;/W4;/WX;/w14265;/w15038;/w15262;/utf-8>") -add_compile_options("$<$:/Zc:preprocessor>") +add_compile_options("$<$:/Zc:preprocessor>") # TRANSITION, LLVM-48220 clang-cl: ignore /Zc:preprocessor add_link_options("/DEBUG") From 8ac1da1f65aa45fee774371275db8ba277e014ef Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 29 May 2025 07:07:25 -0700 Subject: [PATCH 4/7] Extract build-benchmarks.yml, no functional changes. --- azure-devops/build-and-test.yml | 7 ++++- azure-devops/build-benchmarks.yml | 38 ++++++++++++++++++++++++++ azure-devops/cmake-configure-build.yml | 26 ------------------ 3 files changed, 44 insertions(+), 27 deletions(-) create mode 100644 azure-devops/build-benchmarks.yml diff --git a/azure-devops/build-and-test.yml b/azure-devops/build-and-test.yml index a90c7c2f382..c7d598ff3cc 100644 --- a/azure-devops/build-and-test.yml +++ b/azure-devops/build-and-test.yml @@ -58,8 +58,13 @@ jobs: targetPlatform: ${{ parameters.targetPlatform }} analyzeBuild: ${{ parameters.analyzeBuild }} asanBuild: ${{ parameters.asanBuild }} - buildBenchmarks: ${{ parameters.buildBenchmarks }} testsBuildOnly: ${{ parameters.testsBuildOnly }} + - template: build-benchmarks.yml + parameters: + hostArch: ${{ parameters.hostArch }} + targetArch: ${{ parameters.targetArch }} + targetPlatform: ${{ parameters.targetPlatform }} + buildBenchmarks: ${{ parameters.buildBenchmarks }} - template: run-tests.yml parameters: hostArch: ${{ parameters.hostArch }} diff --git a/azure-devops/build-benchmarks.yml b/azure-devops/build-benchmarks.yml new file mode 100644 index 00000000000..11c39adc7cc --- /dev/null +++ b/azure-devops/build-benchmarks.yml @@ -0,0 +1,38 @@ +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +parameters: +- name: hostArch + type: string +- name: targetArch + type: string +- name: targetPlatform + type: string +- name: buildBenchmarks + type: boolean + +steps: +- script: | + if exist "$(benchmarkBuildOutputLocation)" ( + rmdir /S /Q "$(benchmarkBuildOutputLocation)" + ) + call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\Common7\Tools\VsDevCmd.bat" ^ + -host_arch=${{ parameters.hostArch }} -arch=${{ parameters.targetArch }} -no_logo + cmake -G Ninja ^ + -DCMAKE_CXX_COMPILER=cl ^ + -DCMAKE_BUILD_TYPE=Release ^ + -DSTL_BINARY_DIR="$(buildOutputLocation)" ^ + -DVCLIBS_TARGET_ARCHITECTURE=${{ parameters.targetPlatform }} ^ + -S $(Build.SourcesDirectory)/benchmarks -B "$(benchmarkBuildOutputLocation)" + displayName: 'Configure the benchmarks' + timeoutInMinutes: 2 + env: { TMP: $(tmpDir), TEMP: $(tmpDir) } + condition: and(succeeded(), ${{ parameters.buildBenchmarks }}) +- script: | + call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\Common7\Tools\VsDevCmd.bat" ^ + -host_arch=${{ parameters.hostArch }} -arch=${{ parameters.targetArch }} -no_logo + cmake --build "$(benchmarkBuildOutputLocation)" + displayName: 'Build the benchmarks' + timeoutInMinutes: 2 + env: { TMP: $(tmpDir), TEMP: $(tmpDir) } + condition: and(succeeded(), ${{ parameters.buildBenchmarks }}) diff --git a/azure-devops/cmake-configure-build.yml b/azure-devops/cmake-configure-build.yml index 39d27169841..c8db703e61c 100644 --- a/azure-devops/cmake-configure-build.yml +++ b/azure-devops/cmake-configure-build.yml @@ -12,8 +12,6 @@ parameters: type: boolean - name: asanBuild type: boolean -- name: buildBenchmarks - type: boolean - name: testsBuildOnly type: boolean - name: litFlags @@ -50,27 +48,3 @@ steps: displayName: 'Build the STL' timeoutInMinutes: 5 env: { TMP: $(tmpDir), TEMP: $(tmpDir) } -- script: | - if exist "$(benchmarkBuildOutputLocation)" ( - rmdir /S /Q "$(benchmarkBuildOutputLocation)" - ) - call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\Common7\Tools\VsDevCmd.bat" ^ - -host_arch=${{ parameters.hostArch }} -arch=${{ parameters.targetArch }} -no_logo - cmake -G Ninja ^ - -DCMAKE_CXX_COMPILER=cl ^ - -DCMAKE_BUILD_TYPE=Release ^ - -DSTL_BINARY_DIR="$(buildOutputLocation)" ^ - -DVCLIBS_TARGET_ARCHITECTURE=${{ parameters.targetPlatform }} ^ - -S $(Build.SourcesDirectory)/benchmarks -B "$(benchmarkBuildOutputLocation)" - displayName: 'Configure the benchmarks' - timeoutInMinutes: 2 - env: { TMP: $(tmpDir), TEMP: $(tmpDir) } - condition: and(succeeded(), ${{ parameters.buildBenchmarks }}) -- script: | - call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\Common7\Tools\VsDevCmd.bat" ^ - -host_arch=${{ parameters.hostArch }} -arch=${{ parameters.targetArch }} -no_logo - cmake --build "$(benchmarkBuildOutputLocation)" - displayName: 'Build the benchmarks' - timeoutInMinutes: 2 - env: { TMP: $(tmpDir), TEMP: $(tmpDir) } - condition: and(succeeded(), ${{ parameters.buildBenchmarks }}) From 90ea3b6356566e0f93cfca8de04c5311faee730e Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 29 May 2025 07:21:41 -0700 Subject: [PATCH 5/7] Repeat build-benchmarks.yml for both cl and clang-cl. --- azure-devops/build-and-test.yml | 8 ++++++++ azure-devops/build-benchmarks.yml | 16 +++++++++------- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/azure-devops/build-and-test.yml b/azure-devops/build-and-test.yml index c7d598ff3cc..11cf23afa94 100644 --- a/azure-devops/build-and-test.yml +++ b/azure-devops/build-and-test.yml @@ -65,6 +65,14 @@ jobs: targetArch: ${{ parameters.targetArch }} targetPlatform: ${{ parameters.targetPlatform }} buildBenchmarks: ${{ parameters.buildBenchmarks }} + compiler: cl + - template: build-benchmarks.yml + parameters: + hostArch: ${{ parameters.hostArch }} + targetArch: ${{ parameters.targetArch }} + targetPlatform: ${{ parameters.targetPlatform }} + buildBenchmarks: ${{ parameters.buildBenchmarks }} + compiler: clang-cl - template: run-tests.yml parameters: hostArch: ${{ parameters.hostArch }} diff --git a/azure-devops/build-benchmarks.yml b/azure-devops/build-benchmarks.yml index 11c39adc7cc..7dda4a70178 100644 --- a/azure-devops/build-benchmarks.yml +++ b/azure-devops/build-benchmarks.yml @@ -10,29 +10,31 @@ parameters: type: string - name: buildBenchmarks type: boolean +- name: compiler + type: string steps: - script: | - if exist "$(benchmarkBuildOutputLocation)" ( - rmdir /S /Q "$(benchmarkBuildOutputLocation)" + if exist "$(benchmarkBuildOutputLocation)\${{ parameters.compiler }}" ( + rmdir /S /Q "$(benchmarkBuildOutputLocation)\${{ parameters.compiler }}" ) call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\Common7\Tools\VsDevCmd.bat" ^ -host_arch=${{ parameters.hostArch }} -arch=${{ parameters.targetArch }} -no_logo cmake -G Ninja ^ - -DCMAKE_CXX_COMPILER=cl ^ + -DCMAKE_CXX_COMPILER=${{ parameters.compiler }} ^ -DCMAKE_BUILD_TYPE=Release ^ -DSTL_BINARY_DIR="$(buildOutputLocation)" ^ -DVCLIBS_TARGET_ARCHITECTURE=${{ parameters.targetPlatform }} ^ - -S $(Build.SourcesDirectory)/benchmarks -B "$(benchmarkBuildOutputLocation)" - displayName: 'Configure the benchmarks' + -S $(Build.SourcesDirectory)/benchmarks -B "$(benchmarkBuildOutputLocation)\${{ parameters.compiler }}" + displayName: 'Configure the benchmarks for ${{ parameters.compiler }}' timeoutInMinutes: 2 env: { TMP: $(tmpDir), TEMP: $(tmpDir) } condition: and(succeeded(), ${{ parameters.buildBenchmarks }}) - script: | call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\Common7\Tools\VsDevCmd.bat" ^ -host_arch=${{ parameters.hostArch }} -arch=${{ parameters.targetArch }} -no_logo - cmake --build "$(benchmarkBuildOutputLocation)" - displayName: 'Build the benchmarks' + cmake --build "$(benchmarkBuildOutputLocation)\${{ parameters.compiler }}" + displayName: 'Build the benchmarks for ${{ parameters.compiler }}' timeoutInMinutes: 2 env: { TMP: $(tmpDir), TEMP: $(tmpDir) } condition: and(succeeded(), ${{ parameters.buildBenchmarks }}) From 28c7f8941d4040743dac099711b5599259b18932 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 29 May 2025 08:22:37 -0700 Subject: [PATCH 6/7] Skip building the benchmarks with Clang for ARM64 or ARM64EC. --- azure-devops/build-benchmarks.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/azure-devops/build-benchmarks.yml b/azure-devops/build-benchmarks.yml index 7dda4a70178..9aef40e89a0 100644 --- a/azure-devops/build-benchmarks.yml +++ b/azure-devops/build-benchmarks.yml @@ -29,7 +29,10 @@ steps: displayName: 'Configure the benchmarks for ${{ parameters.compiler }}' timeoutInMinutes: 2 env: { TMP: $(tmpDir), TEMP: $(tmpDir) } - condition: and(succeeded(), ${{ parameters.buildBenchmarks }}) + # TRANSITION, we currently don't build the benchmarks with Clang for ARM64 or ARM64EC + condition: > + and(succeeded(), ${{ parameters.buildBenchmarks }}, + not(and(eq('${{ parameters.compiler }}', 'clang-cl'), startsWith('${{ parameters.targetPlatform }}', 'arm64')))) - script: | call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\Common7\Tools\VsDevCmd.bat" ^ -host_arch=${{ parameters.hostArch }} -arch=${{ parameters.targetArch }} -no_logo @@ -37,4 +40,7 @@ steps: displayName: 'Build the benchmarks for ${{ parameters.compiler }}' timeoutInMinutes: 2 env: { TMP: $(tmpDir), TEMP: $(tmpDir) } - condition: and(succeeded(), ${{ parameters.buildBenchmarks }}) + # TRANSITION, we currently don't build the benchmarks with Clang for ARM64 or ARM64EC + condition: > + and(succeeded(), ${{ parameters.buildBenchmarks }}, + not(and(eq('${{ parameters.compiler }}', 'clang-cl'), startsWith('${{ parameters.targetPlatform }}', 'arm64')))) From 47d4c98c6db765cd59874f5640f545c6da1af92f Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 29 May 2025 09:46:18 -0700 Subject: [PATCH 7/7] priority_queue_push_range.cpp: Drop putln, use common_args. --- benchmarks/src/priority_queue_push_range.cpp | 34 +++++++------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/benchmarks/src/priority_queue_push_range.cpp b/benchmarks/src/priority_queue_push_range.cpp index 1001aa6c9dc..d2e96bf17a9 100644 --- a/benchmarks/src/priority_queue_push_range.cpp +++ b/benchmarks/src/priority_queue_push_range.cpp @@ -5,7 +5,6 @@ #include #include #include -#include #include #include #include @@ -57,29 +56,20 @@ void BM_push_range(benchmark::State& state) { } } -template -void putln(const benchmark::State&) { - static once_flag f; - call_once(f, [] { puts(""); }); +void common_args(auto bm) { + bm->RangeMultiplier(100)->Range(1, vec_size)->Arg(vec_size / 2 + 1); } -#define TEST_PUSH_RANGE(T, source) \ - BENCHMARK(BM_push_range) \ - ->Setup(putln<__LINE__>) \ - ->RangeMultiplier(100) \ - ->Range(1, vec_size) \ - ->Arg(vec_size / 2 + 1); +BENCHMARK(BM_push_range)->Apply(common_args); +BENCHMARK(BM_push_range)->Apply(common_args); +BENCHMARK(BM_push_range)->Apply(common_args); +BENCHMARK(BM_push_range)->Apply(common_args); +BENCHMARK(BM_push_range)->Apply(common_args); +BENCHMARK(BM_push_range)->Apply(common_args); -TEST_PUSH_RANGE(uint8_t, vec_u8); -TEST_PUSH_RANGE(uint16_t, vec_u16); -TEST_PUSH_RANGE(uint32_t, vec_u32); -TEST_PUSH_RANGE(uint64_t, vec_u64); -TEST_PUSH_RANGE(float, vec_float); -TEST_PUSH_RANGE(double, vec_double); - -TEST_PUSH_RANGE(string_view, vec_str); -TEST_PUSH_RANGE(string, vec_str); -TEST_PUSH_RANGE(wstring_view, vec_wstr); -TEST_PUSH_RANGE(wstring, vec_wstr); +BENCHMARK(BM_push_range)->Apply(common_args); +BENCHMARK(BM_push_range)->Apply(common_args); +BENCHMARK(BM_push_range)->Apply(common_args); +BENCHMARK(BM_push_range)->Apply(common_args); BENCHMARK_MAIN();