aboutsummaryrefslogtreecommitdiff
path: root/libcxx/benchmarks
diff options
context:
space:
mode:
authorLouis Dionne <ldionne.2@gmail.com>2024-06-12 12:24:34 -0400
committerGitHub <noreply@github.com>2024-06-12 12:24:34 -0400
commit9540950a45eee79a3ae4e9e0fa92d72b703d14dd (patch)
treef63c704c50de9543c5d9fd17e2bf4c25d4b00556 /libcxx/benchmarks
parent11399028ba2d74de770f46e7044ee0f008b01778 (diff)
downloadllvm-9540950a45eee79a3ae4e9e0fa92d72b703d14dd.zip
llvm-9540950a45eee79a3ae4e9e0fa92d72b703d14dd.tar.gz
llvm-9540950a45eee79a3ae4e9e0fa92d72b703d14dd.tar.bz2
[libc++] Overhaul the PSTL dispatching mechanism (#88131)
The experimental PSTL's current dispatching mechanism was designed with flexibility in mind. However, while reviewing the in-progress OpenMP backend, I realized that the dispatching mechanism based on ADL and default definitions in the frontend had several downsides. To name a few: 1. The dispatching of an algorithm to the back-end and its default implementation is bundled together via `_LIBCPP_PSTL_CUSTOMIZATION_POINT`. This makes the dispatching really confusing and leads to annoyances such as variable shadowing and weird lambda captures in the front-end. 2. The distinction between back-end functions and front-end algorithms is not as clear as it could be, which led us to call one where we meant the other in a few cases. This is bad due to the exception requirements of the PSTL: calling a front-end algorithm inside the implementation of a back-end is incorrect for exception-safety. 3. There are two levels of back-end dispatching in the PSTL, which treat CPU backends as a special case. This was confusing and not as flexible as we'd like. For example, there was no straightforward way to dispatch all uses of `unseq` to a specific back-end from the OpenMP backend, or for CPU backends to fall back on each other. This patch rewrites the backend dispatching mechanism to solve these problems, but doesn't touch any of the actual implementation of algorithms. Specifically, this rewrite has the following characteristics: - There is a single level of backend dispatching, however partial backends can be stacked to provide a full implementation of the PSTL. The two-level dispatching that was used for CPU-based backends is handled by providing CPU-based basis operations as simple helpers that can easily be reused when defining any PSTL backend. - The default definitions for algorithms are separated from their dispatching logic. - The front-end is thus simplified a whole lot and made very consistent for all algorithms, which makes it easier to audit the front-end for things like exception-correctness, appropriate forwarding, etc. Fixes #70718
Diffstat (limited to 'libcxx/benchmarks')
-rw-r--r--libcxx/benchmarks/algorithms/pstl.stable_sort.bench.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/libcxx/benchmarks/algorithms/pstl.stable_sort.bench.cpp b/libcxx/benchmarks/algorithms/pstl.stable_sort.bench.cpp
index 9357b87..72541f7 100644
--- a/libcxx/benchmarks/algorithms/pstl.stable_sort.bench.cpp
+++ b/libcxx/benchmarks/algorithms/pstl.stable_sort.bench.cpp
@@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//
#include <algorithm>
+#include <execution>
#include "common.h"