Skip to content

Commit 3a81c45

Browse files
GordonGordon
authored andcommitted
Issue #41: Make minor changes based on feedback.
1 parent f57d954 commit 3a81c45

File tree

1 file changed

+23
-22
lines changed

1 file changed

+23
-22
lines changed

affinity/cpp-20/d0796r3.md

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -305,13 +305,13 @@ Below *(Figure 2)* is an example of what a typical **system topology** could loo
305305

306306
An `execution_resource` is a lightweight structure which identifies a particular **execution resource** within a snapshot of the **system topology**. It can be queried for a name via `name`.
307307

308-
An `execution_resource` object can be queried for a pointer to it's parent `execution_resource` via `member_of`, and can also iterate over it's children `execution_resource`s via `begin` and `end` or access a particular child via `operator[]`.
308+
An `execution_resource` object can be queried for a pointer to its parent `execution_resource` via `member_of`, and can also iterate over its children `execution_resource`s via `begin` and `end` or access a particular child via `operator[]`.
309309

310310
An `execution_resource` object can also be queried for the amount concurrency it can provide, the total number of **threads of execution** supported by the associated **execution resource**.
311311

312312
An `execution_resource` object can be queried for a pointer to the root `memory_resource` representing the **memory resource** which the associated **execution resource** can access via `memory_resource`.
313313

314-
> [*Note:* There may be a number of **memory resources** which an **execution resource** can access, but the `memory_resource` pointer returned from `memory_resource` should represent the most course grained of these. We may want to expand on this interface in the future. *--end note*]
314+
> [*Note:* There may be a number of **memory resources** which an **execution resource** can access, but the `memory_resource` pointer returned from `memory_resource` should represent the most coarse grained of these. We may want to expand on this interface in the future. *--end note*]
315315
316316
Below *(Listing 3)* is an example of iterating over every **execution resource** within the **system topology**.
317317

@@ -335,15 +335,15 @@ int main(int argc, char * argv[]) {
335335
336336
An `memory_resource` is a lightweight structure which inherits from `pmr::memory_resource` and identifies a particular **memory resource** within a snapshot of the **system topology**. It can be queried for a name via `name`.
337337
338-
A `memory_resource` object can be queried for a pointer to it's parent `memory_resource` via `member_of`, and can also iterate over it's children `memory_resource`s via `begin` and `end` or access a particular child via `operator[]`.
338+
A `memory_resource` object can be queried for a pointer to its parent `memory_resource` via `member_of`, and can also iterate over its children `memory_resource`s via `begin` and `end` or access a particular child via `operator[]`.
339339
340340
An allocator capable of allocating memory in the memory region of the **memory resource** represented by a `memory_resource` object by constructing a `pmr::polymorphic_allocator` from the `memory_resource` object.
341341
342342
### Querying relative affinity
343343
344344
The `affinity_query` class template provides an abstraction of the relative affinity between an `execution_resource` and a `memory_resource` for a particular `affinity_operation` and `affinity_metric`. The `affinity_query` takes the `affinity_operation` and `affinity_metric` as template parameters, and is constructed from an `execution_resource` and a `memory_resource`.
345345
346-
An `affinity_query` is not generally not meaningful on its own. Instead, users are meant to compare two `affinity_query`s via comparison operators, in order to get a relative magnitude of affinity. If necessary, the underlying value of an `affinity_query` can be queried through `native_affinity`, though the return value of this is implementation defined.
346+
An `affinity_query` is not generally meaningful on its own. Instead, users are meant to compare two `affinity_query`s via comparison operators, in order to get a relative magnitude of affinity. If necessary, the underlying value of an `affinity_query` can be queried through `native_affinity`, though the return value of this is implementation defined.
347347
348348
Below *(listing 4)* is an example of how to query the relative affinity between an `execution_resource` and a `memory_resource`.
349349
@@ -384,24 +384,25 @@ When creating an `execution_context` from a given `execution_resource`, the exec
384384
```cpp
385385
auto systemResource = std::this_system::discover_topology();
386386
387-
/* find_socket_resource is a user-defined function that finds a resource that is a CPU socket in the given resource list */
387+
// find_socket_resource is a user-defined function that finds a resource that is
388+
// a CPU socket in the given resource list
388389
auto socket = find_socket_resource(systemResource);
389390
390-
/* Create an execution_context and executor associated with the CPU socket */
391-
execution_context context{socket}
391+
// Create an execution_context and executor associated with the CPU socket
392+
execution_context context{socket};
392393
auto executor = context.executor();
393394
394-
/* Create an allocator from the memory resource associate with the GPU socket */
395+
// Create an allocator from the memory resource associated with the GPU socket
395396
pmr::polymorphic_allocator<int> alloc{socket.memory_resource()};
396397
397398
pmr::vector<int> vec(100, alloc);
398-
std::generate(par.on(executor), std::begin(vec), std::end(vec), std::rand);
399+
std::generate(par.on(executor), std::begin(vec), std::end(vec), genFunc);
399400
```
400401
*Listing 6: Example of executing and allocating with affinity*
401402

402-
The construction of an `execution_context` on an `execution_resource` implies affinity (where possible) to the given resource. This guarantees that all executors created from that `execution_context` can access the resources and the internal data structures requires to guarantee the placement of the processor.
403+
The construction of an `execution_context` on an `execution_resource` implies affinity (where possible) to the given resource. This guarantees that all executors created from that `execution_context` can access the resources and the internal data structures required to guarantee the binding of execution agents.
403404

404-
Only developers that care about resource placement need to care about obtaining executorsfrom the correct `execution_context` object. Existing code for vectors and STL (including the Parallel STL interface) remains unaffected.
405+
Only developers that care about resource placement need to care about obtaining executors from the correct `execution_context` object. Existing code for vectors and STL (including the Parallel STL interface) remains unaffected.
405406

406407
If a particular policy or algorithm requires to access placement information, the resources associated with the passed executor can be retrieved via the link to the `execution_context`.
407408

@@ -506,7 +507,7 @@ The `execution_resource` which underlies the current thread of execution can be
506507

507508
~execution_context();
508509

509-
const execution_resource &resource() const noexcept;
510+
execution_resource &resource() const noexcept;
510511

511512
executor_type executor() const;
512513

@@ -544,13 +545,13 @@ The `execution_resource` which underlies the current thread of execution can be
544545
/* This system */
545546

546547
namespace this_system {
547-
const execution_resource discover_topology();
548+
execution_resource discover_topology();
548549
}
549550

550551
/* This thread */
551552

552553
namespace this_thread {
553-
const std::experimental::execution::execution_resource get_resource() noexcept;
554+
std::experimental::execution::execution_resource get_resource() noexcept;
554555
}
555556

556557
} // experimental
@@ -587,11 +588,11 @@ The `execution_resource` class provides an abstraction over an **execution resou
587588

