-
Notifications
You must be signed in to change notification settings - Fork 116
[Dynamic Selection] Customization of Backends and Policies #2508
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
base: main
Are you sure you want to change the base?
Conversation
…t after, also removed submit from the sycl_backend. Now uses the base implementation
…t after, also removed submit from the sycl_backend. Now uses the base implementation
| { | ||
| static_assert(sizeof...(ReportReqs) == 0, "Default backend does not support reporting"); | ||
|
|
||
| for (const auto& e : u) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can avoid this loop by using https://en.cppreference.com/w/cpp/container/vector/insert.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@egfefey Can you take a look at this?
I responded before on this topic that we would rather not expand the scope of this PR further as this is the way this is generally done in dynamic selection to this point. I'm not sure if this causes any problems or presents and limitations on what can be used for resources.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We didn't purposefully do any push_back/insert comparison but considering the fact that we only deal with a handful of resources, any possible impact is likely to be minimal. In any case, I will create a github issue so we can collect performance numbers later to justify a switch if the need be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's the kind of approach which just better to fix: std::vector::insert exactly allows to us avoid these loops.
Also from time to time memory allocations will happens on this code and I think in case of insert at first we will have allocation -> copy -> insert new and in your current approach we will have insert new -> allocation -> copy (existed earlier + already inserted) -> insert new (the rest).
So my opinion - I still think that better to fix in this PR because it's the new code.
| else // other reporting requirements beside task_time | ||
| { | ||
| if (!x.has(sycl::aspect::queue_profiling)) | ||
| for (auto& x : v) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same; may be we can use https://en.cppreference.com/w/cpp/container/vector/insert.html ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@egfefey this is related to above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same response here.
include/oneapi/dpl/internal/dynamic_selection_impl/fixed_resource_policy.h
Outdated
Show resolved
Hide resolved
include/oneapi/dpl/internal/dynamic_selection_impl/sycl_backend.h
Outdated
Show resolved
Hide resolved
include/oneapi/dpl/internal/dynamic_selection_impl/sycl_backend.h
Outdated
Show resolved
Hide resolved
Signed-off-by: Dan Hoeflinger <[email protected]>
Signed-off-by: Dan Hoeflinger <[email protected]>
include/oneapi/dpl/internal/dynamic_selection_impl/sycl_backend.h
Outdated
Show resolved
Hide resolved
Signed-off-by: Dan Hoeflinger <[email protected]>
Signed-off-by: Dan Hoeflinger <[email protected]>
Signed-off-by: Dan Hoeflinger <[email protected]>
Signed-off-by: Dan Hoeflinger <[email protected]>
include/oneapi/dpl/internal/dynamic_selection_impl/sycl_backend.h
Outdated
Show resolved
Hide resolved
Signed-off-by: Dan Hoeflinger <[email protected]>
Signed-off-by: Dan Hoeflinger <[email protected]>
Signed-off-by: Dan Hoeflinger <[email protected]>
Signed-off-by: Dan Hoeflinger <[email protected]>
Signed-off-by: Dan Hoeflinger <[email protected]>
Signed-off-by: Dan Hoeflinger <[email protected]>
Signed-off-by: Dan Hoeflinger <[email protected]>
Signed-off-by: Dan Hoeflinger <[email protected]>
Signed-off-by: Dan Hoeflinger <[email protected]>
Signed-off-by: Dan Hoeflinger <[email protected]>
Signed-off-by: Dan Hoeflinger <[email protected]>
Signed-off-by: Dan Hoeflinger <[email protected]>
Signed-off-by: Dan Hoeflinger <[email protected]>
Signed-off-by: Dan Hoeflinger <[email protected]>
Signed-off-by: Dan Hoeflinger <[email protected]>
Dynamic Selection API: Backend and Policy Customization & Removal of Selection API
This PR refactors the Dynamic Selection API to introduce a flexible backend architecture and simplify the user-facing API by removing the
select()function. It provides better tools for customization of backend and policies to allow for easier customization and more flexibility for users.Implements RFCs #2220.
Key Changes
Backend Architecture
policy_base.handdefault_backend.hto provide common base classes for policies and backends respectivelyResourceAdapterfunction to support different flavors of resource with the same backend (e.g.sycl::queuevssycl::queue*)API Simplification
select()function - selections are now internal implementation detailstry_submit- always returns astd::optionalquickly, returns empty if unable to obtain a resourcetry_submit,submit()andsubmit_and_wait()functionstry_select_impl()(returnsstd::optional) instead of publicselect()Execution Info & Reporting
Summary of changes to look out for from individual components: