Skip to content

Commit 546b117

Browse files
committed
Eliminate [parallel.alg.{overloads,defns}]
1 parent 599d6f9 commit 546b117

File tree

1 file changed

+71
-277
lines changed

1 file changed

+71
-277
lines changed

algorithms.html

Lines changed: 71 additions & 277 deletions
Original file line numberDiff line numberDiff line change
@@ -1,309 +1,103 @@
11
<cxx-clause id="parallel.alg">
22
<h1>Parallel algorithms</h1>
33

4-
<cxx-section id="parallel.alg.general.wavefront">
5-
<h1>Wavefront Application</h1>
6-
<p>
7-
For the purposes of this section, an <i>evaluation</i> is a value computation or side effect of
8-
an expression, or an execution of a statement. Initialization of a temporary object is considered a
9-
subexpression of the expression that necessitates the temporary object.
10-
</p>
11-
12-
<p>
13-
An evaluation A <i>contains</i> an evaluation B if:
14-
15-
<ul>
16-
<li>A and B are not potentially concurrent ([intro.races]); and</li>
17-
<li>the start of A is the start of B or the start of A is sequenced before the start of B; and</li>
18-
<li>the completion of B is the completion of A or the completion of B is sequenced before the completion of A.</li>
19-
</ul>
20-
21-
<cxx-note>This includes evaluations occurring in function invocations.</cxx-note>
22-
</p>
23-
24-
<p>
25-
An evaluation A is <i>ordered before</i> an evaluation B if A is deterministically
26-
sequenced before B. <cxx-note>If A is indeterminately sequenced with respect to B
27-
or A and B are unsequenced, then A is not ordered before B and B is not ordered
28-
before A. The ordered before relationship is transitive.</cxx-note>
29-
</p>
4+
<cxx-section id="parallel.alg.wavefront">
5+
<h1>Wavefront Application</h1>
6+
<p>
7+
For the purposes of this section, an <i>evaluation</i> is a value computation or side effect of
8+
an expression, or an execution of a statement. Initialization of a temporary object is considered a
9+
subexpression of the expression that necessitates the temporary object.
10+
</p>
3011

31-
<p>
32-
For an evaluation A ordered before an evaluation B, both contained in the same
33-
invocation of an element access function, A is a <i>vertical antecedent</i> of B if:
12+
<p>
13+
An evaluation A <i>contains</i> an evaluation B if:
3414

35-
<ul>
36-
<li>there exists an evaluation S such that:
37-
<ul>
38-
<li>S contains A, and</li>
39-
<li>S contains all evaluations C (if any) such that A is ordered before C and C is ordered before B,</li>
40-
<li>but S does not contain B, and</li>
41-
</ul>
42-
</li>
43-
<li>
44-
control reached B from A without executing any of the following:
45-
<ul>
46-
<li>a <code>goto</code> statement or <code>asm</code> declaration that jumps to a statement outside of S, or</li>
47-
<li>a <code>switch</code> statement executed within S that transfers control into a substatement of a nested selection or iteration statement, or</li>
48-
<li>a <code>throw</code> <cxx-note>even if caught</cxx-note>, or</li>
49-
<li>a <code>longjmp</code>.
50-
</ul>
51-
</li>
52-
</ul>
15+
<ul>
16+
<li>A and B are not potentially concurrent ([intro.races]); and</li>
17+
<li>the start of A is the start of B or the start of A is sequenced before the start of B; and</li>
18+
<li>the completion of B is the completion of A or the completion of B is sequenced before the completion of A.</li>
19+
</ul>
5320

54-
<cxx-note>
55-
Vertical antecedent is an irreflexive, antisymmetric, nontransitive relationship between two evaluations.
56-
Informally, A is a vertical antecedent of B if A is sequenced immediately before B or A is nested zero or
57-
more levels within a statement S that immediately precedes B.
58-
</cxx-note>
59-
</p>
21+
<cxx-note>This includes evaluations occurring in function invocations.</cxx-note>
22+
</p>
6023

