Skip to content

Commit 3400ab8

Browse files
rarutyunakukanovMikeDvorskiy
authored
[oneDPL] Improve the specification for Parallel API (#450)
* Improve introduction * Add C++ standard aligned execution policies info * Add data placement & transfer clarifications for device policies Co-authored-by: Alexey Kukanov <alexey.kukanov@intel.com> Co-authored-by: Mikhail Dvorskiy <mikhail.dvorskiy@intel.com>
1 parent 5d2118f commit 3400ab8

1 file changed

Lines changed: 51 additions & 8 deletions

File tree

source/elements/oneDPL/source/parallel_api.rst

Lines changed: 51 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,53 @@
55
Parallel API
66
------------
77

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*.
1211

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.
1449

1550
DPC++ Execution Policy
1651
++++++++++++++++++++++
1752

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.
1955

2056
.. code:: cpp
2157
@@ -69,10 +105,16 @@ device_policy class
69105
};
70106
71107
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.
73115

74116
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.
76118

77119
.. code:: cpp
78120
@@ -640,3 +682,4 @@ than an element in the range being searched.
640682
The elements e of [start, end) must be partitioned with respect to the comparator used.
641683

642684
.. _`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

Comments
 (0)