Skip to content

Commit 03cab8a

Browse files
committed
fixes
1 parent 9d635f8 commit 03cab8a

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

src/doc/reference/opencilk-language-reference.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -61,23 +61,24 @@ identifiers.
6161
A statement using `cilk_spawn` is the start of a potentially parallel
6262
region of code.
6363

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.
6766

6867
```cilkc
6968
int x = cilk_spawn f(i++);
7069
cilk_spawn y[j++] = f(i++);
7170
cilk_spawn { z[j++] = f(i++); }
7271
```
7372

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
7575
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.
7980

80-
A declaration may not begin with `cilk_spawn`.
81+
[The compiler also accepts `cilk_spawn;`.]
8182

8283
### Sync
8384

@@ -113,6 +114,8 @@ cilk_scope {
113114
// x, y, and z are usable here because of the implicit sync
114115
```
115116

117+
[The compiler also accepts `cilk_scope;`.]
118+
116119
### For
117120

118121
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)
127130

128131
The syntax of a `cilk_for` statement is very similar to a C `for`
129132
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.
132135

133136
The first statement inside parentheses must declare at least one
134137
variable.
@@ -176,9 +179,6 @@ can be manually overridden with a pragma:
176179
The pragma in the example tells the compiler that each group of 128
177180
consecutive iterations should be executed as a serial loop. If there
178181
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).
182182

183183
In OpenCilk 2.0 the argument to the grain size pragma must be an
184184
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
217217
contexts other than definition of a variable. This behavior may be
218218
removed in a future version of OpenCilk.
219219

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.
225225

226226
## Execution of an OpenCilk program
227227

@@ -394,7 +394,7 @@ series with the continuation of the spawn.
394394

395395
### Loops
396396

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
398398
into a loop over an integer range determined before the first
399399
iteration.
400400

0 commit comments

Comments
 (0)