Commit aba7f3c
authored
Merge pull request #12183 from ronawho/fence-unordered-ops-task-end
Automatically fence unordered operations at task termination
[reviewed by @gbtitus and @mppf]
Unordered operations must be fenced before operations are guaranteed to be
completed. Previously, the only way to do this was with explicit fences. This
adds implicit/automatic fences to task termination to simplify common cases.
For bale-histogram, previously we did something like:
```chpl
forall r in rindex do
A[r].addBuff(1);
flushAtomicBuff();
```
and now we can simply write:
```chpl
forall r in rindex do
A[r].addBuff(1);
```
To support that, this PR adds a new comm layer routine `chpl_comm_task_end`,
which is a hook that's called on task completion. For ugni we use this to flush
any operations that were buffered as part of an unordered op, and it's
currently a no-op for other comm layers. A more elegant solution might have
been to have some sort of callback interface where module code could register
things to be done on task completion (similar to what we have in the runtime)
but I wasn't quite sure how to do that cheaply and cleanly.
Since we're now calling these fencing operations on every task join, we need
them to be as fast as possible, especially in the no-op case. To support that,
this adds very fast per-task fences. For tasking layers where tasks can't
migrate between threads, this is a non-atomic conditional in the no-op case so
there shouldn't be any noticeable overhead. If there are pending operations, we
only have to lock the current thread so there shouldn't be any contention.
Closes #12065
Closes #12066File tree
18 files changed
+99
-80
lines changed- modules/internal
- runtime
- include
- comm/ugni
- tasks
- fifo
- qthreads
- src
- comm
- gasnet
- none
- ofi
- ugni
- tasks/massivethreads
- test
- release/examples/benchmarks/hpcc/variants
- runtime/configMatters/comm
- studies/bale
- histogram
- indexgather
- third-party/qthread
18 files changed
+99
-80
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1007 | 1007 | | |
1008 | 1008 | | |
1009 | 1009 | | |
| 1010 | + | |
| 1011 | + | |
1010 | 1012 | | |
1011 | 1013 | | |
1012 | 1014 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
38 | 40 | | |
39 | 41 | | |
40 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
| 166 | + | |
166 | 167 | | |
167 | 168 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
492 | 492 | | |
493 | 493 | | |
494 | 494 | | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
495 | 499 | | |
496 | 500 | | |
497 | 501 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
283 | 283 | | |
284 | 284 | | |
285 | 285 | | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | 286 | | |
301 | 287 | | |
302 | 288 | | |
| |||
366 | 352 | | |
367 | 353 | | |
368 | 354 | | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
369 | 371 | | |
370 | 372 | | |
371 | 373 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
| 129 | + | |
139 | 130 | | |
140 | 131 | | |
141 | 132 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
236 | 236 | | |
237 | 237 | | |
238 | 238 | | |
239 | | - | |
240 | 239 | | |
241 | 240 | | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
| 241 | + | |
255 | 242 | | |
256 | 243 | | |
257 | 244 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1586 | 1586 | | |
1587 | 1587 | | |
1588 | 1588 | | |
| 1589 | + | |
1589 | 1590 | | |
1590 | 1591 | | |
1591 | 1592 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
222 | | - | |
223 | | - | |
224 | | - | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
225 | 225 | | |
226 | 226 | | |
227 | 227 | | |
| |||
0 commit comments