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: Allow constructing an execution context from a range of execution resources #51

Open
AerialMantis opened this issue May 2, 2018 · 4 comments
Labels
SAN18 San Diego 2018 C++ Meeting

Comments

@AerialMantis
Copy link
Contributor

It was raised that the current design limits the creation of an execution_context to a single execution_resource therefore enforcing that the execution_context represent all member execution_resources. This excludes the case where you may want to, for example, create an execution_context from half the threads of a core. In this case, you would want to list the execution_resources you want the execution_context to represent.

For this we need to add an additional constructor to the execution_context or alter the existing constructor to allow it to take a set of execution_resources. Perhaps we could do this by providing partitioning algorithms which can partition an execution_resource in a particular way and return a new iterable which could then be passed to the execution_context constructor.

@AerialMantis AerialMantis added the RAP18 Rapperswil 2018 C++ Meeting label May 2, 2018
@hcedwar
Copy link
Collaborator

hcedwar commented May 3, 2018

Need to be able to query the context for a (single) resource object. Leading to having a resource object that is a specified subset of another resource. Leading to a constructor or member function that takes a selection-specification (e.g., array of ints) and gives back a resource handle. Leads to multiple resource objects referencing the same resource, which is OK because ownership is not implied. I'd go with constructor taking an existing resource and a selection-spec.

@AerialMantis
Copy link
Contributor Author

That's a good point, if we allow constructing an execution_context from a set of execution_resources that could complicate the mapping of execution_contexts to execution_resources.

If I understand correctly you're proposing that the execution_context be constructed with an execution_resource and some form of array of indices, which specifies which member resources the context will manage? Something like:

execution_context partitionedContext(execRes, {0, 1, 2, 3});

We could make the default set be all member resources.

This would mean that you couldn't have an execution_context with execution_resources at different levels, though perhaps this is a reasonable restriction.

@Ruyk
Copy link
Contributor

Ruyk commented May 4, 2018

Seems like a reasonable restriction to me.
My concern is that we cannot assume all implementations of execution resource / context would allow for this fine-grained selection of resources.

  1. What will be the behaviour in the case of trying to fine-grain select on a platform where this is not supported? (e.g., imagine trying to select individual work-items on a work-group for an OpenCL backend)
  2. How can we query if a given resource can be "fine-grain selected" (for a lack of a better term at this point)? This is particularly important if we expect execution context and resources to be used in generic programming (e.g, nested parallel algorithms).

@AerialMantis
Copy link
Contributor Author

Yes, I think this would have to be an optional feature as not all resources will be able to support this. The way I'd imagine this working is that an execution_resource would have a certain level of concurrency, but also have a certain level of partition-ability, being essentially the number of member resources which can be iterated over. So, for example, you could have a CPU core resource which has 8 concurrency and 8 partition-ability so you would be able to partition each of the resources individually, and then you could have a GPU work group resource which has 64 concurrency but 0 partition-ability, so you can execute work on it but not partition it further.

@AerialMantis AerialMantis added SAN18 San Diego 2018 C++ Meeting and removed RAP18 Rapperswil 2018 C++ Meeting labels Jul 23, 2018
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