Back to home page

EIC code displayed by LXR

 
 

    


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

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