-
Notifications
You must be signed in to change notification settings - Fork 104
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
Add resource argument to PluginStrategy methods #1775
Draft
johnbowen42
wants to merge
1
commit into
develop
Choose a base branch
from
feature/bowen/expand-plugin-api
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -268,15 +268,16 @@ struct WorkPool<WorkGroupPolicy<EXEC_POLICY_T, | |
} | ||
|
||
util::PluginContext context{util::make_context<exec_policy>()}; | ||
util::callPreCapturePlugins(context); | ||
// todo(bowen) do we want default resource here? | ||
util::callPreCapturePlugins(context, resource_type::get_default()); | ||
Comment on lines
+271
to
+272
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's think about this |
||
|
||
using RAJA::util::trigger_updates_before; | ||
auto body = trigger_updates_before(loop_body); | ||
|
||
m_runner.enqueue( | ||
m_storage, std::forward<segment_T>(seg), std::move(body)); | ||
|
||
util::callPostCapturePlugins(context); | ||
util::callPostCapturePlugins(context, resource_type::get_default()); | ||
} | ||
|
||
inline workgroup_type instantiate(); | ||
|
@@ -497,12 +498,12 @@ WorkGroup< | |
Args... args) | ||
{ | ||
util::PluginContext context{util::make_context<EXEC_POLICY_T>()}; | ||
util::callPreLaunchPlugins(context); | ||
util::callPreLaunchPlugins(context, r); | ||
|
||
// move any per run storage into worksite | ||
worksite_type site(r, m_runner.run(m_storage, r, std::forward<Args>(args)...)); | ||
|
||
util::callPostLaunchPlugins(context); | ||
util::callPostLaunchPlugins(context, r); | ||
|
||
return site; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -229,24 +229,24 @@ void launch(LaunchParams const &launch_params, const char *kernel_name, ReducePa | |
auto&& launch_body = expt::get_lambda(std::forward<ReduceParams>(rest_of_launch_args)...); | ||
|
||
//Take the first policy as we assume the second policy is not user defined. | ||
//We rely on the user to pair launch and loop policies correctly. | ||
//We rely on the user to pair launch and loop policies core_protly. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. spell correctly? |
||
util::PluginContext context{util::make_context<typename LAUNCH_POLICY::host_policy_t>()}; | ||
util::callPreCapturePlugins(context); | ||
using Res = typename resources::get_resource<typename LAUNCH_POLICY::host_policy_t>::type; | ||
util::callPreCapturePlugins(context, Res::get_default()); | ||
|
||
using RAJA::util::trigger_updates_before; | ||
auto p_body = trigger_updates_before(launch_body); | ||
|
||
util::callPostCapturePlugins(context); | ||
util::callPostCapturePlugins(context, Res::get_default()); | ||
|
||
util::callPreLaunchPlugins(context); | ||
util::callPreLaunchPlugins(context, Res::get_default()); | ||
|
||
using launch_t = LaunchExecute<typename LAUNCH_POLICY::host_policy_t>; | ||
|
||
using Res = typename resources::get_resource<typename LAUNCH_POLICY::host_policy_t>::type; | ||
|
||
launch_t::exec(Res::get_default(), launch_params, kernel_name, p_body, reducers); | ||
|
||
util::callPostLaunchPlugins(context); | ||
util::callPostLaunchPlugins(context, Res::get_default()); | ||
} | ||
|
||
|
||
|
@@ -264,23 +264,25 @@ void launch(LaunchParams const &launch_params, ReduceParams&&... rest_of_launch_ | |
|
||
//Take the first policy as we assume the second policy is not user defined. | ||
//We rely on the user to pair launch and loop policies correctly. | ||
using Res = typename resources::get_resource<typename LAUNCH_POLICY::host_policy_t>::type; | ||
using RAJA::util::trigger_updates_before; | ||
|
||
util::PluginContext context{util::make_context<typename LAUNCH_POLICY::host_policy_t>()}; | ||
util::callPreCapturePlugins(context); | ||
|
||
using RAJA::util::trigger_updates_before; | ||
util::callPreCapturePlugins(context, Res::get_default()); | ||
|
||
auto p_body = trigger_updates_before(launch_body); | ||
|
||
util::callPostCapturePlugins(context); | ||
util::callPostCapturePlugins(context, Res::get_default()); | ||
|
||
util::callPreLaunchPlugins(context); | ||
util::callPreLaunchPlugins(context, Res::get_default()); | ||
|
||
using launch_t = LaunchExecute<typename LAUNCH_POLICY::host_policy_t>; | ||
|
||
using Res = typename resources::get_resource<typename LAUNCH_POLICY::host_policy_t>::type; | ||
|
||
launch_t::exec(Res::get_default(), launch_params, kernel_name, p_body, reducers); | ||
|
||
util::callPostLaunchPlugins(context); | ||
util::callPostLaunchPlugins(context, Res::get_default()); | ||
} | ||
|
||
//================================================= | ||
|
@@ -420,27 +422,27 @@ launch(RAJA::resources::Resource res, LaunchParams const &launch_params, | |
util::PluginContext context{util::make_context<typename POLICY_LIST::host_policy_t>()}; | ||
#endif | ||
|
||
util::callPreCapturePlugins(context); | ||
util::callPreCapturePlugins(context, res); | ||
|
||
using RAJA::util::trigger_updates_before; | ||
auto p_body = trigger_updates_before(launch_body); | ||
|
||
util::callPostCapturePlugins(context); | ||
util::callPostCapturePlugins(context, res); | ||
|
||
util::callPreLaunchPlugins(context); | ||
util::callPreLaunchPlugins(context, res); | ||
|
||
switch (place) { | ||
case ExecPlace::HOST: { | ||
using launch_t = LaunchExecute<typename POLICY_LIST::host_policy_t>; | ||
resources::EventProxy<resources::Resource> e_proxy = launch_t::exec(res, launch_params, kernel_name, p_body, reducers); | ||
util::callPostLaunchPlugins(context); | ||
util::callPostLaunchPlugins(context, res); | ||
return e_proxy; | ||
} | ||
#if defined(RAJA_GPU_ACTIVE) | ||
case ExecPlace::DEVICE: { | ||
using launch_t = LaunchExecute<typename POLICY_LIST::device_policy_t>; | ||
resources::EventProxy<resources::Resource> e_proxy = launch_t::exec(res, launch_params, kernel_name, p_body, reducers); | ||
util::callPostLaunchPlugins(context); | ||
util::callPostLaunchPlugins(context, res); | ||
return e_proxy; | ||
} | ||
#endif | ||
|
@@ -488,27 +490,27 @@ launch(RAJA::resources::Resource res, LaunchParams const &launch_params, | |
util::PluginContext context{util::make_context<typename POLICY_LIST::host_policy_t>()}; | ||
#endif | ||
|
||
util::callPreCapturePlugins(context); | ||
util::callPreCapturePlugins(context, res); | ||
|
||
using RAJA::util::trigger_updates_before; | ||
auto p_body = trigger_updates_before(launch_body); | ||
|
||
util::callPostCapturePlugins(context); | ||
util::callPostCapturePlugins(context, res); | ||
|
||
util::callPreLaunchPlugins(context); | ||
util::callPreLaunchPlugins(context, res); | ||
|
||
switch (place) { | ||
case ExecPlace::HOST: { | ||
using launch_t = LaunchExecute<typename POLICY_LIST::host_policy_t>; | ||
resources::EventProxy<resources::Resource> e_proxy = launch_t::exec(res, launch_params, kernel_name, p_body, reducers); | ||
util::callPostLaunchPlugins(context); | ||
util::callPostLaunchPlugins(context, res); | ||
return e_proxy; | ||
} | ||
#if defined(RAJA_GPU_ACTIVE) | ||
case ExecPlace::DEVICE: { | ||
using launch_t = LaunchExecute<typename POLICY_LIST::device_policy_t>; | ||
resources::EventProxy<resources::Resource> e_proxy = launch_t::exec(res, launch_params, kernel_name, p_body, reducers); | ||
util::callPostLaunchPlugins(context); | ||
util::callPostLaunchPlugins(context, res); | ||
return e_proxy; | ||
} | ||
#endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Let's double check that we don't need a non-const resource reference.