Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CP013: Affinity asymmetry between execution and memory resource #41

Closed
hcedwar opened this issue Apr 14, 2018 · 10 comments
Closed

CP013: Affinity asymmetry between execution and memory resource #41

hcedwar opened this issue Apr 14, 2018 · 10 comments
Assignees
Labels
SAN18 San Diego 2018 C++ Meeting

Comments

@hcedwar
Copy link
Collaborator

hcedwar commented Apr 14, 2018

The Affinity execution_context has asymmetry in that it is constructed from an execution resource but supplies a memory resource. Should relationship be between execution resources and memory resources without an intervening execution context?

@hcedwar hcedwar changed the title Affinity asymmetry between execution and memory resource CP013: Affinity asymmetry between execution and memory resource Apr 26, 2018
@hcedwar hcedwar added the RAP18 Rapperswil 2018 C++ Meeting label Apr 26, 2018
@AerialMantis
Copy link
Contributor

We decided to adopt a new approach to representing the system topology where there is a separate topology structure for execution resources and for memory resources.

For this we will need to split out the current execution_resource into two classes; for execution resources and for memory resources, and then provide separate ways to query those topologies; for example this_system::execution_resources and this_system::memory_resources. I think this will also mean dropping can_place_agents and can_place_memory as it will be implied that execution resources can place agents and memory resources can place memory.

One concern that we may need to consider is that the term memory resource may conflict with the existing pmr memory resource.

@hcedwar
Copy link
Collaborator Author

hcedwar commented May 3, 2018

On the other hand, std::pmr::memory_resource may be just the right type, with the spec that the object allocates memory conformal with the topology.

struct topological_memory_resource : public std::pmr::memory_resource {
  iterator begin() const noexcept ;
  iterator end() const noexcept ;
  // etc.
};

@AerialMantis
Copy link
Contributor

I was actually thinking that as well that we could used the pmr::memory_resource type as our memory resource type, the issue I ran into was having it be traversable as part of a topology. Though I think your solution here of having a topology type which inherits from pmr::memory_resource but provides a begin and end could work quite nicely.

hcedwar added a commit to hcedwar/standards-proposals that referenced this issue May 4, 2018
hcedwar added a commit to hcedwar/standards-proposals that referenced this issue May 6, 2018
@AerialMantis AerialMantis added SAN18 San Diego 2018 C++ Meeting and removed RAP18 Rapperswil 2018 C++ Meeting labels Jul 23, 2018
@mhoemmen
Copy link
Collaborator

Sorry I missed Monday's meeting! I'm a bit confused about why the memory resource type itself needs to be iterable. Why wouldn't one just call a function on a memory resource, to get the range of its subordinate resources? Why would the memory resource itself need begin() and end() instance methods?

@mhoemmen
Copy link
Collaborator

The reason I ask is that this would, as observed above, require using a subclass of a pmr thing, rather than just the pmr thing.

@mhoemmen
Copy link
Collaborator

I get it now -- as long as the resource is a subclass of pmr, it can work as a pmr thing. The subclass resource interface is just for iterating hierarchy.

@mhoemmen
Copy link
Collaborator

However, we did bring up an issue today, that since there's no "memory context," the system could unload a driver when the execution context goes away, and thus break extant memory allocations.

@mhoemmen
Copy link
Collaborator

Need a lifetime for memory -- e.g., "memory context"

@hcedwar
Copy link
Collaborator Author

hcedwar commented Jul 30, 2018

A "context" for a memory resource is an "allocator"

@mhoemmen
Copy link
Collaborator

mhoemmen commented Jul 30, 2018

@hcedwar I see -- that makes more sense now. This would mean users would create an allocator from a memory resource. Thanks!

See discussion here about execution resource lifetime. It should also be relevant to memory resources, if one replaces "context" with "allocator."

AerialMantis pushed a commit to AerialMantis/standards-proposals that referenced this issue Oct 7, 2018
* Fixes codeplaysoftware#41 and codeplaysoftware#42.
* Introduce `memory_resource` to represent the memory component of a system topology.
* Remove `can_place_memory` and `can_place_agents` from the `execution_resource` as these are no longer required.
* Remove `memory_resource` and `allocator` from the `execution_context` as these no longer make sense.
* Update the wording to describe how execution resources and memory resources are structured.
* Refactor `affinity_query` to be between an `execution_resource` and a `memory_resource`.
* Make minor corrections.
AerialMantis pushed a commit to AerialMantis/standards-proposals that referenced this issue Oct 7, 2018
AerialMantis pushed a commit to AerialMantis/standards-proposals that referenced this issue Oct 8, 2018
AerialMantis added a commit that referenced this issue Oct 8, 2018
Issue #41: Separate execution and memory resources
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
SAN18 San Diego 2018 C++ Meeting
Projects
None yet
Development

No branches or pull requests

3 participants