Skip to content

Affinity: Address #67 & discussion in #70 #74

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

Merged
merged 9 commits into from
Oct 2, 2018

Conversation

mhoemmen
Copy link
Collaborator

@mhoemmen mhoemmen commented Sep 10, 2018

@AerialMantis

Address #67 by applying discussion in #70.
Update some references, including p0443.

Copy link
Contributor

@Ruyk Ruyk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments after a quick look, thanks!

@@ -221,7 +276,7 @@ An `execution_resource` is a lightweight structure which acts as an identifier t

### System topology

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.
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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we don't want iterators to be invalidated, shouldn't this be std::list ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue #50 and PR #73 address making resources iterable. I wanted this PR to be as orthogonal from those as possible, though I think I did manage to conflict with #73, alas ;-) . Anyway, thanks for pointing this out!

@@ -629,16 +684,19 @@ The free function `this_thread::get_resource` is provided for retrieving the `ex

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

> [*Note:* The `execution_resource` underlying the current thread of execution may not necessarily be reachable from "top-level" resources visible through `this_system`. *--end note*]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is not clear to me what is the reason for the note (i have been on holiday so apologies if this has been discussed already)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One of the things we discussed was whether some resources might not be accessible from the top level -- e.g., some GPU resources (like scratch memory) might only be available during execution on the GPU. One could thus access them through this_thread::get_resource (and possibly in other ways), but not from the top level this_system::get_resource.

This is also one of the reasons for execution_resource not to be reference counted (at least not all execution_resources). Otherwise, it would be bad for them to escape the scope of code executing on the GPU.

I was thinking about this Note last night, and realized that we may need more explanatory text about this. I'd like the PR to go through so it doesn't step on other PRs, but we should definitely write more about this.

@AerialMantis
Copy link
Contributor

This looks great, thanks!

@AerialMantis AerialMantis merged commit 926634e into codeplaysoftware:master Oct 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants