[libcxx-commits] [libcxx] [libc++][pstl] Make the serial backend the ultimate fallback for all backends (PR #233421)
via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Oct 19 08:07:14 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libcxx
Author: Michael G. Kazakov (mikekazakov)
<details>
<summary>Changes</summary>
Always fall back to the serial backend as a last resort when an algorithm implementation was not found.
This is a preparation before exposing a bunch of PSTL algorithms we don't currently intend to parallelise.
Fixes #<!-- -->229813
---
Full diff: https://github.com/llvm/llvm-project/pull/233421.diff
2 Files Affected:
- (modified) libcxx/include/__pstl/backend.h (+2)
- (modified) libcxx/include/__pstl/backend_fwd.h (+2-2)
``````````diff
diff --git a/libcxx/include/__pstl/backend.h b/libcxx/include/__pstl/backend.h
index 5980b0708cd34..8708e492fcc23 100644
--- a/libcxx/include/__pstl/backend.h
+++ b/libcxx/include/__pstl/backend.h
@@ -26,10 +26,12 @@ _LIBCPP_PUSH_MACROS
# include <__pstl/backends/serial.h>
# elif defined(_LIBCPP_PSTL_BACKEND_STD_THREAD)
# include <__pstl/backends/default.h>
+# include <__pstl/backends/serial.h>
# include <__pstl/backends/std_thread.h>
# elif defined(_LIBCPP_PSTL_BACKEND_LIBDISPATCH)
# include <__pstl/backends/default.h>
# include <__pstl/backends/libdispatch.h>
+# include <__pstl/backends/serial.h>
# endif
#endif // _LIBCPP_STD_VER >= 17
diff --git a/libcxx/include/__pstl/backend_fwd.h b/libcxx/include/__pstl/backend_fwd.h
index e45943954bed9..8bb23f352c923 100644
--- a/libcxx/include/__pstl/backend_fwd.h
+++ b/libcxx/include/__pstl/backend_fwd.h
@@ -56,10 +56,10 @@ struct __std_thread_backend_tag;
using __current_configuration _LIBCPP_NODEBUG = __backend_configuration<__serial_backend_tag, __default_backend_tag>;
# elif defined(_LIBCPP_PSTL_BACKEND_STD_THREAD)
using __current_configuration _LIBCPP_NODEBUG =
- __backend_configuration<__std_thread_backend_tag, __default_backend_tag>;
+ __backend_configuration<__std_thread_backend_tag, __default_backend_tag, __serial_backend_tag>;
# elif defined(_LIBCPP_PSTL_BACKEND_LIBDISPATCH)
using __current_configuration _LIBCPP_NODEBUG =
- __backend_configuration<__libdispatch_backend_tag, __default_backend_tag>;
+ __backend_configuration<__libdispatch_backend_tag, __default_backend_tag, __serial_backend_tag>;
# else
// ...New vendors can add parallel backends here...
``````````
</details>
https://github.com/llvm/llvm-project/pull/233421
More information about the libcxx-commits
mailing list