Skip to content

WIP: Custom backends for Dynamic Selection #2220

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

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

vossmjp
Copy link
Contributor

@vossmjp vossmjp commented May 1, 2025

A very rough draft for custom backends for dynamic selection.

@vossmjp vossmjp requested review from egfefey and danhoeflinger May 1, 2025 21:16
The `get_submission_group` is not easily implemented in a meaningful way. It must return a type that
defines a member function `wait`. But since there is no way to know how to wait on all previous submissions
for an arbitrary backend resource, this function will likely need to return a dummy type or
`get_submission_group` be undefined for the default backend.
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 could provide a way to have the user give us the wait type, do we have a shot? Or maybe it's better to leave this out to make the default case simple.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Lets consider if there's a meaningful default or not. I'm not sure that there is.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think a meaningful default is to call wait on all resources, if they have a wait function.

Comment on lines +53 to +57
Policies contain a backend and current policies are either default constructed/initialized or
constructed/initialized with a `std::vector<Resouce>` of resources. When a vector is passed
to the constructor, the type of the resource can be deduced and used as a template argument
when constructing the backend. When a policy is default constructed, the resource type can be made
a manditory template argument and this can be used to set the resource type in the backend.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should include deferred initialization here.

when constructing the backend. When a policy is default constructed, the resource type can be made
a manditory template argument and this can be used to set the resource type in the backend.

Is it therefore becomes unnecessary to explicitly provide the resource type in the default backend.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Is it therefore becomes unnecessary to explicitly provide the resource type in the default backend.
It therefore becomes unnecessary to explicitly provide the resource type in the default backend.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, we probably want to soften the language here a bit to accomodate the default constructor and deferred initialization constructors.
Perhaps we can just add on "when providing resource objects to a constructor." or something like that.


// v is empty
auto v = p.get_resources();
```
Copy link
Contributor

Choose a reason for hiding this comment

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

mention deferred initialization.

vossmjp and others added 5 commits May 5, 2025 15:30
Co-authored-by: Dan Hoeflinger <109972525+danhoeflinger@users.noreply.github.com>
Co-authored-by: Dan Hoeflinger <109972525+danhoeflinger@users.noreply.github.com>
Co-authored-by: Dan Hoeflinger <109972525+danhoeflinger@users.noreply.github.com>
Co-authored-by: Dan Hoeflinger <109972525+danhoeflinger@users.noreply.github.com>
@akukanov akukanov added the RFC label May 6, 2025
Copy link
Contributor

@danhoeflinger danhoeflinger left a comment

Choose a reason for hiding this comment

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

I think this looks pretty good. Mostly just quite minor changes for now.

namespace experimental {

template <typename ResourceType>
struct backend_for_resource
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this is my naming, but I don't like it, perhaps it should just be resource_traits , perhaps backend_t should be default_backend_t?

resource_traits<resource_t>::default_backend_t

vossmjp and others added 5 commits May 6, 2025 21:34
Co-authored-by: Dan Hoeflinger <109972525+danhoeflinger@users.noreply.github.com>
Co-authored-by: Dan Hoeflinger <109972525+danhoeflinger@users.noreply.github.com>
Co-authored-by: Dan Hoeflinger <109972525+danhoeflinger@users.noreply.github.com>
Co-authored-by: Dan Hoeflinger <109972525+danhoeflinger@users.noreply.github.com>
Co-authored-by: Dan Hoeflinger <109972525+danhoeflinger@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants