[libcxx-commits] [libcxx] Adding Separate OpenMP Offloading Backend to `libcxx/include/__algorithm/pstl_backends` (PR #66968)

via libcxx-commits libcxx-commits at lists.llvm.org
Mon Oct 2 12:43:42 PDT 2023


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 e8a74f2334ed82a422f0779d1b5dbc9550e394fb a5f77527267c5313dc6747ff219de1c828bc968e -- libcxx/include/__algorithm/pstl_backends/gpu_backend.h libcxx/include/__algorithm/pstl_backends/gpu_backends/any_of.h libcxx/include/__algorithm/pstl_backends/gpu_backends/backend.h libcxx/include/__algorithm/pstl_backends/gpu_backends/copy.h libcxx/include/__algorithm/pstl_backends/gpu_backends/fill.h libcxx/include/__algorithm/pstl_backends/gpu_backends/find_if.h libcxx/include/__algorithm/pstl_backends/gpu_backends/for_each.h libcxx/include/__algorithm/pstl_backends/gpu_backends/merge.h libcxx/include/__algorithm/pstl_backends/gpu_backends/omp_offload.h libcxx/include/__algorithm/pstl_backends/gpu_backends/stable_sort.h libcxx/include/__algorithm/pstl_backends/gpu_backends/transform.h libcxx/include/__algorithm/pstl_backends/gpu_backends/transform_reduce.h clang/lib/Headers/__clang_hip_math.h libcxx/include/__algorithm/pstl_backend.h
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libcxx/include/__algorithm/pstl_backends/gpu_backend.h b/libcxx/include/__algorithm/pstl_backends/gpu_backend.h
index 6e35d59e0718..40330d878f5d 100644
--- a/libcxx/include/__algorithm/pstl_backends/gpu_backend.h
+++ b/libcxx/include/__algorithm/pstl_backends/gpu_backend.h
@@ -15,8 +15,8 @@
 
 #if defined(_LIBCPP_PSTL_GPU_OFFLOAD)
 #  include <__algorithm/pstl_backends/gpu_backends/any_of.h>
-#  include <__algorithm/pstl_backends/gpu_backends/fill.h>
 #  include <__algorithm/pstl_backends/gpu_backends/copy.h>
+#  include <__algorithm/pstl_backends/gpu_backends/fill.h>
 #  include <__algorithm/pstl_backends/gpu_backends/find_if.h>
 #  include <__algorithm/pstl_backends/gpu_backends/for_each.h>
 #  include <__algorithm/pstl_backends/gpu_backends/merge.h>
diff --git a/libcxx/include/__algorithm/pstl_backends/gpu_backends/for_each.h b/libcxx/include/__algorithm/pstl_backends/gpu_backends/for_each.h
index db70f0948e40..0dc3dedd822f 100644
--- a/libcxx/include/__algorithm/pstl_backends/gpu_backends/for_each.h
+++ b/libcxx/include/__algorithm/pstl_backends/gpu_backends/for_each.h
@@ -34,8 +34,8 @@ __pstl_for_each(__gpu_backend_tag, _ForwardIterator __first, _ForwardIterator __
   // exceptions and allowing SIMD instructions
   if constexpr (__is_unsequenced_execution_policy_v<_ExecutionPolicy> &&
                 __has_random_access_iterator_category_or_concept<_ForwardIterator>::value
-//                __libcpp_is_contiguous_iterator<_ForwardIterator>::value
-                ) {
+                //                __libcpp_is_contiguous_iterator<_ForwardIterator>::value
+  ) {
     std::__par_backend::__parallel_for_simd_1(__first, __last - __first, __func);
   }
   // Else we fall back to the GPU backend
diff --git a/libcxx/include/__algorithm/pstl_backends/gpu_backends/transform.h b/libcxx/include/__algorithm/pstl_backends/gpu_backends/transform.h
index e26947c93fea..ff471bc245d9 100644
--- a/libcxx/include/__algorithm/pstl_backends/gpu_backends/transform.h
+++ b/libcxx/include/__algorithm/pstl_backends/gpu_backends/transform.h
@@ -38,9 +38,9 @@ _LIBCPP_HIDE_FROM_ABI _ForwardOutIterator __pstl_transform(
   if constexpr (__is_unsequenced_execution_policy_v<_ExecutionPolicy> &&
                 __has_random_access_iterator_category_or_concept<_ForwardIterator>::value &&
                 __has_random_access_iterator_category_or_concept<_ForwardOutIterator>::value
-//                __libcpp_is_contiguous_iterator<_ForwardIterator>::value &&
-//                __libcpp_is_contiguous_iterator<_ForwardOutIterator>::value
-                ) {
+                //                __libcpp_is_contiguous_iterator<_ForwardIterator>::value &&
+                //                __libcpp_is_contiguous_iterator<_ForwardOutIterator>::value
+  ) {
     std::__par_backend::__parallel_for_simd_2(__first, __last - __first, __result, __op);
     return __result + (__last - __first);
   }
diff --git a/libcxx/include/__algorithm/pstl_backends/gpu_backends/transform_reduce.h b/libcxx/include/__algorithm/pstl_backends/gpu_backends/transform_reduce.h
index 50af5f2a35cd..0670b1385523 100644
--- a/libcxx/include/__algorithm/pstl_backends/gpu_backends/transform_reduce.h
+++ b/libcxx/include/__algorithm/pstl_backends/gpu_backends/transform_reduce.h
@@ -71,12 +71,11 @@ _LIBCPP_HIDE_FROM_ABI _Tp __pstl_transform_reduce(
   if constexpr (__is_unsequenced_execution_policy_v<_ExecutionPolicy> &&
                 __has_random_access_iterator_category_or_concept<_ForwardIterator1>::value &&
                 __has_random_access_iterator_category_or_concept<_ForwardIterator2>::value &&
-//                __libcpp_is_contiguous_iterator<_ForwardIterator1>::value &&
-//                __libcpp_is_contiguous_iterator<_ForwardIterator2>::value &&
-//                is_arithmetic_v<_Tp> &&
+                //                __libcpp_is_contiguous_iterator<_ForwardIterator1>::value &&
+                //                __libcpp_is_contiguous_iterator<_ForwardIterator2>::value &&
+                //                is_arithmetic_v<_Tp> &&
                 (__is_trivial_plus_operation<_BinaryOperation1, _Tp, _Tp>::value ||
-                 __is_supported_reduction<_BinaryOperation1, _Tp, _Tp>::value)
-                ) {
+                 __is_supported_reduction<_BinaryOperation1, _Tp, _Tp>::value)) {
     return std::__par_backend::__parallel_for_simd_reduction_2(
         __first1, __first2, __last1 - __first1, __init, __reduce, __transform);
   }
@@ -99,11 +98,11 @@ _LIBCPP_HIDE_FROM_ABI _Tp __pstl_transform_reduce(
     _UnaryOperation __transform) {
   if constexpr (__is_unsequenced_execution_policy_v<_ExecutionPolicy> &&
                 __has_random_access_iterator_category_or_concept<_ForwardIterator>::value
-//                __libcpp_is_contiguous_iterator<_ForwardIterator>::value &&
-//                is_arithmetic_v<_Tp> && true
-//                (__is_trivial_plus_operation<_BinaryOperation, _Tp, _Tp>::value ||
-//                 __is_supported_reduction<_BinaryOperation, _Tp, _Tp>::value)
-                ) {
+                //                __libcpp_is_contiguous_iterator<_ForwardIterator>::value &&
+                //                is_arithmetic_v<_Tp> && true
+                //                (__is_trivial_plus_operation<_BinaryOperation, _Tp, _Tp>::value ||
+                //                 __is_supported_reduction<_BinaryOperation, _Tp, _Tp>::value)
+  ) {
     return std::__par_backend::__parallel_for_simd_reduction_1(
         __first, __last - __first, __init, __reduce, __transform);
   }

``````````

</details>


https://github.com/llvm/llvm-project/pull/66968


More information about the libcxx-commits mailing list