Skip to content

core(scheduler): enforce scheduler_concept per [exec.sched] - #2412

Open
romintomasetti wants to merge 1 commit into
NVIDIA:mainfrom
romintomasetti:scheduler-tag-in-concept
Open

romintomasetti wants to merge 1 commit into
NVIDIA:mainfrom
romintomasetti:scheduler-tag-in-concept

Conversation

@romintomasetti

Copy link
Copy Markdown
Contributor

Per [exec.sched] (I am not aware of a paper removing this requirement).

In #2256, a test was added that ensures all stdexec schedulers define the alias scheduler_concept, and that it derives from stdexec::scheduler_tag.

But IMO anyone implementing their own schedulers must also comply to this rule.

This is some sort of followup of:

@copy-pr-bot

copy-pr-bot Bot commented Nov 5, 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.

@romintomasetti
romintomasetti force-pushed the scheduler-tag-in-concept branch from deedc74 to 993e13a Compare November 5, 2026 11:02
Comment on lines +246 to +247
STATIC_REQUIRE(ex::scheduler<my_behavioral_scheduler>);
STATIC_REQUIRE(ex::sender<decltype(ex::schedule(my_behavioral_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.

This now fails to compile.

@ericniebler I guess this defeats the principle of the explicit opt-in tag?

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.

See your comment #2256 (comment):

The scheduler concept requires the scheduler_concept nested alias. See [exec.sched]. I think the right fix here is for all of the schedulers in stdexec to provide that nested alias.

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.

I mean, it seems that my_behavioral_scheduler *should not model the scheduler concept (because it has the behavior of a scheduler, but not the scheduler_concept alias).

@ericniebler

ericniebler commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

while agree with this PR in principle, it means that in practice some user-defined schedulers will suddenly stop satisfying the concept. i do not like breaking my users, at least not without some warning.

my preference would be a deprecation warning for schedulers that fail to provide the nested alias. this could be achieved with a test in schedule_t::operator(). after some time, we can strengthen the scheduler concept as you've shown here.

This is some sort of followup of NVIDIA#2256.

Signed-off-by: romintomasetti <romin.tomasetti@gmail.com>
@romintomasetti
romintomasetti force-pushed the scheduler-tag-in-concept branch from 993e13a to 63f7a24 Compare November 5, 2026 17:42
@romintomasetti

Copy link
Copy Markdown
Contributor Author

@ericniebler Sure!

I just pushed a new version that does exactly that: provide 2 overloads of the schedule_t::operator(), with the one for schedulers that don't provide the nested alias marked as deprecated.

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.

2 participants