Ensure all execution policies are also environments#8155
Open
miscco wants to merge 4 commits intoNVIDIA:mainfrom
Open
Ensure all execution policies are also environments#8155miscco wants to merge 4 commits intoNVIDIA:mainfrom
miscco wants to merge 4 commits intoNVIDIA:mainfrom
Conversation
miscco
commented
Mar 24, 2026
This comment has been minimized.
This comment has been minimized.
885ac00 to
4e7dbd5
Compare
We want to be able to pass additional information to execution policies. We already settled on the sender & receiver approach with queries and key value pairs. This refactors the current approach to turn `__execution_policy_base` into a proper environment. That has the advantage that we do not need to handle the cuda execution policy in a special way. The only cuda specific code is when we want to ensure that streams are passed as `cuda::stream_ref` and memory resources as `cuda::mr::resource_ref`
8322290 to
228e42c
Compare
This comment has been minimized.
This comment has been minimized.
228e42c to
8bdc9c9
Compare
8bdc9c9 to
08e209d
Compare
This comment has been minimized.
This comment has been minimized.
Contributor
🥳 CI Workflow Results🟩 Finished in 1h 24m: Pass: 100%/137 | Total: 2d 03h | Max: 58m 04s | Hits: 96%/279810See results here. |
pciolkosz
approved these changes
Mar 27, 2026
| if constexpr (!is_lvalue_reference_v<_Env> && !::cuda::mr::__is_resource_ref<remove_cvref_t<_Env>>) | ||
| { // The user passed a prvalue, which indicates we should own the resource | ||
| return __with(prop{::cuda::mr::get_memory_resource, | ||
| ::cuda::mr::any_resource<::cuda::mr::device_accessible> { |
Contributor
There was a problem hiding this comment.
If we template the policy anyway could we just keep the original resource type?
| if constexpr (!is_lvalue_reference_v<_Value> && !::cuda::mr::__is_resource_ref<remove_cvref_t<_Value>>) | ||
| { // The user passed a prvalue, which indicates we should own the resource | ||
| return __with(prop{__tag, | ||
| ::cuda::mr::any_resource<::cuda::mr::device_accessible> { |
Contributor
There was a problem hiding this comment.
Hmm, is it guaranteed to always be device_accessible? I know in general we wanted to support type erased wrappers with no properties, but not sure if it applies here too
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
We want to be able to pass additional information to execution policies.
We already settled on the sender & receiver approach with queries and key value pairs.
This refactors the current approach to turn
__execution_policy_baseinto a proper environment. That has the advantage that we do not need to handle the cuda execution policy in a special way.The only cuda specific code is when we want to ensure that streams are passed as
cuda::stream_refand memory resources ascuda::mr::resource_refThis is currently failing some tests we had in place that relied on special handling of the
cudapolicy wrt to memory resourcesI am not sure if that is something we want to change?