61-
<p>
62-
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
63-
or statement contained in the application of an element access function corresponding to the i<sup>th</sup> and
64-
j<sup>th</sup> elements of the input sequence. <cxx-note>There might be several evaluations <i>X<sub>k</sub></i>,
65-
<i>Y<sub>k</sub></i>, etc. of a single expression or statement in application <i>k</i>, for example, if the
66-
expression or statement appears in a loop within the element access function.</cxx-note>
67-
</p>
24+
<p>
25+
An evaluation A is <i>ordered before</i> an evaluation B if A is deterministically
26+
sequenced before B. <cxx-note>If A is indeterminately sequenced with respect to B
27+
or A and B are unsequenced, then A is not ordered before B and B is not ordered
28+
before A. The ordered before relationship is transitive.</cxx-note>
29+
</p>
6830

69-
<p>
70-
<i>Horizontally matched</i> is an equivalence relationship between two evaluations of the same expression. An
71-
evaluation B<sub>i</sub> is <i>horizontally matched</i> with an evaluation B<sub>j</sub> if:
31+
<p>
32+
For an evaluation A ordered before an evaluation B, both contained in the same
33+
invocation of an element access function, A is a <i>vertical antecedent</i> of B if:
7234

35+
<ul>
36+
<li>there exists an evaluation S such that:
7337
<ul>
74-
<li>both are the first evaluations in their respective applications of the element access function, or</li>
75-
<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.
38+
<li>S contains A, and</li>
39+
<li>S contains all evaluations C (if any) such that A is ordered before C and C is ordered before B,</li>
40+
<li>but S does not contain B, and</li>
7641
</ul>
77-
78-
<cxx-note>
79-
<i>Horizontally matched</i> establishes a theoretical <i>lock-step</i> relationship between evaluations in different applications of an element access function.
80-
</cxx-note>
81-
</p>
82-
83-
<p>
84-
Let <i>f</i> be a function called for each argument list in a sequence of argument lists.
85-
<i>Wavefront application</i> of <i>f</i> requires that evaluation A<sub>i</sub> be sequenced
86-
before evaluation B<sub>i</sub> if i &lt; j and and:
87-
42+
</li>
43+
<li>
44+
control reached B from A without executing any of the following:
8845
<ul>
89-
<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>
90-
<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>
46+
<li>a <code>goto</code> statement or <code>asm</code> declaration that jumps to a statement outside of S, or</li>
47+
<li>a <code>switch</code> statement executed within S that transfers control into a substatement of a nested selection or iteration statement, or</li>
48+
<li>a <code>throw</code> <cxx-note>even if caught</cxx-note>, or</li>
49+
<li>a <code>longjmp</code>.
9150
</ul>
51+
</li>
52+
</ul>
9253

