[libcxx-commits] [libcxx] [libc++][PSTL] Introduce cpu traits (PR #88134)
via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Apr 9 07:46:09 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff d022f6b8ff94bb13d12d39f23a3c3e7836e90756 62b2a384ebfcd6cb3e541489f4c43f9deb6aeda3 -- libcxx/include/__pstl/cpu_algos/cpu_traits.h libcxx/include/__algorithm/pstl_backends/cpu_backend.h libcxx/include/__algorithm/pstl_backends/cpu_backends/any_of.h libcxx/include/__algorithm/pstl_backends/cpu_backends/backend.h libcxx/include/__algorithm/pstl_backends/cpu_backends/fill.h libcxx/include/__algorithm/pstl_backends/cpu_backends/find_if.h libcxx/include/__algorithm/pstl_backends/cpu_backends/for_each.h libcxx/include/__algorithm/pstl_backends/cpu_backends/libdispatch.h libcxx/include/__algorithm/pstl_backends/cpu_backends/merge.h libcxx/include/__algorithm/pstl_backends/cpu_backends/serial.h libcxx/include/__algorithm/pstl_backends/cpu_backends/stable_sort.h libcxx/include/__algorithm/pstl_backends/cpu_backends/thread.h libcxx/include/__algorithm/pstl_backends/cpu_backends/transform.h libcxx/include/__algorithm/pstl_backends/cpu_backends/transform_reduce.h libcxx/src/pstl/libdispatch.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/libcxx/include/__algorithm/pstl_backends/cpu_backend.h b/libcxx/include/__algorithm/pstl_backends/cpu_backend.h
index c93139243a..53eae58f96 100644
--- a/libcxx/include/__algorithm/pstl_backends/cpu_backend.h
+++ b/libcxx/include/__algorithm/pstl_backends/cpu_backend.h
@@ -9,7 +9,6 @@
#ifndef _LIBCPP___ALGORITHM_PSTL_BACKENDS_CPU_BACKEND_H
#define _LIBCPP___ALGORITHM_PSTL_BACKENDS_CPU_BACKEND_H
-#include <__config>
#include <__algorithm/pstl_backends/cpu_backends/any_of.h>
#include <__algorithm/pstl_backends/cpu_backends/backend.h>
#include <__algorithm/pstl_backends/cpu_backends/fill.h>
@@ -19,5 +18,6 @@
#include <__algorithm/pstl_backends/cpu_backends/stable_sort.h>
#include <__algorithm/pstl_backends/cpu_backends/transform.h>
#include <__algorithm/pstl_backends/cpu_backends/transform_reduce.h>
+#include <__config>
#endif // _LIBCPP___ALGORITHM_PSTL_BACKENDS_CPU_BACKEND_H
diff --git a/libcxx/include/__pstl/cpu_algos/cpu_traits.h b/libcxx/include/__pstl/cpu_algos/cpu_traits.h
index 5416ac7d1b..e462129f22 100644
--- a/libcxx/include/__pstl/cpu_algos/cpu_traits.h
+++ b/libcxx/include/__pstl/cpu_algos/cpu_traits.h
@@ -36,7 +36,8 @@ namespace __pstl {
// - __func must take a subrange of [__first, __last) that should be executed in serial
//
// template <class _Iterator, class _UnaryOp, class _Tp, class _BinaryOp, class _Reduction>
-// optional<_Tp> __parallel_transform_reduce(_Iterator __first, _Iterator __last, _UnaryOp, _Tp __init, _BinaryOp, _Reduction);
+// optional<_Tp> __parallel_transform_reduce(_Iterator __first, _Iterator __last, _UnaryOp, _Tp __init, _BinaryOp,
+// _Reduction);
//
// template <class _RandomAccessIterator1,
// class _RandomAccessIterator2,
@@ -69,9 +70,10 @@ namespace __pstl {
// ==================
//
// CPU backends are expected to report errors (i.e. failure to allocate) by returning a disengaged `optional` from their
-// implementation. Exceptions shouldn't be used to report an internal failure-to-allocate, since all exceptions are turned
-// into a program termination at the front-end level. When a backend returns a disengaged `optional` to the frontend, the
-// frontend will turn that into a call to `std::__throw_bad_alloc();` to report the internal failure to the user.
+// implementation. Exceptions shouldn't be used to report an internal failure-to-allocate, since all exceptions are
+// turned into a program termination at the front-end level. When a backend returns a disengaged `optional` to the
+// frontend, the frontend will turn that into a call to `std::__throw_bad_alloc();` to report the internal failure to
+// the user.
template <class _Backend>
struct __cpu_traits;
``````````
</details>
https://github.com/llvm/llvm-project/pull/88134
More information about the libcxx-commits
mailing list