|
5 | 5 | Parallel API |
6 | 6 | ------------ |
7 | 7 |
|
8 | | -For all C++ algorithms accepting execution policies (as defined by `C++ Standard`_), oneDPL provides |
9 | | -an implementation for oneAPI devices via :code:`oneapi::dpl::execution::device_policy`. These algorithms |
10 | | -must be capable of processing data in SYCL buffers (passed via :code:`oneapi::dpl::begin/end`) |
11 | | -and in unified shared memory (USM). |
| 8 | +oneDPL provides the set of algorithms with execution policies as defined by the `C++ Standard`_. |
| 9 | +All those algorithms work with *C++ Standard aligned execution policies* and with *DPC++ |
| 10 | +execution policies*. |
12 | 11 |
|
13 | | -oneDPL extends Parallel STL with the following APIs. |
| 12 | +Additionally, oneDPL provides wrapper functions for `SYCL`_ buffers, special iterators, and |
| 13 | +a set of non-standard parallel algortithms. |
| 14 | + |
| 15 | +C++ Standard aligned execution policies |
| 16 | ++++++++++++++++++++++++++++++++++++++++ |
| 17 | + |
| 18 | +oneDPL has the set of execution policies and related utilities that are semantically aligned |
| 19 | +with the C++ Standard: |
| 20 | + |
| 21 | +.. code:: cpp |
| 22 | +
|
| 23 | + // Defined in <oneapi/dpl/execution> |
| 24 | +
|
| 25 | + namespace oneapi { |
| 26 | + namespace dpl { |
| 27 | + namespace execution { |
| 28 | +
|
| 29 | + class sequenced_policy { /*unspecified*/ }; |
| 30 | + class parallel_policy { /*unspecified*/ }; |
| 31 | + class parallel_unsequenced_policy { /*unspecified*/ }; |
| 32 | + class unsequenced_policy { /*unspecified*/ }; |
| 33 | +
|
| 34 | + inline constexpr sequenced_policy seq { /*unspecified*/ }; |
| 35 | + inline constexpr parallel_policy par { /*unspecified*/ }; |
| 36 | + inline constexpr parallel_unsequenced_policy par_unseq { /*unspecified*/ }; |
| 37 | + inline constexpr unsequenced_policy unseq { /*unspecified*/ }; |
| 38 | +
|
| 39 | + template <class T> |
| 40 | + struct is_execution_policy; |
| 41 | +
|
| 42 | + template <class T> |
| 43 | + inline constexpr bool is_execution_policy_v = oneapi::dpl::execution::is_execution_policy<T>::value; |
| 44 | + } |
| 45 | + } |
| 46 | + } |
| 47 | +
|
| 48 | +See "Execution policies" in the `C++ Standard`_ for more information. |
14 | 49 |
|
15 | 50 | DPC++ Execution Policy |
16 | 51 | ++++++++++++++++++++++ |
17 | 52 |
|
18 | | -A DPC++ execution policy specifies where and how an algorithm runs. |
| 53 | +A DPC++ execution policy class :code:`oneapi::dpl::execution::device_policy` specifies |
| 54 | +where and how an algorithm runs. |
19 | 55 |
|
20 | 56 | .. code:: cpp |
21 | 57 |
|
@@ -69,10 +105,16 @@ device_policy class |
69 | 105 | }; |
70 | 106 |
|
71 | 107 | An object of the ``device_policy`` type is associated with a ``sycl::queue`` that is used |
72 | | -to run algorithms on a DPC++ compliant device. |
| 108 | +to run algorithms on a DPC++ compliant device. When an algorithm runs with ``device_policy`` |
| 109 | +it is capable of processing SYCL buffers (passed via :code:`oneapi::dpl::begin/end`), |
| 110 | +data in the host memory and data in Unified Shared Memory (USM), including USM device memory. |
| 111 | +Data placed in the host memory and USM can only be passed to oneDPL algorithms |
| 112 | +as pointers and random access iterators. The way to transfer data from the host memory |
| 113 | +to a device and back is unspecified; per-element data movement to/from a temporary storage |
| 114 | +is a possible valid implementation. |
73 | 115 |
|
74 | 116 | The ``KernelName`` template parameter, also aliased as ``kernel_name`` within the class template, |
75 | | -is to explicitly provide a name for DPC++ kernels executed by an algorithm the policy is passed to. |
| 117 | +is to explicitly provide a name for DPC++ kernels executed by an algorithm the policy is passed to. |
76 | 118 |
|
77 | 119 | .. code:: cpp |
78 | 120 |
|
@@ -640,3 +682,4 @@ than an element in the range being searched. |
640 | 682 | The elements e of [start, end) must be partitioned with respect to the comparator used. |
641 | 683 |
|
642 | 684 | .. _`C++ Standard`: https://isocpp.org/std/the-standard |
| 685 | +.. _`SYCL`: https://registry.khronos.org/SYCL/specs/sycl-2020/html/sycl-2020.html |
0 commit comments