Skip to content

Commit

Permalink
modifications on multiple files, temporary commit
Browse files Browse the repository at this point in the history
  • Loading branch information
isidorostsa committed Apr 26, 2024
1 parent 59b5170 commit 36bfaf7
Show file tree
Hide file tree
Showing 22 changed files with 1,306 additions and 294 deletions.
2 changes: 0 additions & 2 deletions libs/core/execution/include/hpx/execution/algorithms/bulk.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
#ifdef HPX_HAVE_STDEXEC
#include <hpx/execution_base/stdexec_forward.hpp>
#else
#endif

#if 1
#include <hpx/concepts/concepts.hpp>
#include <hpx/datastructures/tuple.hpp>
#include <hpx/datastructures/variant.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,16 @@ namespace hpx::execution::experimental::detail {
friend constexpr HPX_FORCEINLINE auto operator|(
U&& u, partial_algorithm_base p)
{
#ifdef HPX_HAVE_STDEXEC
auto scheduler =
hpx::execution::experimental::get_completion_scheduler<
hpx::execution::experimental::set_value_t>(u);
hpx::execution::experimental::set_value_t>(
hpx::execution::experimental::get_env(u));
#else
auto scheduler =
hpx::execution::experimental::get_completion_scheduler<
hpx::execution::experimental::set_value_t>(u);
#endif

return HPX_MOVE(p).invoke(HPX_MOVE(scheduler), HPX_FORWARD(U, u));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,13 @@ namespace hpx::execution::experimental {
struct keep_future_sender_base
{
std::decay_t<Future> future;

#ifdef HPX_HAVE_STDEXEC
using completion_signatures =
hpx::execution::experimental::completion_signatures<
set_value_t(std::decay_t<Future>),
set_error_t(std::exception_ptr)
>;
#else
struct completion_signatures
{
template <template <typename...> class Tuple,
Expand All @@ -78,6 +84,7 @@ namespace hpx::execution::experimental {

static constexpr bool sends_stopped = false;
};
#endif
};

template <typename Future>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ namespace hpx::execution::experimental {
template <typename Data>
struct future_receiver_base
{
using is_receiver = void;
hpx::intrusive_ptr<Data> data;

protected:
Expand Down Expand Up @@ -155,10 +156,21 @@ namespace hpx::execution::experimental {
template <typename Sender>
future_data_with_run_loop(init_no_addref no_addref,
other_allocator const& alloc,
#ifdef HPX_HAVE_STDEXEC
decltype(std::declval<
hpx::execution::experimental::run_loop>().get_scheduler()
) const& sched,
#else
hpx::execution::experimental::run_loop_scheduler const& sched,
#endif
Sender&& sender)
: base_type(no_addref, alloc, HPX_FORWARD(Sender, sender))
, loop(sched.get_run_loop())
#ifdef HPX_HAVE_STDEXEC
, loop(*hpx::execution::experimental::get_env(
schedule(sched)).__loop_)
#else
, loop(sched.get_run_loop())
#endif
{
this->set_on_completed([this]() { loop.finish(); });
}
Expand Down Expand Up @@ -218,7 +230,13 @@ namespace hpx::execution::experimental {
///////////////////////////////////////////////////////////////////////
template <typename Sender, typename Allocator>
auto make_future_with_run_loop(
#ifdef HPX_HAVE_STDEXEC
decltype(std::declval<
hpx::execution::experimental::run_loop>().get_scheduler()
) const& sched,
#else
hpx::execution::experimental::run_loop_scheduler const& sched,
#endif
Sender&& sender, Allocator const& allocator)
{
using allocator_type = Allocator;
Expand All @@ -245,6 +263,13 @@ namespace hpx::execution::experimental {
other_allocator alloc(allocator);
unique_ptr p(allocator_traits::allocate(alloc, 1),
hpx::util::allocator_deleter<other_allocator>{alloc});
/*
* p.get() ->
* hpx::execution::experimental::detail::future_data_with_run_loop
* <int, std::allocator<char>, stdexec::__detail::__op_state<stdexec
* ::__sexpr<{}, stdexec::(anonymous namespace)::__anon>,
* hpx::execution::experimental::detail::future_receiver<int>>> *
*/

allocator_traits::construct(alloc, p.get(), init_no_addref{}, alloc,
sched, HPX_FORWARD(Sender, sender));
Expand Down Expand Up @@ -319,9 +344,15 @@ namespace hpx::execution::experimental {
friend constexpr HPX_FORCEINLINE auto tag_override_invoke(make_future_t,
Sender&& sender, Allocator const& allocator = Allocator{})
{
#ifdef HPX_HAVE_STDEXEC
auto scheduler =
hpx::execution::experimental::get_completion_scheduler<
hpx::execution::experimental::set_value_t>(hpx::execution::experimental::get_env(sender));
#else
auto scheduler =
hpx::execution::experimental::get_completion_scheduler<
hpx::execution::experimental::set_value_t>(sender);
#endif

return hpx::functional::tag_invoke(make_future_t{},
HPX_MOVE(scheduler), HPX_FORWARD(Sender, sender), allocator);
Expand All @@ -335,7 +366,13 @@ namespace hpx::execution::experimental {
)>
// clang-format on
friend auto tag_invoke(make_future_t,
#ifdef HPX_HAVE_STDEXEC
decltype(std::declval<
hpx::execution::experimental::run_loop>().get_scheduler()
) const& sched,
#else
hpx::execution::experimental::run_loop_scheduler const& sched,
#endif
Sender&& sender, Allocator const& allocator = Allocator{})
{
return detail::make_future_with_run_loop(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@

namespace hpx::this_thread::experimental {
using hpx::execution::experimental::sync_wait_t;
using hpx::execution::experimental::sync_wait;

sync_wait_t const sync_wait{};
using hpx::execution::experimental::sync_wait_with_variant_t;
using hpx::execution::experimental::sync_wait_with_variant;
}
#else

Expand Down
2 changes: 2 additions & 0 deletions libs/core/execution/src/run_loop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include <hpx/execution/algorithms/run_loop.hpp>

#ifndef HPX_HAVE_STDEXEC
///////////////////////////////////////////////////////////////////////////////
namespace hpx::execution::experimental::detail {

Expand All @@ -22,3 +23,4 @@ namespace hpx::execution::experimental::detail {
}
}
} // namespace hpx::execution::experimental::detail
#endif
Loading

0 comments on commit 36bfaf7

Please sign in to comment.