You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
N4505 is the latest Parallelism TS Working Draft. It contains editorial and technical changes to the Parallelism TS to apply the following revisions:
12
+
N4698 is the proposed working draft of Parallelism TS Version 2. It contains changes to the Parallelism TS as directed by the committee at the Toronto meeting, and editorial changes.
13
13
14
-
* N4274 - Relaxing Packing Rules for Exceptions Thrown by Parallel Algorithms - Proposed Wording (Revision 1)
15
-
* Feature test macro for the Parallelism TS
14
+
N4698 updates the previous draft, N4669, published in the pre-Toronto mailing.
16
15
17
-
N4505 updates the previous draft, N4407, published in the pre-Lenexa mailing.
16
+
# Technical Changes
18
17
19
-
N4507 is document N4505 reformatted as a TS document. It updates N4409, which was published in the pre-Lenexa mailing.
18
+
* Apply P0076R4 - Vector and Wavefront Policies.
20
19
21
-
## Technical Changes
20
+
#Editorial Changes
22
21
23
-
*Applied N4274, which relaxes the exception packaging rules for exceptions thrown by parallel algorithms. Additionally, changed instances of "terminates with (exception)" phrasing to "exits via (exception)", as directed by the Library Working Group.
22
+
*Reformat Table 1 - Feature Test Macro(s), to match the style of the Library Fundamentals TS.
24
23
25
-
* Introduced the feature test macro `__cpp_lib_experimental_parallel_algorithm` for the functionality of the Parallelism TS as directed by SG1.
24
+
# Notes
26
25
27
-
## Editorial Changes
28
-
29
-
* Promoted subsection 1.3.1, which was incorrectly grouped under section 1.3, to section 1.4.
26
+
* The pre-existing content of N4698 has not yet been harmonized with C++17. As a result, this content is named and namespaced inconsistently with the newly applied content of P0076R4. We anticipate that these inconsistencies will be harmonized by a future revision.
27
+
* N4698 contains forward references to `for_loop` and `for_loop_strided`. We anticipate their introduction in a future revision.
Copy file name to clipboardexpand all lines: algorithms.html
+285-2
Original file line number
Diff line number
Diff line change
@@ -88,6 +88,37 @@ <h1>Effect of execution policies on algorithm execution</h1>
88
88
incremented correctly.
89
89
</cxx-example>
90
90
91
+
<ins>
92
+
<p>
93
+
The invocations of element access functions in parallel algorithms invoked with an
94
+
execution policy of type <code>unsequenced_policy</code> are permitted to execute
95
+
in an unordered fashion in the calling thread, unsequenced with respect to one another
96
+
within the calling thread.
97
+
98
+
<cxx-note>
99
+
This means that multiple function object invocations may be interleaved on a single thread.
100
+
</cxx-note>
101
+
<pre>
102
+
</pre>
103
+
104
+
<cxx-note>
105
+
This overrides the usual guarantee from the C++ standard, Section 1.9 [intro.execution] that
106
+
function executions do not interleave with one another.
107
+
</cxx-note>
108
+
</p>
109
+
</ins>
110
+
111
+
<ins>
112
+
<p>
113
+
The invocations of element access functions in parallel algorithms invoked with an
114
+
executino policy of type <code>vector_policy</code> are permitted to execute
115
+
in an unordered fashion in the calling thread, unsequenced with respect to one another
116
+
within the calling thread, subject to the sequencing constraints of wavefront application
117
+
(<cxx-refto="parallel.alg.general.wavefront"></cxx-ref>) for the last argument to
118
+
<code>for_loop</code> or <code>for_loop_strided</code>.
119
+
</p>
120
+
</ins>
121
+
91
122
<p>
92
123
The invocations of element access functions in parallel algorithms invoked with an execution
93
124
policy of type <code>parallel_vector_execution_policy</code>
@@ -163,6 +194,107 @@ <h1>Effect of execution policies on algorithm execution</h1>
163
194
</p>
164
195
</cxx-section>
165
196
197
+
<cxx-sectionid="parallel.alg.general.wavefront">
198
+
<h1>Wavefront Application</h1>
199
+
<ins>
200
+
<p>
201
+
For the purposes of this section, an <i>evaluation</i> is a value computation or side effect of
202
+
an expression, or an execution of a statement. Initialization of a temporary object is considered a
203
+
subexpression of the expression that necessitates the temporary object.
204
+
</p>
205
+
206
+
<p>
207
+
An evaluation A <i>contains</i> an evaluation B if:
208
+
209
+
<ul>
210
+
<li>A and B are not potentially concurrent ([intro.races]); and</li>
211
+
<li>the start of A is the start of B or the start of A is sequenced before the start of B; and</li>
212
+
<li>the completion of B is the completion of A or the completion of B is sequenced before the completion of A.</li>
213
+
</ul>
214
+
215
+
<cxx-note>This includes evaluations occurring in function invocations.</cxx-note>
216
+
</p>
217
+
218
+
<p>
219
+
An evaluation A is <i>ordered before</i> an evaluation B if A is deterministically
220
+
sequenced before B. <cxx-note>If A is indeterminately sequenced with respect to B
221
+
or A and B are unsequenced, then A is not ordered before B and B is not ordered
222
+
before A. The ordered before relationship is transitive.</cxx-note>
223
+
</p>
224
+
225
+
<p>
226
+
For an evaluation A ordered before an evaluation B, both contained in the same
227
+
invocation of an element access function, A is a <i>vertical antecedent</i> of B if:
228
+
229
+
<ul>
230
+
<li>there exists an evaluation S such that:
231
+
<ul>
232
+
<li>S contains A, and</li>
233
+
<li>S contains all evaluations C (if any) such that A is ordered before C and C is ordered before B,</li>
234
+
<li>but S does not contain B, and</li>
235
+
</ul>
236
+
</li>
237
+
<li>
238
+
control reached B from A without executing any of the following:
239
+
<ul>
240
+
<li>a <code>goto</code> statement or <code>asm</code> declaration that jumps to a statement outside of S, or</li>
241
+
<li>a <code>switch</code> statement executed within S that transfers control into a substatement of a nested selection or iteration statement, or</li>
242
+
<li>a <code>throw</code><cxx-note>even if caught</cxx-note>, or</li>
243
+
<li>a <code>longjmp</code>.
244
+
</ul>
245
+
</li>
246
+
</ul>
247
+
248
+
<cxx-note>
249
+
Vertical antecedent is an irreflexive, antisymmetric, nontransitive relationship between two evaluations.
250
+
Informally, A is a vertical antecedent of B if A is sequenced immediately before B or A is nested zero or
251
+
more levels within a statement S that immediately precedes B.
252
+
</cxx-note>
253
+
</p>
254
+
255
+
<p>
256
+
In the following, <i>X<sub>i</sub></i> and <i>X<sub>j</sub></i> refer to evaluations of the <i>same</i> expression
257
+
or statement contained in the application of an element access function corresponding to the i<sup>th</sup> and
258
+
j<sup>th</sup> elements of the input sequence. <cxx-note>There might be several evaluations <i>X<sub>k</sub></i>,
259
+
<i>Y<sub>k</sub></i>, etc. of a single expression or statement in application <i>k</i>, for example, if the
260
+
expression or statement appears in a loop within the element access function.</cxx-note>
261
+
</p>
262
+
263
+
<p>
264
+
<i>Horizontally matched</i> is an equivalence relationship between two evaluations of the same expression. An
265
+
evaluation B<sub>i</sub> is <i>horizontally matched</i> with an evaluation B<sub>j</sub> if:
266
+
267
+
<ul>
268
+
<li>both are the first evaluations in their respective applications of the element access function, or</li>
269
+
<li>there exist horizontally matched evaluations A<sub>i</sub> and A<sub>j</sub> that are vertical antecedents of evaluations B<sub>i</sub> and B<sub>j</sub>, respectively.
270
+
</ul>
271
+
272
+
<cxx-note>
273
+
<i>Horizontally matched</i> establishes a theoretical <i>lock-step</i> relationship between evaluations in different applications of an element access function.
274
+
</cxx-note>
275
+
</p>
276
+
277
+
<p>
278
+
Let <i>f</i> be a function called for each argument list in a sequence of argument lists.
279
+
<i>Wavefront application</i> of <i>f</i> requires that evaluation A<sub>i</sub> be sequenced
280
+
before evaluation B<sub>i</sub> if i < j and and:
281
+
282
+
<ul>
283
+
<li>A<sub>i</sub> is sequenced before some evaluation B<sub>i</sub> and B<sub>i</sub> is horizontally matched with B<sub>j</sub>, or</li>
284
+
<li>A<sub>i</sub> is horizontally matched with some evaluation A<sub>j</sub> and A<sub>j</sub> is sequenced before B<sub>j<sub>.</li>
285
+
</ul>
286
+
287
+
<cxx-note>
288
+
<i>Wavefront application</i> guarantees that parallel applications i and j execute such that progress on application j never gets <i>ahead</i> of application i.
289
+
</cxx-note>
290
+
291
+
<cxx-note>
292
+
The relationships between A<sub>i</sub> and B<sub>i</sub> and between A<sub>j</sub> and B<sub>j</sub> are <i>sequenced before</i>, not <i>vertical antecedent</i>.
0 commit comments