|
11 | 11 | expression that necessitates the temporary object.
|
12 | 12 |
|
13 | 13 | \pnum
|
14 |
| -An evaluation A \defn{contains} an evaluation B if: |
| 14 | +An evaluation \placeholder{A} \defn{contains} an evaluation \placeholder{B} if: |
15 | 15 |
|
16 | 16 | \begin{itemize}
|
17 |
| -\item A and B are not potentially concurrent (\CppXref{intro.races}); and |
18 |
| -\item the start of A is the start of B or the start of A is sequenced before the start of B; and |
19 |
| -\item the completion of B is the completion of A or the completion of B is sequenced before the completion of A. |
| 17 | +\item \placeholder{A} and \placeholder{B} are not potentially concurrent (\CppXref{intro.races}); and |
| 18 | +\item the start of \placeholder{A} is the start of \placeholder{B} or the start of \placeholder{A} is sequenced before the start of \placeholder{B}; and |
| 19 | +\item the completion of \placeholder{B} is the completion of \placeholder{A} or the completion of \placeholder{B} is sequenced before the completion of \placeholder{A}. |
20 | 20 | \end{itemize}
|
21 | 21 |
|
22 | 22 | \begin{note}
|
23 | 23 | This includes evaluations occurring in function invocations.
|
24 | 24 | \end{note}
|
25 | 25 |
|
26 | 26 | \pnum
|
27 |
| -An evaluation A is \defn{ordered before} an evaluation B if A is |
28 |
| -deterministically sequenced before B. \begin{note}If A is indeterminately |
29 |
| -sequenced with respect to B or A and B are unsequenced, then A is not ordered |
30 |
| -before B and B is not ordered before A. The ordered before relationship is |
31 |
| -transitive.\end{note} |
| 27 | +An evaluation \placeholder{A} is \defn{ordered before} an evaluation \placeholder{B} if \placeholder{A} is deterministically sequenced before \placeholder{B}. |
| 28 | +\begin{note}If \placeholder{A} is indeterminately sequenced with respect to \placeholder{B} or \placeholder{A} and \placeholder{B} are unsequenced, then \placeholder{A} is not ordered |
| 29 | +before \placeholder{B} and \placeholder{B} is not ordered before \placeholder{A}. |
| 30 | +The ordered before relationship is transitive.\end{note} |
32 | 31 |
|
33 | 32 | \pnum
|
34 |
| -For an evaluation A ordered before an evaluation B, both contained in the |
35 |
| -same invocation of an element access function, A is a \defn{vertical antecedent} of B if: |
| 33 | +For an evaluation \placeholder{A} ordered before an evaluation \placeholder{B}, both contained in the |
| 34 | +same invocation of an element access function, \placeholder{A} is a \defn{vertical antecedent} of \placeholder{B} if: |
36 | 35 |
|
37 | 36 | \begin{itemize}
|
38 |
| -\item there exists an evaluation S such that: |
| 37 | +\item there exists an evaluation \placeholder{S} such that: |
39 | 38 | \begin{itemize}
|
40 |
| - \item S contains A, and |
41 |
| - \item S contains all evaluations C (if any) such that A is ordered before C and C is ordered before B, |
42 |
| - \item but S does not contain B, and |
| 39 | + \item \placeholder{S} contains \placeholder{A}, and |
| 40 | + \item \placeholder{S} contains all evaluations \placeholder{C} (if any) such that \placeholder{A} is ordered before \placeholder{C} and \placeholder{C} is ordered before \placeholder{B}, |
| 41 | + \item but \placeholder{S} does not contain \placeholder{B}, and |
43 | 42 | \end{itemize}
|
44 |
| -\item control reached B from A without executing any of the following: |
| 43 | +\item control reached \placeholder{B} from \placeholder{A} without executing any of the following: |
45 | 44 | \begin{itemize}
|
46 |
| - \item a \tcode{goto} statement or \tcode{asm} declaration that jumps to a statement outside of S, or |
47 |
| - \item a \tcode{switch} statement executed within S that transfers control into a substatement of a nested selection or iteration statement, or |
| 45 | + \item a \tcode{goto} statement or \tcode{asm} declaration that jumps to a statement outside of \placeholder{S}, or |
| 46 | + \item a \tcode{switch} statement executed within \placeholder{S} that transfers control into a substatement of a nested selection or iteration statement, or |
48 | 47 | \item a \tcode{throw} \begin{note}Even if caught\end{note}, or
|
49 |
| - \item a \tcode{jongjmp}. |
| 48 | + \item a \tcode{longjmp}. |
50 | 49 | \end{itemize}
|
51 | 50 | \end{itemize}
|
52 | 51 |
|
53 | 52 | \begin{note}
|
54 |
| -Vertical antecedent is an irreflexive, antisymmetric, nontransitive relationship between two evaluations. Informally, A is a vertical antecedent of B if A is sequenced immediately before B or A is nested zero or more levels within a statement S that immediately precedes B. |
| 53 | +Vertical antecedent is an irreflexive, antisymmetric, nontransitive relationship between two evaluations. Informally, \placeholder{A} is a vertical antecedent of \placeholder{B} if \placeholder{A} is sequenced immediately before \placeholder{B} or \placeholder{A} is nested zero or more levels within a statement \placeholder{S} that immediately precedes \placeholder{B}. |
55 | 54 | \end{note}
|
56 | 55 |
|
57 | 56 | \pnum
|
|
64 | 63 |
|
65 | 64 | \pnum
|
66 | 65 | \defn{Horizontally matched} is an equivalence relationship between two
|
67 |
| -evaluations of the same expression. An evaluation B\textsubscript{i} is |
68 |
| -\term{horizontally matched} with an evaluation B\textsubscript{j} if: |
| 66 | +evaluations of the same expression. An evaluation $B_i$ is |
| 67 | +\term{horizontally matched} with an evaluation $B_j$ if: |
69 | 68 |
|
70 | 69 | \begin{itemize}
|
71 | 70 | \item both are the first evaluations in their respective applications of the element access function, or
|
72 |
| -\item there exist horizontally matched evaluations A\textsubscript{i} and A\textsubscript{j} that are vertical antecedents of evaluations B\textsubscript{i} and B\textsubscript{j}, respectively. |
| 71 | +\item there exist horizontally matched evaluations $A_i$ and $A_j$ that are vertical antecedents of evaluations $B_i$ and $B_j$, respectively. |
73 | 72 | \end{itemize}
|
74 | 73 |
|
75 | 74 | \begin{note}\term{Horizontally matched} establishes a theoretical \emph{lock-step} relationship between evaluations in different applications of an element access function.\end{note}
|
76 | 75 |
|
77 | 76 | \pnum
|
78 |
| -Let $f$ be a function called for each argument list in a sequence of argument lists. \defn{Wavefront application} of $f$ requires that evaluation A\textsubscript{i} be sequenced before evaluation B\textsubscript{j} if i < j and: |
| 77 | +Let $f$ be a function called for each argument list in a sequence of argument lists. \defn{Wavefront application} of $f$ requires that evaluation $A_i$ be sequenced before evaluation $B_j$ if $i < j$ and: |
79 | 78 |
|
80 | 79 | \begin{itemize}
|
81 |
| -\item A\textsubscript{i} is sequenced before some evaluation B\textsubscript{i} and B\textsubscript{i} is horizontally matched with B\textsubscript{j}, or |
82 |
| -\item A\textsubscript{i} is horizontally matched with some evaluation A\textsubscript{j} and A\textsubscript{j} is sequenced before B\textsubscript{j}. |
| 80 | +\item $A_i$ is sequenced before some evaluation $B_i$ and $B_i$ is horizontally matched with $B_j$, or |
| 81 | +\item $A_i$ is horizontally matched with some evaluation $A_j$ and $A_j$ is sequenced before $B_j$. |
83 | 82 | \end{itemize}
|
84 | 83 |
|
85 | 84 | \begin{note}
|
86 |
| -\term{Wavefront application} guarantees that parallel applications i and j execute such that progress on application j never gets \emph{ahead} of application i. |
| 85 | +\term{Wavefront application} guarantees that parallel applications $i$ and $j$ execute such that progress on application $j$ never gets \emph{ahead} of application $i$. |
87 | 86 | \end{note}
|
88 | 87 | \begin{note}
|
89 |
| -The relationships between A\textsubscript{i} and B\textsubscript{i} and between A\textsubscript{j} and B\textsubscript{j} are \term{sequenced before}, not \term{vertical antecedent}. |
| 88 | +The relationships between $A_i$ and $B_i$ and between $A_j$ and $B_j$ are \term{sequenced before}, not \term{vertical antecedent}. |
90 | 89 | \end{note}
|
91 | 90 |
|
92 | 91 | \rSec1[parallel.alg.ops]{Non-Numeric Parallel Algorithms}
|
|
269 | 268 | extern float x[], y[], a;
|
270 | 269 | float s = 0;
|
271 | 270 | for_loop(execution::vec, 0, n,
|
272 |
| - reduction(s, 0.0f, plus<>()), |
273 |
| - [&](int i, float& accum) { |
274 |
| - y[i] += a*x[i]; |
275 |
| - accum += y[i]*y[i]; |
276 |
| - } |
| 271 | + reduction(s, 0.0f, plus<>()), |
| 272 | + [&](int i, float& accum) { |
| 273 | + y[i] += a*x[i]; |
| 274 | + accum += y[i]*y[i]; |
| 275 | + } |
277 | 276 | );
|
278 | 277 | \end{codeblock}
|
279 | 278 | \end{example}
|
|
372 | 371 |
|
373 | 372 | \begin{itemdescr}
|
374 | 373 | \pnum
|
375 |
| -\effects Evaluates \tcode{std::forward<F>(f)()}. When invoked within an element access function in a parallel algorithm using \tcode{vector_policy}, if two calls to \tcode{no_vec} are horizontally matched within a wavefront application of an element access function over input sequence S, then the execution of \tcode{f} in the application for one element in S is sequenced before the execution of \tcode{f} in the application for a subsequent element in S; otherwise, there is no effect on sequencing. |
| 374 | +\effects Evaluates \tcode{std::forward<F>(f)()}. When invoked within an element access function in a parallel algorithm using \tcode{vector_policy}, if two calls to \tcode{no_vec} are horizontally matched within a wavefront application of an element access function over input sequence \placeholder{S}, then the execution of \tcode{f} in the application for one element in \placeholder{S} is sequenced before the execution of \tcode{f} in the application for a subsequent element in \placeholder{S}; otherwise, there is no effect on sequencing. |
376 | 375 |
|
377 | 376 | \pnum
|
378 | 377 | \returns The result of \tcode{f}.
|
|
382 | 381 |
|
383 | 382 | \begin{example}
|
384 | 383 | \begin{codeblock}
|
| 384 | +extern float y[]; |
385 | 385 | extern int* p;
|
386 |
| -for_loop(vec, 0, n[&](int i) { |
387 |
| - y[i] +=y[i+1]; |
388 |
| - if(y[i] < 0) { |
| 386 | +for_loop(vec, 0, n, [&](int i) { |
| 387 | + y[i] += y[i+1]; |
| 388 | + if (y[i] < 0) { |
389 | 389 | no_vec([]{
|
390 | 390 | *p++ = i;
|
391 | 391 | });
|
|
0 commit comments