Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions include/nvexec/stream/continues_on.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -172,15 +172,13 @@ namespace nv::execution::_strm
template <class Sender>
struct source_sender : stream_sender_base
{
using schedule_from_sender_t = __result_of<schedule_from, Sender>;

explicit source_sender(Sender sndr)
: sndr_(schedule_from(static_cast<Sender&&>(sndr)))
: sndr_(static_cast<Sender&&>(sndr))
{}

template <__decay_copyable Self, STDEXEC::receiver Receiver>
STDEXEC_EXPLICIT_THIS_BEGIN(auto connect)(this Self&& self, Receiver rcvr)
-> connect_result_t<__copy_cvref_t<Self, schedule_from_sender_t>, Receiver>
-> connect_result_t<__copy_cvref_t<Self, Sender>, Receiver>
{
return STDEXEC::connect(static_cast<Self&&>(self).sndr_, static_cast<Receiver&&>(rcvr));
}
Expand All @@ -201,7 +199,7 @@ namespace nv::execution::_strm
}

private:
__result_of<schedule_from, Sender> sndr_;
Sender sndr_;
};

template <class... Ty>
Expand Down
1 change: 1 addition & 0 deletions test/nvexec/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#=============================================================================

set(nvexec_test_sources
continues_on.cpp
bulk.cpp
ensure_started.cpp
start_detached.cpp
Expand Down
37 changes: 37 additions & 0 deletions test/nvexec/continues_on.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include <catch2/catch_all.hpp>
#include <stdexec/execution.hpp>

#include "nvexec/stream_context.cuh"

namespace
{
TEST_CASE("continues on after just", "[cuda][stream][adaptors][continues_on]")
{
nvexec::stream_context ctx;

auto sndr = STDEXEC::just() | STDEXEC::continues_on(ctx.get_scheduler());

STDEXEC::sync_wait(std::move(sndr));
}

TEST_CASE("continues on after schedule", "[cuda][stream][adaptors][continues_on]")
{
nvexec::stream_context ctx;

auto sndr = STDEXEC::schedule(ctx.get_scheduler())
| STDEXEC::continues_on(ctx.get_scheduler());

STDEXEC::sync_wait(std::move(sndr));
}

TEST_CASE("continues on twice in a row", "[cuda][stream][adaptors][continues_on]")
{
nvexec::stream_context ctx;

auto sndr = STDEXEC::just()
| STDEXEC::continues_on(ctx.get_scheduler())
| STDEXEC::continues_on(ctx.get_scheduler());

STDEXEC::sync_wait(std::move(sndr));
}
} // namespace
Loading