Skip to content

Commit 8a66b42

Browse files
committed
Add P0776R1's changes to unseq & vec
1 parent a1ffcae commit 8a66b42

File tree

1 file changed

+30
-10
lines changed

1 file changed

+30
-10
lines changed

execution_policies.html

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,15 @@ <h1>In general</h1>
4646
</cxx-note>
4747
</cxx-section>
4848
<cxx-section id="parallel.execpol.synopsis">
49-
<h1>Header <code>&lt;experimental/execution_policy&gt;</code> synopsis</h1>
49+
<h1>Header <code>&lt;experimental/execution<del>_policy</del>&gt;</code> synopsis</h1>
5050

5151
<pre>
52-
namespace std {
53-
namespace experimental {
54-
namespace parallel {
55-
inline namespace v2 {
52+
<ins>#include &lt;execution&gt;</ins>
53+
54+
<del>namespace std {</del>
55+
namespace <ins>std::</ins>experimental {
56+
<ins>inline </ins>namespace parallel<ins>ism_v2</ins> {
57+
<del>inline namespace v2 {
5658
<cxx-ref insynopsis="" to="parallel.execpol.type"></cxx-ref>
5759
template&lt;class T&gt; struct is_execution_policy;
5860
template&lt;class T&gt; constexpr bool is_execution_policy_v = is_execution_policy&lt;T&gt;::value;
@@ -68,17 +70,22 @@ <h1>Header <code>&lt;experimental/execution_policy&gt;</code> synopsis</h1>
6870

6971
<cxx-ref insynopsis="" to="parallel.execpol.dynamic"></cxx-ref>
7072
class execution_policy;
71-
73+
</del>
7274
namespace execution {
7375
<cxx-ref insynopsis="" to="parallel.execpol.unseq"></cxx-ref>
7476
class unsequenced_policy;
7577

7678
<cxx-ref insynopsis="" to="parallel.execpol.vec"></cxx-ref>
7779
class vector_policy;
80+
81+
<ins><cxx-ref insynopsis="" to="parallel.execpol.objects"></cxx-ref>
82+
inline constexpr unsequenced_policy unseq{ <i>unspecified</i> };
83+
inline constexpr parallel_policy par{ <i>unspecified</i> };</ins>
7884
}
85+
<del>}</del>
7986
}
8087
}
81-
}
88+
<del>}</del>
8289
</pre>
8390
</cxx-section>
8491
<cxx-section id="parallel.execpol.type">
@@ -142,6 +149,13 @@ <h1>Unsequenced execution policy</h1>
142149

143150
<p>The class <code>unsequenced_policy</code> is an execution policy type used as a unique type to disambiguate parallel algorithm overloading and indicate that a parallel algorithm's execution may be vectorized, e.g., executed on a single thread using instructions that operate on multiple data items.</p>
144151

152+
<p><ins>The invocations of element access functions in parallel algorithms invoked with an execution policy of type <code>unsequenced_policy</code> are permitted to execute in an unordered fashion in the calling thread, unsequenced with respect to one another within the calling thread.
153+
<cxx-note>This means that multiple function object invocations may be interleaved on a single thread.</note></ins></p>
154+
155+
<p><ins><cxx-note>This overrides the usual guarantee from the C++ Standard, <cxx-ref in="cxx" to="intro.execution"></cxx-ref> [intro.execution] that function executions do not overlap with one another.</cxx-note></ins></p>
156+
157+
<p><ins>During the execution of a parallel algorithm with the <code>experimental::execution::unsequenced_policy</code> policy, if the invocation of an element access function exits via an uncaught exception, <code>terminate()</code> shall be called.</ins></p>
158+
145159
</cxx-section>
146160

147161
<cxx-section id="parallel.execpol.vec">
@@ -153,6 +167,10 @@ <h1>Vector execution policy</h1>
153167

154168
<p>The class <code>vector_policy</code> is an execution policy type used as a unique type to disambiguate parallel algorithm overloading and indicate that a parallel algorithm's execution may be vectorized. Additionally, such vectorization will result in an execution that respects the sequencing constraints of wavefront application ([parallel.alg.general.wavefront]). <cxx-note>The implementation thus makes stronger guarantees than for <code>unsequenced_policy</code>, for example.</cxx-note></p>
155169

170+
<p><ins>The invocations of element access functions in parallel algorithms invoked with an execution policy of type <code>vector_policy</code> are permitted to execute in unordered fashion in the calling thread, unsequenced with respect to one another within the calling thread, subject to the sequencing constraints of wavefront application (<cxx-ref to="parallel.alg.general.wavefront"></cxx-ref>) for the last argument to <code>for_loop</code> or <code>for_loop_strided</code>.</ins></p>
171+
172+
<p><ins>During the execution of a parallel algorithm with the <code>experimental::execution::vector_policy</code> policy, if the invocation of an element access function exits via an uncaught exception, <code>terminate()</code> shall be called.</ins></p>
173+
156174
</cxx-section>
157175

158176
<cxx-section id="parallel.execpol.dynamic">
@@ -243,11 +261,13 @@ <h1><code>execution_policy</code> object access</h1>
243261
<h1>Execution policy objects</h1>
244262

245263
<pre>
246-
constexpr sequential_execution_policy seq{};
264+
<del>constexpr sequential_execution_policy seq{};
247265
constexpr parallel_execution_policy par{};
248-
constexpr parallel_vector_execution_policy par_vec{};
266+
constexpr parallel_vector_execution_policy par_vec{};</del>
267+
<ins>constexpr execution::unsequenced_policy unseq{};
268+
constexpr execution::vector_policy vec{};</ins>
249269
</pre>
250270

251-
<p>The header <code>&lt;experimental/execution_policy&gt;</code> declares a global object associated with each type of execution policy defined by this Technical Specification.</p>
271+
<p>The header <code>&lt;experimental/execution<del>_policy</del>&gt;</code> declares a global object associated with each type of execution policy defined by this Technical Specification.</p>
252272
</cxx-section>
253273
</cxx-clause>

0 commit comments

Comments
 (0)