93-
<cxx-note>
94-
<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.
95-
</cxx-note>
96-
97-
<cxx-note>
98-
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>.
99-
</cxx-note>
100-
</p>
101-
</cxx-section>
102-
103-
<cxx-section id="parallel.alg.overloads">
104-
<h1><del><code>ExecutionPolicy</code> algorithm overloads</del></h1>
105-
106-
<del>
107-
<p>
108-
The Parallel Algorithms Library provides overloads for each of the algorithms named in
109-
Table 1, corresponding to the algorithms with the same name in the C++ Standard Algorithms Library.
110-
111-
For each algorithm in <cxx-ref to="tab.parallel.algorithms"></cxx-ref>, if there are overloads for
112-
corresponding algorithms with the same name
113-
in the C++ Standard Algorithms Library,
114-
the overloads shall have an additional template type parameter named
115-
<code>ExecutionPolicy</code>, which shall be the first template parameter.
116-
117-
In addition, each such overload shall have the new function parameter as the
118-
first function parameter of type <code>ExecutionPolicy&amp;&amp;</code>.
119-
</p>
120-
</del>
121-
122-
<del>
123-
<p>
124-
Unless otherwise specified, the semantics of <code>ExecutionPolicy</code> algorithm overloads
125-
are identical to their overloads without.
126-
</p>
127-
</del>
128-
129-
<del>
130-
<p>
131-
Parallel algorithms shall not participate in overload resolution unless
132-
<code>is_execution_policy&lt;decay_t&lt;ExecutionPolicy&gt;&gt;::value</code> is <code>true</code>.
133-
</p>
134-
</del>
135-
136-
<del>
137-
<table is="cxx-table" id="tab.parallel.algorithms" class="list">
138-
<caption><del>Table of parallel algorithms</del></caption>
139-
<tr>
140-
<td><code>adjacent_difference</code></td>
141-
<td><code>adjacent_find</code></td>
142-
<td><code>all_of</code></td>
143-
<td><code>any_of</code></td>
144-
</tr>
145-
<tr>
146-
<td><code>copy</code></td>
147-
<td><code>copy_if</code></td>
148-
<td><code>copy_n</code></td>
149-
<td><code>count</code></td>
150-
</tr>
151-
<tr>
152-
<td><code>count_if</code></td>
153-
<td><code>equal</code></td>
154-
<td><code>exclusive_scan</code></td>
155-
<td><code>fill</code></td>
156-
</tr>
157-
<tr>
158-
<td><code>fill_n</code></td>
159-
<td><code>find</code></td>
160-
<td><code>find_end</code></td>
161-
<td><code>find_first_of</code></td>
162-
</tr>
163-
<tr>
164-
<td><code>find_if</code></td>
165-
<td><code>find_if_not</code></td>
166-
<td><code>for_each</code></td>
167-
<td><code>for_each_n</code></td>
168-
</tr>
169-
<tr>
170-
<td><code>generate</code></td>
171-
<td><code>generate_n</code></td>
172-
<td><code>includes</code></td>
173-
<td><code>inclusive_scan</code></td>
174-
</tr>
175-
<tr>
176-
<td><code>inner_product</code></td>
177-
<td><code>inplace_merge</code></td>
178-
<td><code>is_heap</code></td>
179-
<td><code>is_heap_until</code></td>
180-
</tr>
181-
<tr>
182-
<td><code>is_partitioned</code></td>
183-
<td><code>is_sorted</code></td>
184-
<td><code>is_sorted_until</code></td>
185-
<td><code>lexicographical_compare</code></td>
186-
</tr>
187-
<tr>
188-
<td><code>max_element</code></td>
189-
<td><code>merge</code></td>
190-
<td><code>min_element</code></td>
191-
<td><code>minmax_element</code></td>
192-
</tr>
193-
<tr>
194-
<td><code>mismatch</code></td>
195-
<td><code>move</code></td>
196-
<td><code>none_of</code></td>
197-
<td><code>nth_element</code></td>
198-
</tr>
199-
<tr>
200-
<td><code>partial_sort</code></td>
201-
<td><code>partial_sort_copy</code></td>
202-
<td><code>partition</code></td>
203-
<td><code>partition_copy</code></td>
204-
</tr>
205-
<tr>
206-
<td><code>reduce</code></td>
207-
<td><code>remove</code></td>
208-
<td><code>remove_copy</code></td>
209-
<td><code>remove_copy_if</code></td>
210-
</tr>
211-
<tr>
212-
<td><code>remove_if</code></td>
213-
<td><code>replace</code></td>
214-
<td><code>replace_copy</code></td>
215-
<td><code>replace_copy_if</code></td>
216-
</tr>
217-
<tr>
218-
<td><code>replace_if</code></td>
219-
<td><code>reverse</code></td>
220-
<td><code>reverse_copy</code></td>
221-
<td><code>rotate</code></td>
222-
</tr>
223-
<tr>
224-
<td><code>rotate_copy</code></td>
225-
<td><code>search</code></td>
226-
<td><code>search_n</code></td>
227-
<td><code>set_difference</code></td>
228-
</tr>
229-
<tr>
230-
<td><code>set_intersection</code></td>
231-
<td><code>set_symmetric_difference</code></td>
232-
<td><code>set_union</code></td>
233-
<td><code>sort</code></td>
234-
</tr>
235-
<tr>
236-
<td><code>stable_partition</code></td>
237-
<td><code>stable_sort</code></td>
238-
<td><code>swap_ranges</code></td>
239-
<td><code>transform</code></td>
240-
</tr>
241-
<tr>
242-
<td><code>transform_exclusive_scan</code></td>
243-
<td><code>transform_inclusive_scan</code></td>
244-
<td><code>transform_reduce</code></td>
245-
<td><code>uninitialized_copy</code></td>
246-
</tr>
247-
<tr>
248-
<td><code>uninitialized_copy_n</code></td>
249-
<td><code>uninitialized_fill</code></td>
250-
<td><code>uninitialized_fill_n</code></td>
251-
<td><code>unique</code></td>
252-
</tr>
253-
<tr>
254-
<td><code>unique_copy</code></td>
255-
<td></td>
256-
<td></td>
257-
<td></td>
258-
</tr>
259-
</table>
260-
</del>
261-
262-
<del>
26354
<cxx-note>
264-
Not all algorithms in the Standard Library have counterparts in <cxx-ref to="tab.parallel.algorithms"></cxx-ref>.
55+
Vertical antecedent is an irreflexive, antisymmetric, nontransitive relationship between two evaluations.
56+
Informally, A is a vertical antecedent of B if A is sequenced immediately before B or A is nested zero or
57+
more levels within a statement S that immediately precedes B.
26558
</cxx-note>
266-
</del>
267-
</cxx-section>
268-
</cxx-section>
59+
</p>
26960

