You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: affinity/cpp-23/d1436r2.md
+11-14Lines changed: 11 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,10 @@
15
15
16
16
# Changelog
17
17
18
+
### P1436r2 (BEL 2019)
19
+
20
+
* Alter the wording on the `bulk_execution_affinity_t` properties so they are now hints that request the executor provide a particular pattern of binding, rather than a guarantee.
21
+
18
22
### P1436r1 (COL 2019)
19
23
20
24
* Introduce wording to clarify when two invocations of bulk_execute
We propose an executor property group called `bulk_execution_affinity` which contains the nested properties `none`, `balanced`, `scatter` or `compact`. Each of these properties, if applied to an *executor* enforces a particular guarantee of binding *execution agents* to the *execution resources* associated with the *executor* in a particular pattern.
263
+
We propose an executor property group called `bulk_execution_affinity` which contains the nested properties `none`, `balanced`, `scatter` and `compact`. Each of these properties, if applied to an *executor* provides a hint to the `executor` that requests a particular binding of *execution agents* to the *execution resources* associated with the *executor* in a particular pattern.
260
264
261
265
### Example
262
266
@@ -283,7 +287,7 @@ Below is an example *(Listing 4)* of executing a parallel task over 8 threads us
283
287
284
288
### Proposed Wording
285
289
286
-
The `bulk_execution_affinity_t`property is a behavioral property as defined in P0443 [[22]][p0443] which describes the guarantees an executor provides to the binding of *execution agents* created by a call to `bulk_execute`to the underlying *threads of execution* and to the locality of those *threads of execution*.
290
+
The `bulk_execution_affinity_t`properties are a group of mutually exclusive behavioral properties (as defined in P0443 [[22]][p0443]) which provide a hint to the *executor* to, if possible, bind the *execution agents* created by a bulk invocation from an *executor*, to the underlying *execution resources* in a particular pattern relative to their physical closeness.
287
291
288
292
The `bulk_execution_affinity_t` property provides nested property types and objects as described below, where:
289
293
*`e` denotes an executor object of type `E`,
@@ -293,24 +297,17 @@ The `bulk_execution_affinity_t` property provides nested property types and obje
293
297
294
298
| Nested Property Type | Nested Property Name | Requirements |
|`bulk_execution_affinity_t::none_t`|`bulk_execution_affinity_t::none`| A call to `e.bulk_execute(f, s, sf)` has no requirements on the binding of *execution agents* to the underlying *execution resources*. ||
297
-
|`bulk_execution_affinity_t::scatter_t`|`bulk_execution_scatter_t::scatter`| A call to `e.bulk_execute(f, s, sf)`must bind the created *execution agents* to the underlying *execution resources* (ordered by physical closeness) such that they are distributed equally across the *execution resources* in a round-robin fashion. <br><br> If the execution context associated with `e`fails to bind the created *execution agents*to the underlying *execution resources*then `bulk_execute` must throw an exception. |
298
-
|`bulk_execution_affinity_t::compact_t`|`bulk_execution_compact_t::compact`| A call to `e.bulk_execute(f, s, sf)`must bind the created *execution agents* to the underlying *execution resources* such that they are distributed as close as possible to the *execution resource* of the *thread of execution* which created them. <br><br> If the execution context associated with `e`fails to bind the created *execution agents*to the underlying *execution resources*then `bulk_execute` must throw an exception. |
299
-
| bulk_execution_affinity_t::balanced_t | bulk_execution_balanced_t::balanced | A call to `e.bulk_execute(f, s, sf)`must bind the created *execution agents* to the underlying *execution resources* (ordered by physical closeness) such that they are distributed equally across the *execution resources* in a bin packing fashion. <br><br> If the execution context associated with `e`fails to bind the created *execution agents*to the underlying *execution resources*then `bulk_execute` must throw an exception. |
300
+
|`bulk_execution_affinity_t::none_t`|`bulk_execution_affinity_t::none`| A call to `e.bulk_execute(f, s, sf)` has no requirements on the binding of *execution agents* to the underlying *execution resources*. |
301
+
|`bulk_execution_affinity_t::scatter_t`|`bulk_execution_scatter_t::scatter`| A call to `e.bulk_execute(f, s, sf)`should aim to bind the created *execution agents* to the underlying *execution resources* (ordered by physical closeness) such that they are distributed equally across the *execution resources* in a round-robin fashion. <br><br> If the execution context associated with `e`is not able to bind the *execution agents* to the underlying *execution resources*as requested it should fall back to `bulk_execution_affinity_t::none_t`. |
302
+
|`bulk_execution_affinity_t::compact_t`|`bulk_execution_compact_t::compact`| A call to `e.bulk_execute(f, s, sf)`should aim to bind the created *execution agents* to the underlying *execution resources* such that they are distributed as close as possible to the *execution resource* of the *thread of execution* which created them. <br><br> If the execution context associated with `e`is not able to bind the *execution agents* to the underlying *execution resources*as requested it should fall back to `bulk_execution_affinity_t::none_t`. |
303
+
| bulk_execution_affinity_t::balanced_t | bulk_execution_balanced_t::balanced | A call to `e.bulk_execute(f, s, sf)`should aim to bind the created *execution agents* to the underlying *execution resources* (ordered by physical closeness) such that they are distributed equally across the *execution resources* in a bin packing fashion. <br><br> If the execution context associated with `e`is not able to bind the *execution agents* to the underlying *execution resources*as requested it should fall back to `bulk_execution_affinity_t::none_t`. |
300
304
301
-
> [*Note:* The requirements of the `bulk_execution_affinity_t` nested properties donot enforce a specific binding, simply that the binding follows the requirements set out above and that the pattern is consistent across invocations of the bulk execution functions. *--end note*]
305
+
> [*Note:* An implementation is free to choose how it maps individual work items to the underlying *execution resources*, providing it aims to achieve the requested affinity relationship. *--end note*]
302
306
303
307
> [*Note:* It's expected that the default value of `bulk_execution_affinity_t` for most executors be `bulk_execution_affinity_t::none_t`. *--end note*]
304
308
305
309
> [*Note:* The terms used for the `bulk_execution_affinity_t` nested properties are derived from the OpenMP properties [[33]][openmp-affinity] including the Intel specific balanced affinity binding [[[34]][intel-balanced-affinity] *--end note*]
306
310
307
-
For any two invocations; `e1.bulk_execute(f1, s1, sf1)` and `e2.bulk_execute(f2, s2, sf2)`, the binding of *execution agents* to the underlying *execution resources* must be consistent, if:
308
-
* `e1 == e2`,
309
-
* `execution::query(e1, execution::bulk_execution_affinity) != execution::bulk_execution_affinity.none`, and
310
-
* `s1 == s2`.
311
-
312
-
> [*Note:* If you have two invocation of `bulk_execute` where the binding of *execution agents* to the underlying *execution resources* is guaranteed to be consistent, this can lead to limitations of resource utilization. *--end note*]
313
-
314
311
> [*Note:* If two *executors* `e1` and `e2` invoke a bulk execution function in order, where `execution::query(e1, execution::context) == query(e2, execution::context)` is `true` and `execution::query(e1, execution::bulk_execution_affinity) == query(e2, execution::bulk_execution_affinity)` is `false`, this will likely result in `e1` binding *execution agents* if necessary to achieve the requested affinity pattern and then `e2` rebinding to achieve the new affinity pattern. Rebinding *execution agents* to *execution resources* may take substantial time and may affect performance of subsequent code. *--end note*]
0 commit comments