Fix split fast-path to preserve completion scheduler semantics#6911
Open
shlokjain2031 wants to merge 2 commits intoTheHPXProject:masterfrom
Open
Fix split fast-path to preserve completion scheduler semantics#6911shlokjain2031 wants to merge 2 commits intoTheHPXProject:masterfrom
shlokjain2031 wants to merge 2 commits intoTheHPXProject:masterfrom
Conversation
|
Can one of the admins verify this patch? |
Contributor
|
@isidorostsa would you have the time to review this PR, please? |
Contributor
|
@isidorostsa ping? |
Contributor
|
Hey @shlokjain2031, thanks for the pr! We are in the process of deprecating most of hpx's native senders, and replacing the ones where hpx provides an advantage with cpo specializations on the completion scheduler. Do you think there is a significant advantage of this implementation over the one found in stdexec? |
Contributor
|
@isidorostsa Could you please have a look? |
Contributor
|
@shlokjain2031 Please have a look at the CI failures. |
Contributor
|
@shlokjain2031 ping? |
Up to standards ✅🟢 Issues
|
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.
Fixes #6905
Proposed Changes
Introduces one replay lambda that is used in both:
The replay lambda first inspects the stored completion variant to determine which signal will be emitted:
Before invoking the completion inline, it queries the receiver’s environment for the corresponding completion scheduler.
If a valid scheduler is found and it supports schedule(), the completion is dispatched through that scheduler using:
If no suitable scheduler is available, the code falls back to invoking the completion inline, preserving the original behavior.
This ensures consistent, scheduler-aware behavior in both fast-path and deferred execution paths.
Any background context you want to provide?
Previously, if predecessor_done was true (fast-path), the code directly called set_value, set_error, or set_stopped inline on the downstream receiver. That inline invocation ignored any completion scheduler provided through the receiver’s environment. Ignoring the completion scheduler could break expected execution semantics, since the receiver may require completions to run on a specific scheduler.
Checklist
Not all points below apply to all pull requests.