270-
<cxx-section id="parallel.alg.defns">
271-
<h1><del>Definitions</del></h1>
61+
<p>
62+
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
63+
or statement contained in the application of an element access function corresponding to the i<sup>th</sup> and
64+
j<sup>th</sup> elements of the input sequence. <cxx-note>There might be several evaluations <i>X<sub>k</sub></i>,
65+
<i>Y<sub>k</sub></i>, etc. of a single expression or statement in application <i>k</i>, for example, if the
66+
expression or statement appears in a loop within the element access function.</cxx-note>
67+
</p>
27268

273-
<del>
27469
<p>
275-
Define <code><em>GENERALIZED_SUM</em>(op, a1, ..., aN)</code> as follows:
70+
<i>Horizontally matched</i> is an equivalence relationship between two evaluations of the same expression. An
71+
evaluation B<sub>i</sub> is <i>horizontally matched</i> with an evaluation B<sub>j</sub> if:
27672

27773
<ul>
278-
<li><code>a1</code> when <code>N</code> is <code>1</code></li>
279-
280-
<li>
281-
<code>op(<em>GENERALIZED_SUM</em>(op, b1, ..., bK)</code>, <code><em>GENERALIZED_SUM</em>(op, bM, ..., bN))</code> where
282-
283-
<ul>
284-
<li><code>b1, ..., bN</code> may be any permutation of <code>a1, ..., aN</code> and</li>
285-
286-
<li><code>1 &lt; K+1 = M &le; N</code>.</li>
287-
</ul>
288-
</li>
74+
<li>both are the first evaluations in their respective applications of the element access function, or</li>
75+
<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.
28976
</ul>
77+
78+
<cxx-note>
79+
<i>Horizontally matched</i> establishes a theoretical <i>lock-step</i> relationship between evaluations in different applications of an element access function.
80+
</cxx-note>
29081
</p>
291-
</del>
29282

293-
<del>
29483
<p>
295-
Define <code><em>GENERALIZED_NONCOMMUTATIVE_SUM</em>(op, a1, ..., aN)</code> as follows:
84+
Let <i>f</i> be a function called for each argument list in a sequence of argument lists.
85+
<i>Wavefront application</i> of <i>f</i> requires that evaluation A<sub>i</sub> be sequenced
86+
before evaluation B<sub>i</sub> if i &lt; j and and:
29687

29788
<ul>
298-
<li><code>a1</code> when <code>N</code> is <code>1</code></li>
299-
300-
<li>
301-
<code>op(<em>GENERALIZED_NONCOMMUTATIVE_SUM</em>(op, a1, ..., aK), <em>GENERALIZED_NONCOMMUTATIVE_SUM</em>(op, aM, </code><br>
302-
<code>..., aN)</code> where <code>1 &lt; K+1 = M &le; N</code>.
303-
</li>
89+
<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>
90+
<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>
30491
</ul>
92+
93+
<cxx-note>
94+
<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.
95+
</cxx-note>
96+
97+
<cxx-note>
98+
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>.
99+
</cxx-note>
305100
</p>
306-
</del>
307101
</cxx-section>
308102

309103
<cxx-section id="parallel.alg.ops">

0 commit comments

Comments
 (0)