fix: provide the scheduler_concept nested alias on all stdexec schedulers (#2134) - #2256
Conversation
|
Hi @ericniebler — could you run |
|
The scheduler concept requires the |
…VIDIA#2134) Per review feedback on NVIDIA#2256, keep the __semi_scheduler concept in exec/task.hpp requiring the scheduler_concept nested alias, as required by the scheduler concept in [exec.sched], and instead provide that alias on all of stdexec's own schedulers that were missing it: the schedulers of static_thread_pool, thread_pool_base (tbb, taskflow pools), timed_thread_scheduler, libdispatch_scheduler, io_uring_context, windows_thread_pool, trampoline_scheduler, reschedule, parallel_scheduler, and the nvexec stream and multi-GPU stream schedulers. Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
|
Good point — done. 2a5cf76 restores |
…lers (NVIDIA#2134) The scheduler concept in [exec.sched] requires a scheduler_concept nested alias derived from scheduler_tag, and exec::task's internal __any_scheduler conversion checks it via __semi_scheduler. Most of stdexec's schedulers define that typedef, but several did not, so co_starting an exec::task on them failed to compile (see NVIDIA#2134). Add the missing `using scheduler_concept = scheduler_tag;` to the schedulers that lacked it: static_thread_pool, thread_pool_base (also covering the tbb and taskflow pools), timed_thread_scheduler, libdispatch_scheduler, io_uring_context, windows_thread_pool, trampoline_scheduler, reschedule, parallel_scheduler, and the nvexec stream and multi-GPU stream schedulers. Schedulers that already define the alias are unchanged, and include/exec/task.hpp is untouched. Also add regression tests that co_start an exec::task on the schedulers of exec::static_thread_pool and exec::timed_thread_context and verify they run, guarding the fix going forward. Fixes NVIDIA#2134 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
2a5cf76 to
2c7dc69
Compare
|
(Squashed the two commits into a single clean one before review started; the fix described above is now commit 2c7dc69 — content is unchanged.) |
Align the `=` in the time_point/duration aliases and re-indent the new test_task.cpp tests so `clang-format-21 --dry-run --Werror` (the CI style check) passes. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
|
Hi @ericniebler — the clang-format violations you'd have seen on the earlier head are fixed now (7b4b2c5, whitespace-only, verified against clang-format-21 exactly as CI runs it). Could you /ok to test so the workflows can run on the new commit? Thanks! |
|
/ok to test 7b4b2c5 |
|
FYI: the failing |
|
thanks! |
…rs (#2257) * test: add scheduler_concept regression guard for all stdexec schedulers Per [exec.sched], scheduler types should define a nested scheduler_concept alias derived from scheduler_tag. PR #2256 (issue #2134) added the missing aliases; this adds compile-time guards so the requirement cannot regress. - New test/exec/test_scheduler_concept.cpp statically asserts the alias and scheduler<> satisfaction for the always-available schedulers: inline, run_loop, task_scheduler, parallel, static_thread_pool, thread_pool_base (CRTP), timed_thread, trampoline, and the internal reschedule scheduler. - Gated schedulers are asserted in their existing gated test files: io_uring, windows_thread_pool, libdispatch, and the nvexec stream and multi-GPU stream schedulers. Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com> * style: join wrapped TEST_CASE args in test_libdispatch to satisfy clang-format 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com> --------- Co-authored-by: Codebuff <noreply@codebuff.com>
Fixes #2134
What happened
Users couldn't start an
exec::taskon anexec::static_thread_poolorexec::timed_thread_contextscheduler — the code failed to compile:The task's internal
__any_schedulerconverting constructor is guarded by__semi_scheduler, which requires ascheduler_concepttypedef derived fromscheduler_tag. Per [exec.sched], that nested alias is part of theschedulerconcept, so scheduler types are expected to define it — but a number of the schedulers in stdexec did not.The fix (updated after review)
Rather than loosening the internal
__semi_schedulerconcept (the original approach of this PR), this PR now keepsinclude/exec/task.hppexactly as it is onmainand instead makes all of stdexec's own schedulers provide the required nested alias (using scheduler_concept = scheduler_tag;):exec::static_thread_pool::schedulerexec::thread_pool_base<...>::scheduler(also coversexec::tbb::tbb_thread_poolandexec::taskflow::taskflow_thread_pool)exec::timed_thread_schedulerexec::libdispatch_schedulerexec::io_uring_context::__scheduler(Linux)exec::windows_thread_pool::scheduler(Windows)exec::trampoline_scheduler's schedulerexec::reschedule's internal schedulerstdexec::parallel_schedulernvexec::stream_schedulerandnvexec::multi_gpu_stream_schedulerSchedulers that already defined the alias are unchanged (
inline_scheduler,run_loop's scheduler,any_scheduler, and the test-common schedulers).Tests
Two regression tests in
test/exec/test_task.cppco_start anexec::taskonexec::static_thread_poolandexec::timed_thread_contextand verify it actually runs, guarding the fix going forward.Verification
test.exec: 3401 assertions / 359 cases pass (Release, Apple Clang)test.stdexec: 3528 assertions / 619 cases pass