-
-
Notifications
You must be signed in to change notification settings - Fork 542
Implement P2300 bulk adapter for HPX executors #7240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
shivansh023023
wants to merge
7
commits into
TheHPXProject:master
Choose a base branch
from
shivansh023023:feat/p2300-bulk-integration
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
bd5d34b
Implement P2300 bulk adapter for HPX executors
1f4aeee
Address maintainer feedback for PR #7240: fwd header, sender/receiver…
ec7401f
Fix formatting
13e2e82
Migrate from deprecated transform_completion_signatures_of to transfo…
c166077
Fix clang-cl syntax error by moving pragmas outside template declaration
812850e
Fix formatting with clang-format
7ab5571
Modernize PR 7240: Use C++20 requires clause and remove redundant exe…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
142 changes: 142 additions & 0 deletions
142
libs/core/executors/include/hpx/executors/executor_scheduler.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,142 @@ | ||
| // Copyright (c) 2026 The STE||AR-Group | ||
| // | ||
| // SPDX-License-Identifier: BSL-1.0 | ||
| // Distributed under the Boost Software License, Version 1.0. (See accompanying | ||
| // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | ||
|
|
||
| /// \file parallel/executors/executor_scheduler.hpp | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <hpx/config.hpp> | ||
| #include <hpx/executors/fwd/executor_scheduler_fwd.hpp> | ||
| #include <hpx/modules/errors.hpp> | ||
| #include <hpx/modules/execution.hpp> | ||
| #include <hpx/modules/execution_base.hpp> | ||
|
|
||
| #include <concepts> | ||
| #include <exception> | ||
| #include <type_traits> | ||
| #include <utility> | ||
|
|
||
| namespace hpx::execution::experimental { | ||
| /////////////////////////////////////////////////////////////////////////// | ||
| HPX_CXX_CORE_EXPORT template <typename Executor, typename Receiver> | ||
| struct executor_operation_state | ||
| { | ||
| HPX_NO_UNIQUE_ADDRESS std::decay_t<Executor> exec_; | ||
| HPX_NO_UNIQUE_ADDRESS std::decay_t<Receiver> receiver_; | ||
|
|
||
| template <typename Exec, typename Recv> | ||
| executor_operation_state(Exec&& exec, Recv&& recv) | ||
| : exec_(HPX_FORWARD(Exec, exec)) | ||
| , receiver_(HPX_FORWARD(Recv, recv)) | ||
| { | ||
| } | ||
|
|
||
| executor_operation_state(executor_operation_state&&) = delete; | ||
| executor_operation_state(executor_operation_state const&) = delete; | ||
| executor_operation_state& operator=( | ||
| executor_operation_state&&) = delete; | ||
| executor_operation_state& operator=( | ||
| executor_operation_state const&) = delete; | ||
|
|
||
| ~executor_operation_state() = default; | ||
|
|
||
| friend void tag_invoke(start_t, executor_operation_state& os) noexcept | ||
| { | ||
| hpx::detail::try_catch_exception_ptr( | ||
| [&]() { | ||
| hpx::parallel::execution::post(os.exec_, [&os]() mutable { | ||
| hpx::execution::experimental::set_value( | ||
| HPX_MOVE(os.receiver_)); | ||
| }); | ||
| }, | ||
| [&](std::exception_ptr ep) { | ||
| hpx::execution::experimental::set_error( | ||
| HPX_MOVE(os.receiver_), HPX_MOVE(ep)); | ||
| }); | ||
| } | ||
| }; | ||
|
|
||
| /////////////////////////////////////////////////////////////////////////// | ||
| HPX_CXX_CORE_EXPORT template <typename Executor> | ||
| struct executor_sender | ||
| { | ||
| using sender_concept = hpx::execution::experimental::sender_t; | ||
|
|
||
| HPX_NO_UNIQUE_ADDRESS std::decay_t<Executor> exec_; | ||
|
|
||
| using completion_signatures = | ||
| hpx::execution::experimental::completion_signatures< | ||
| hpx::execution::experimental::set_value_t(), | ||
| hpx::execution::experimental::set_error_t(std::exception_ptr)>; | ||
|
|
||
| template <typename Env> | ||
| friend auto tag_invoke( | ||
| hpx::execution::experimental::get_completion_signatures_t, | ||
| executor_sender const&, Env) noexcept -> completion_signatures; | ||
|
|
||
| friend constexpr auto tag_invoke( | ||
| hpx::execution::experimental::get_completion_scheduler_t< | ||
| hpx::execution::experimental::set_value_t>, | ||
| executor_sender const& s) noexcept | ||
| { | ||
| return executor_scheduler<Executor>{s.exec_}; | ||
| } | ||
|
|
||
| template <typename Receiver> | ||
| friend executor_operation_state<Executor, Receiver> tag_invoke( | ||
| connect_t, executor_sender&& s, Receiver&& receiver) | ||
| { | ||
| return {HPX_MOVE(s.exec_), HPX_FORWARD(Receiver, receiver)}; | ||
| } | ||
|
|
||
| template <typename Receiver> | ||
| friend executor_operation_state<Executor, Receiver> tag_invoke( | ||
| connect_t, executor_sender const& s, Receiver&& receiver) | ||
| { | ||
| return {s.exec_, HPX_FORWARD(Receiver, receiver)}; | ||
| } | ||
| }; | ||
|
|
||
| /////////////////////////////////////////////////////////////////////////// | ||
| HPX_CXX_CORE_EXPORT template <typename Executor> | ||
| struct executor_scheduler | ||
| { | ||
| using executor_type = std::decay_t<Executor>; | ||
|
|
||
| HPX_NO_UNIQUE_ADDRESS executor_type exec_; | ||
|
|
||
| constexpr executor_scheduler() = default; | ||
|
|
||
| template <typename Exec> | ||
| requires(!std::is_same_v<std::decay_t<Exec>, executor_scheduler>) | ||
| explicit executor_scheduler(Exec&& exec) | ||
| : exec_(HPX_FORWARD(Exec, exec)) | ||
| { | ||
| } | ||
|
|
||
| constexpr bool operator==(executor_scheduler const& rhs) const noexcept | ||
| { | ||
| return exec_ == rhs.exec_; | ||
| } | ||
|
|
||
| constexpr bool operator!=(executor_scheduler const& rhs) const noexcept | ||
| { | ||
| return !(*this == rhs); | ||
| } | ||
|
|
||
| friend executor_sender<Executor> tag_invoke( | ||
| schedule_t, executor_scheduler&& sched) | ||
| { | ||
| return {HPX_MOVE(sched.exec_)}; | ||
| } | ||
|
|
||
| friend executor_sender<Executor> tag_invoke( | ||
| schedule_t, executor_scheduler const& sched) | ||
| { | ||
| return {sched.exec_}; | ||
| } | ||
| }; | ||
| } // namespace hpx::execution::experimental | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.