588589
iterator
589590

590-
*Requires:* `iterator` to model `RandomAccessIterator` with the value type `execution_resource::value_type`.
591+
*Requires:* `iterator` satisfies the `Cpp17RandomAccessIterator` requirements and `is_same_v<iterator_traits<iterator>::value_type, execution_resource::value_type>` is well-formed and resolves to `true`.
591592

592593
const_iterator
593594

594-
*Requires:* `const_iterator` to model `RandomAccessIterator` with the value type `execution_resource::value_type`.
595+
*Requires:* `const_iterator` satisfies the `Cpp17RandomAccessIterator` requirements and `is_same_v<iterator_traits<const_iterator>::value_type, execution_resource::value_type>` is well-formed and resolves to `true`.
595596

596597
### `execution_resource` constructors
597598

@@ -642,7 +643,7 @@ The `execution_resource` class provides an abstraction over an **execution resou
642643

643644
## Class `memory_resource`
644645

645-
The `memory_resource` class provides an abstraction which represents a **memory resource**, that can allocate memory. A `memory_resource` can represent further `memory_resource`s. We say that these `ememory_resource`s are *members of* this `memory_resource`.
646+
The `memory_resource` class provides an abstraction which represents a **memory resource**, that can allocate memory. A `memory_resource` can represent further `memory_resource`s. We say that these `memory_resource`s are *members of* this `memory_resource`.
646647

647648
The `memory_resource` class must inherit from the `pmr::memory_resource` class.
648649

@@ -652,11 +653,11 @@ The `memory_resource` class must inherit from the `pmr::memory_resource` class.
652653

653654
iterator
654655

655-
*Requires:* `iterator` to model `RandomAccessIterator` with the value type `memory_resource::value_type`.
656+
*Requires:* `iterator` satisfies the `Cpp17RandomAccessIterator` requirements and `is_same_v<iterator_traits<iterator>::value_type, execution_resource::value_type>` is well-formed and resolves to `true`.
656657

657658
const_iterator
658659

659-
*Requires:* `const_iterator` to model `RandomAccessIterator` with the value type `memory_resource::value_type`.
660+
*Requires:* `const_iterator` satisfies the `Cpp17RandomAccessIterator` requirements and `is_same_v<iterator_traits<const_iterator>::value_type, execution_resource::value_type>` is well-formed and resolves to `true`.
660661

661662
### `memory_resource` constructors
662663

@@ -725,7 +726,7 @@ The `execution_context` class provides an abstraction for managing a number of l
725726

726727
### `execution_context` operators
727728

728-
const execution_resource &resource() const noexcept;
729+
execution_resource &resource() const noexcept;
729730

730731
*Returns:* A const-reference to the *contained resource*.
731732

@@ -784,7 +785,7 @@ The `affinity_query` class template provides an abstraction for a relative affin
784785

785786
The free function `this_system::discover_topology` is provided for discovering the **system topology**.
786787

787-
const execution_resource discover_topology();
788+
execution_resource discover_topology();
788789

789790
*Returns:* An `execution_resource` object exposing the **system execution resource**.
790791

@@ -798,7 +799,7 @@ The free function `this_system::discover_topology` is provided for discovering t
798799

799800
The free function `this_thread::get_resource` is provided for retrieving the `execution_resource` underlying the current thread of execution.
800801

801-
const std::experimental::execution::execution_resource get_resource() noexcept;
802+
std::experimental::execution::execution_resource get_resource() noexcept;
802803

803804
*Returns:* The `execution_resource` underlying the current thread of execution.
804805

0 commit comments

Comments
 (0)