Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-03 08:13:58

0001 //===----------------------------------------------------------------------===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef _LIBCPP___PSTL_CPU_ALGOS_CPU_TRAITS_H
0010 #define _LIBCPP___PSTL_CPU_ALGOS_CPU_TRAITS_H
0011 
0012 #include <__config>
0013 
0014 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0015 #  pragma GCC system_header
0016 #endif
0017 
0018 _LIBCPP_PUSH_MACROS
0019 #include <__undef_macros>
0020 
0021 #if _LIBCPP_STD_VER >= 17
0022 
0023 _LIBCPP_BEGIN_NAMESPACE_STD
0024 namespace __pstl {
0025 
0026 // __cpu_traits
0027 //
0028 // This traits class encapsulates the basis operations for a CPU-based implementation of the PSTL.
0029 // All the operations in the PSTL can be implemented from these basis operations, so a pure CPU backend
0030 // only needs to customize these traits in order to get an implementation of the whole PSTL.
0031 //
0032 // Basis operations
0033 // ================
0034 //
0035 //  template <class _RandomAccessIterator, class _Functor>
0036 //  optional<__empty> __for_each(_RandomAccessIterator __first, _RandomAccessIterator __last, _Functor __func);
0037 //    - __func must take a subrange of [__first, __last) that should be executed in serial
0038 //
0039 //  template <class _Iterator, class _UnaryOp, class _Tp, class _BinaryOp, class _Reduction>
0040 //  optional<_Tp> __transform_reduce(_Iterator __first, _Iterator __last, _UnaryOp, _Tp __init, _BinaryOp, _Reduction);
0041 //
0042 //  template <class _RandomAccessIterator1,
0043 //            class _RandomAccessIterator2,
0044 //            class _RandomAccessIterator3,
0045 //            class _Compare,
0046 //            class _LeafMerge>
0047 //  optional<_RandomAccessIterator3> __merge(_RandomAccessIterator1 __first1,
0048 //                                           _RandomAccessIterator1 __last1,
0049 //                                           _RandomAccessIterator2 __first2,
0050 //                                           _RandomAccessIterator2 __last2,
0051 //                                           _RandomAccessIterator3 __outit,
0052 //                                           _Compare __comp,
0053 //                                           _LeafMerge __leaf_merge);
0054 //
0055 //  template <class _RandomAccessIterator, class _Comp, class _LeafSort>
0056 //  optional<__empty> __stable_sort(_RandomAccessIterator __first,
0057 //                                  _RandomAccessIterator __last,
0058 //                                  _Comp __comp,
0059 //                                  _LeafSort __leaf_sort);
0060 //
0061 //   void __cancel_execution();
0062 //      Cancel the execution of other jobs - they aren't needed anymore. This is not a binding request,
0063 //      some backends may not actually be able to cancel jobs.
0064 //
0065 //   constexpr size_t __lane_size;
0066 //      Size of SIMD lanes.
0067 //      TODO: Merge this with __native_vector_size from __algorithm/simd_utils.h
0068 //
0069 //
0070 // Exception handling
0071 // ==================
0072 //
0073 // CPU backends are expected to report errors (i.e. failure to allocate) by returning a disengaged `optional` from their
0074 // implementation. Exceptions shouldn't be used to report an internal failure-to-allocate, since all exceptions are
0075 // turned into a program termination at the front-end level. When a backend returns a disengaged `optional` to the
0076 // frontend, the frontend will turn that into a call to `std::__throw_bad_alloc();` to report the internal failure to
0077 // the user.
0078 
0079 template <class _Backend>
0080 struct __cpu_traits;
0081 
0082 } // namespace __pstl
0083 _LIBCPP_END_NAMESPACE_STD
0084 
0085 #endif // _LIBCPP_STD_VER >= 17
0086 
0087 _LIBCPP_POP_MACROS
0088 
0089 #endif // _LIBCPP___PSTL_CPU_ALGOS_CPU_TRAITS_H