Skip to content

Commit ca1564a

Browse files
author
Mark Hoemmen
committed
Affinity: Include more feedback from PR #70
1 parent b0d00dd commit ca1564a

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

affinity/cpp-20/d0796r3.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -197,13 +197,15 @@ We considered mandating that *execution resources* use reference counting, just
197197
198198
#### What does validity of a resource mean?
199199
200-
Here, we elaborate on what it means for a *resource* to be "valid." This proposal lets users encounter a *resource* either while traversing the *resource topology*, or through a *context* that uses the *resource*. "Viewing" the *resource* in the *resource topology* implies a lower level of "commitment" or "permanence" than using the *resource* in a *context*. In particular,
200+
Here, we elaborate on what it means for a *resource* to be "valid." This proposal lets users encounter a *resource* either while traversing the *resource topology*, or through a *context* that uses the *resource*. "Viewing" the *resource* in the *resource topology* implies a lower level of "commitment" or "permanence" than using the *resource* in a *context*. In particular,
201201
202-
1. It is implementation defined whether any subset of the *resource topology* reflects the current state of the *system*, or just a "snapshot." Ability to iterate a *resource*'s children in the *resource topology* need not imply ability to create a *context* from that *resource*. This may even vary between subsets of the *resource topology*.
203-
2. *Context* creation asserts *resource* validity.
204-
3. Use of a *context* to launch execution asserts *resource* validity.
202+
1. Querying the system topology returns a structure of opaque identifiers, the `execution_resource`s, representing a snapshot of the current state of the *system*.
203+
2. The query may require temporarily initializing underlying resources, but those underlying resources need not stay active after the query.
204+
3. Ability to iterate a *resource*'s children in the *resource topology* need not imply ability to create a *context* from that *resource*.
205+
4. Creating a *context* from a *resource* asserts *resource* validity. If the *resource* is invalid, *context* creation must fail. (Compare to how MPI functions report an error if they are called after `MPI_Finalize` has been called on that process.)
206+
5. Use of a *context* to launch execution asserts *resource* validity, and must thus fail if the *resource* is no longer valid.
205207
206-
Here is a concrete example. Suppose that company "Aleph" makes an accelerator that can be viewed as a *resource*, and that has its own child *resources*. Users must call `Aleph_initialize()` in order to see the accelerator and its children as *resources* in the *resource topology*. Users must call `Aleph_finalize()` when they are done using the accelerator.
208+
Here is a concrete example. Suppose that company "Aleph" makes an accelerator that can be viewed as a *resource*, and that has its own child *resources*. Users must call `Aleph_initialize()` in order to see the accelerator and its children as *resources* in the *resource topology*. Users must call `Aleph_finalize()` when they are done using the accelerator.
207209
208210
Questions:
209211
@@ -214,7 +216,7 @@ Here, we elaborate on what it means for a *resource* to be "valid." This proposa
214216
215217
Answers:
216218
217-
1. Nothing bad may happen. Users must be able to iterate past an invalidated *resource*. If users are iterating a *resource* R's children and one child becomes invalid, that must not invalidate R or the iterators to its children.
219+
1. Nothing bad must happen. Topology queries return a snapshot. Users must be able to iterate past an invalidated *resource*. If users are iterating a *resource* R's children and one child becomes invalid, that must not invalidate R or the iterators to its children.
218220
2. Iterating the children after invalidation of the parent must not be undefined behavior, but the child *resources* remain invalid. Attempts to view and iterate the children of the child *resources* may (but need not) fail.
219221
3. *Context* creation asserts *resource* validity. If the *resource* is invalid, *context* creation must fail. (Compare to how MPI functions report an error if they are called after `MPI_Finalize` has been called on that process.)
220222
4. Use of a *context* in an *executor* to launch execution asserts *resource* validity, and must thus fail if the *resource* is not longer valid.
@@ -274,7 +276,7 @@ An `execution_resource` is a lightweight structure which acts as an identifier t
274276
275277
### System topology
276278

277-
The system topology is made up of a number of system-level `execution_resource`s, which can be queried through `this_system::get_resources` which returns a `std::vector`. A run-time library may initialize the `execution_resource`s available within the system dynamically. However, this must be done before `main` is called, given that after that point, the system topology may not change.
279+
The system topology is made up of a number of system-level `execution_resource`s, which can be queried through `this_system::get_resources` which returns a `std::vector`. A run-time library may initialize the `execution_resource`s available within the system dynamically. However, `this_system::get_resources` must be thread safe and must initialize and finalize any third-party or OS state before returning.
278280

279281
Below *(Listing 3)* is an example of iterating over the system-level resources and printing out their capabilities.
280282

0 commit comments

Comments
 (0)