Skip to content

update the start scheduler before connecting scheduler sender in continues_on - #2277

Open
ericniebler wants to merge 2 commits into
NVIDIA:mainfrom
ericniebler:fix-continues-on-attributes
Open

ericniebler wants to merge 2 commits into
NVIDIA:mainfrom
ericniebler:fix-continues-on-attributes

Conversation

@ericniebler

Copy link
Copy Markdown
Collaborator

fixes #2268

@copy-pr-bot

copy-pr-bot Bot commented Sep 20, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

Comment thread include/stdexec/__detail/__continues_on.hpp Outdated
Comment thread include/stdexec/__detail/__continues_on.hpp Outdated
Comment thread test/stdexec/queries/test_get_start_scheduler.cpp Outdated
Comment on lines +126 to +133
template <class _Env>
using __env2_t = __secondary_env_t<_Sender, _Env, set_value_t>;

template <class _Env>
constexpr auto __mk_env2(_Env&& __env) const noexcept -> __env2_t<_Env>
{
return __mk_secondary_env_t<set_value_t>()(__sndr_, static_cast<_Env&&>(__env));
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Noting that the tag is hardcoded here to set_value_t, whereas the call sites are templated on _SetTag? Could this lead to issues e.g. when the predecessor completes with error/stop?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this issue is still open and may be relevant.

The __complete lambda stores all completions with their tag, along with a comment that states that the goal is to forward them from within the scheduler's context.

https://github.com/ericniebler/stdexec/blob/233768b59e2d92c65c6652a6d18864db15e8f1ac/include/stdexec/__detail/__continues_on.hpp#L362-L369

This is indeed what __receiver2 does:

https://github.com/ericniebler/stdexec/blob/233768b59e2d92c65c6652a6d18864db15e8f1ac/include/stdexec/__detail/__continues_on.hpp#L79-L82

If the predecessor completes with an error, we can thus expect that error to be re-emitted from the scheduler's context, and it seems that's a case that the queries don't capture yet.

Incidentally, the first sentence of the docstring of __receiver2 appears too strong because its set_error and set_stopped would be invoked from the predecessor's context.

Comment thread test/stdexec/queries/test_get_start_scheduler.cpp Outdated
Comment thread test/stdexec/queries/test_get_start_scheduler.cpp Outdated
Comment thread test/stdexec/queries/test_get_start_scheduler.cpp Outdated
Comment thread test/stdexec/queries/test_get_start_scheduler.cpp Outdated
auto sndr = ex::schedule(pool.get_scheduler()) //
| ::then_store_thread_id(pool_tid) //
| ex::let_value(
[&]() noexcept

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just curious why you added noexcept?

@ericniebler

Copy link
Copy Markdown
Collaborator Author

/ok to test d5e63d7

@ericniebler

Copy link
Copy Markdown
Collaborator Author

/ok to test 4c50519

@ericniebler

Copy link
Copy Markdown
Collaborator Author

/ok to test 3e2bddf

@ericniebler

Copy link
Copy Markdown
Collaborator Author

/ok to test 660d14d

Comment thread test/stdexec/queries/test_get_start_scheduler.cpp Outdated
Co-authored-by: Maarten Arnst <maarten.arnst@ulg.ac.be>
@ericniebler

Copy link
Copy Markdown
Collaborator Author

/ok to test c127035

ericniebler pushed a commit that referenced this pull request Oct 5, 2026
…2294)

* fix(exec): make write_env transparent to sequence sender semantics

A write_env sender wrapping a sequence sender was not itself a sequence
sender: get_item_types has no branch that looks through stdexec sender
adaptors, so sequence-aware algorithms like exec::transform_each treated
the wrapper as a sequence of one and collapsed the item types. Make
write_env senders transparent to sequence semantics:

- specialize enable_sequence_sender for __write_env_t sexprs
- compute item types of a write_env sender from its child in the joined
  environment (recursing through stacked wrappers)
- subscribe to the child through a receiver that joins the written
  environment with the wrapped receiver's environment

First half of #2053. The starts_on half goes through the continues_on
machinery that #2277 is reworking, so it is left for a follow-up.

* fix(exec): make sequence-adaptor transparency an open customization point

Review feedback on #2294: get_item_types and subscribe must not
hard-code individual sender adaptors, since the set of adaptors is
open. Replace the write_env-specific branches with a generic
mechanism driven by a new __sequence_adaptor_traits customization
point: an adaptor that forwards set_next and all completions to a
single child declares itself transparent for its tag, optionally
naming the environment its child observes. write_env now only
specializes that trait, and the sequence machinery handles every
transparent adaptor the same way. The enable_sequence_sender
specialization also goes through tag_of_t rather than digging into
the sender's descriptor.

Also merge upstream/main, and extend the regression tests with a
user-defined adaptor that opts in via the new trait, to show that
the extension point is open.

* test: fix clang-format-21 violations in test_write_env_sequence.cpp

Empty struct bodies written as `{ };` fail the style CI job, which runs
clang-format-21 --dry-run --Werror over all tracked sources.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>

---------

Co-authored-by: alwaysprince05 <alwaysprince05@users.noreply.github.com>
Co-authored-by: Codebuff <noreply@codebuff.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

continues_on: hop opstate not connected with secondary environment

2 participants