@@ -61,23 +61,24 @@ identifiers.
61
61
A statement using ` cilk_spawn ` is the start of a potentially parallel
62
62
region of code.
63
63
64
- The ` cilk_spawn ` keyword should appear at the start of an expression
65
- statement or after the ` = ` sign of an assignment (or ` += ` , ` -= ` ,
66
- etc.).
64
+ The ` cilk_spawn ` keyword should appear before an expression statement,
65
+ block statement, or after the ` = ` sign of an assignment.
67
66
68
67
``` cilkc
69
68
int x = cilk_spawn f(i++);
70
69
cilk_spawn y[j++] = f(i++);
71
70
cilk_spawn { z[j++] = f(i++); }
72
71
```
73
72
74
- Although the compiler accepts ` cilk_spawn ` before almost any
73
+ Other statements, other than declarations, may also be spawned.
74
+ Although the compiler also accepts ` cilk_spawn ` before almost any
75
75
expression, spawns inside of expressions are unlikely to have the
76
- expected semantics. A future version of the language may explicitly
77
- limit ` cilk_spawn ` to the contexts above, at or near the top of the
78
- parse tree of a statement.
76
+ expected semantics. A future version of the language may require
77
+ ` cilk_spawn ` to precede an expression statement, block statement, or
78
+ right hand sign of an assignment that is the entire body of an
79
+ expression statement.
79
80
80
- A declaration may not begin with ` cilk_spawn ` .
81
+ [ The compiler also accepts ` cilk_spawn; ` . ]
81
82
82
83
### Sync
83
84
@@ -113,6 +114,8 @@ cilk_scope {
113
114
// x, y, and z are usable here because of the implicit sync
114
115
```
115
116
117
+ [ The compiler also accepts ` cilk_scope; ` .]
118
+
116
119
### For
117
120
118
121
A loop written using ` cilk_for ` executes each iteration of its body in
@@ -127,8 +130,8 @@ cilk_for (int i = 0; i < n; ++i)
127
130
128
131
The syntax of a ` cilk_for ` statement is very similar to a C ` for `
129
132
statement except that none of the three items in parentheses may be
130
- omitted. Parallel C++ range ` for ` constructs are not supported in
131
- OpenCilk 2.0.
133
+ omitted. C++ range ` for ` constructs are not supported with ` cilk_for `
134
+ in OpenCilk 2.0.
132
135
133
136
The first statement inside parentheses must declare at least one
134
137
variable.
@@ -176,9 +179,6 @@ can be manually overridden with a pragma:
176
179
The pragma in the example tells the compiler that each group of 128
177
180
consecutive iterations should be executed as a serial loop. If there
178
181
are 1024 loop iterations in total, there are only 8 parallel tasks.
179
- There is guaranteed to be no spawn or sync between the iterations
180
- for ` i=0 ` and ` i=1 ` (assuming ` n ` is at least 2, otherwise there
181
- will be no second iteration).
182
182
183
183
In OpenCilk 2.0 the argument to the grain size pragma must be an
184
184
integer constant in the range 1..2<sup >31</sup >-1.
@@ -217,11 +217,11 @@ In the current version of OpenCilk the callbacks may be omitted in
217
217
contexts other than definition of a variable. This behavior may be
218
218
removed in a future version of OpenCilk.
219
219
220
- In the current version of OpenCilk the arguments to ` cilk_reducer `
221
- are evaluated each time a reducer is created. This behavior may
222
- change in a future version of OpenCilk. For compatibility and
223
- predictable behavior the arguments to ` cilk_reducer ` should not
224
- have side effects.
220
+ In the current version of OpenCilk the arguments to ` cilk_reducer ` are
221
+ evaluated each time a reducer is created but not when a reducer is
222
+ accessed. This behavior may change in a future version of OpenCilk.
223
+ For compatibility and predictable behavior the arguments to
224
+ ` cilk_reducer ` should not have side effects.
225
225
226
226
## Execution of an OpenCilk program
227
227
@@ -394,7 +394,7 @@ series with the continuation of the spawn.
394
394
395
395
### Loops
396
396
397
- Writing ` cilk_for ` instead of ` for ` causes the loop to be rewritten
397
+ Writing ` cilk_for ` instead of ` for ` may cause the loop to be rewritten
398
398
into a loop over an integer range determined before the first
399
399
iteration.
400
400
0 commit comments