Feat/fork join executor p2300 bridge#7260
Feat/fork join executor p2300 bridge#7260shivansh023023 wants to merge 3 commits intoTheHPXProject:masterfrom
Conversation
Add executor_scheduler infrastructure (executor_scheduler,
executor_sender, executor_operation_state) that wraps any HPX
executor as a P2300 scheduler. This enables executors to participate
in sender/receiver pipelines via stdexec::schedule().
Add a get_scheduler tag_invoke overload to fork_join_executor that
returns an executor_scheduler<fork_join_executor>. This allows:
fork_join_executor exec{};
auto sched = get_scheduler(exec);
sync_wait(then(schedule(sched), []{ return 42; }));
The tag_invoke uses a default template parameter with a requires
clause to defer instantiation of the incomplete executor_scheduler
return type, following the established pattern from the parallel
and sequenced executor bridges.
New files:
- executor_scheduler.hpp: Full scheduler/sender/operation_state impl
- fwd/executor_scheduler_fwd.hpp: Forward declarations only
Modified files:
- fork_join_executor.hpp: Add fwd include + get_scheduler friend
- fork_join_executor.cpp: Add test_get_scheduler() with 3 subtests
- CMakeLists.txt: Register new headers
Up to standards ✅🟢 Issues
|
|
Can one of the admins verify this patch? |
| exec.shared_data_->async_invoke( | ||
| HPX_FORWARD(F, f), HPX_FORWARD(Ts, ts)...); |
There was a problem hiding this comment.
Calling sync_invoke instead saves creating a ready-future that is discarded right away.
| exec.shared_data_->async_invoke( | |
| HPX_FORWARD(F, f), HPX_FORWARD(Ts, ts)...); | |
| exec.shared_data_->sync_invoke( | |
| HPX_FORWARD(F, f), HPX_FORWARD(Ts, ts)...); |
| template <> | ||
| struct is_bulk_two_way_executor<fork_join_executor> : std::true_type | ||
| { | ||
| }; |
There was a problem hiding this comment.
Since you have added an implementation of post_t, we can also add:
template <>
struct is_never_blocking_one_way_executor<fork_join_executor> : std::true_type
{
};
| #include <hpx/algorithm.hpp> | ||
| #include <hpx/chrono.hpp> | ||
| #include <hpx/execution.hpp> | ||
| #include <hpx/executors/executor_scheduler.hpp> |
There was a problem hiding this comment.
Please never #include any of the module-internal headers directly. This will cause problems whenever C++ modules are enabled.
| #include <hpx/executors/executor_scheduler.hpp> | |
| #include <hpx/modules/executors.hpp> |
| HPX_CXX_CORE_EXPORT template <typename Executor, typename Receiver> | ||
| struct executor_operation_state; | ||
|
|
||
| } // namespace hpx::execution::experimental |
There was a problem hiding this comment.
There is no need to place this header into its own directory. It already has _fwd in its name.
|
Thank you for the reviews! I have addressed all feedback: Replaced Moved Replaced the internal I initially added |
executors: Add P2300
get_schedulerbridge forfork_join_executorFixes #5219 (partial)
Proposed Changes
tag_invoke(get_scheduler_t, fork_join_executor const&)outside the class body, returning
executor_scheduler<fork_join_executor>, so that the return type isfully defined at point of use
executor_scheduler_fwd.hppinclude with the fullexecutor_scheduler.hppto ensure type completenesstag_invoke(post_t, fork_join_executor const&)delegating toasync_invokeso the genericexecutor_scheduleroperation statecan dispatch work onto the fork_join thread pool
fork_join_executorunit tests withtest_get_scheduler()verifying scheduler acquisition, work dispatch, and thread identity
Background
fork_join_executoris one of HPX's primary performance executors usedfor NUMA-aware work-stealing. Without a
get_schedulerbridge it cannotparticipate in P2300 pipelines using
continues_on,transfer, orlet_value. After this PR:This follows the pattern established for
sequenced_executor(#7238)and
parallel_executor(#7239).Checklist