Skip to content

fix(exec): probe timed scheduler fallback through the const-lvalue scheduler - #2368

Merged
ericniebler merged 2 commits into
NVIDIA:mainfrom
alwaysprince05:fix/timed-fallback-probe-const
Oct 31, 2026
Merged

ericniebler merged 2 commits into
NVIDIA:mainfrom
alwaysprince05:fix/timed-fallback-probe-const

Conversation

@alwaysprince05

Copy link
Copy Markdown
Contributor

Refs #2165.

The schedule_after/schedule_at fallbacks compute the native sender type from the value category of the call site, while the deferred invocation in the fallback's let_value lambda resolves it through a const S& (the lambda captures the scheduler by copy and is not mutable). For a scheduler whose const-lvalue and non-const-lvalue schedule_at overloads return different senders, the completion-scheduler claim restored in #2164 was computed from an overload that never runs.

The change probes with const __decay_t<_Scheduler>&, so the claim and the fallback's noexcept condition match the overload the deferred call resolves to. The new regression test uses a scheduler with ref-qualified schedule_at members: both pins fail before the change, both hold after it, and the advertised completion scheduler is the one that actually completes. Test also pins the same behavior for an lvalue call site.

Verified with Apple clang 21, -std=c++20, normal and STDEXEC_ENABLE_EXTRA_TYPE_CHECKING=ON builds:
test.stdexec 641 cases / 50119 assertions (50120 in the ETC config), test.exec 427 cases / 18385 assertions, all green; clang-format-21 --dry-run -Werror clean on touched files.

@copy-pr-bot

copy-pr-bot Bot commented Oct 26, 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/exec/timed_scheduler.hpp Outdated
// claim is computed from the overload the deferred call resolves to.
using __native_sender_t = __call_result_t<__schedule_at_base_t,
__sched_t const &,
time_point_of_t<_Scheduler> const &>;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

should this be:

Suggested change
time_point_of_t<_Scheduler> const &>;
time_point_of_t<_Scheduler>>;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, the deferred call passes the time point as a prvalue, so the probe should too. Fixed in b33355f.

Comment thread include/exec/timed_scheduler.hpp Outdated
// deferred lambda captures, not the call site's value category.
using __native_sender_t = __call_result_t<__schedule_after_base_t,
__sched_t const &,
duration_of_t<_Scheduler> const &>;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

same question here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Same here, fixed in b33355f.

@ericniebler

Copy link
Copy Markdown
Collaborator

/ok to test 1fe9b2b

…heduler

The schedule_after/schedule_at fallbacks deduced the native sender type
through the value category of the call site, while the deferred invocation
in the fallback's (non-mutable) let_value lambda resolves it through a
const S&. For schedulers whose overloads differ by ref-qualification, the
completion-scheduler claim was computed from an overload that never runs.

Probe through const __decay_t<_Scheduler>& so the claim matches the actual
invocation, and evaluate the fallback's noexcept condition the same way.
Regression test covers prvalue and lvalue call sites. Refs NVIDIA#2165.
@ericniebler
ericniebler force-pushed the fix/timed-fallback-probe-const branch from 1fe9b2b to d9d5818 Compare October 31, 2026 18:18
@ericniebler

Copy link
Copy Markdown
Collaborator

/ok to test d9d5818

The deferred schedule_at/schedule_after calls pass the time point or
duration as a prvalue, so probe the native sender type the same way.
@ericniebler

Copy link
Copy Markdown
Collaborator

/ok to test b33355f

@ericniebler
ericniebler merged commit 2bc0681 into NVIDIA:main Oct 31, 2026
40 checks passed
@ericniebler

Copy link
Copy Markdown
Collaborator

thanks!

@alwaysprince05
alwaysprince05 deleted the fix/timed-fallback-probe-const branch October 31, 2026 22:12
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.

2 participants