Skip to content

Commit

Permalink
allocate nvexec::sync_wait op-state in pinned host memory
Browse files Browse the repository at this point in the history
fixes #953
  • Loading branch information
ericniebler committed Jun 11, 2023
1 parent 96bbe3a commit f2887c4
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions include/nvexec/stream/sync_wait.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,24 @@ namespace nvexec::STDEXEC_STREAM_DETAIL_NS { namespace _sync_wait {
state_t state{};
run_loop loop;

exit_operation_state_t<Sender, receiver_t<Sender>> __op_state = exit_op_state(
(Sender&&) __sndr, receiver_t<Sender>{{}, &state, &loop}, context_state);
state.stream_ = __op_state.get_stream();
cudaError_t status = cudaSuccess;
auto __op_state =
make_host<exit_operation_state_t<Sender, receiver_t<Sender>>>(
status,
context_state.pinned_resource_,
__conv{[&] {
return exit_op_state(
(Sender&&) __sndr,
receiver_t<Sender>{{}, &state, &loop},
context_state);
}});
if (status != cudaSuccess) {
throw std::bad_alloc{};
}

state.stream_ = __op_state->get_stream();

start(__op_state);
start(*__op_state);

// Wait for the variant to be filled in.
loop.run();
Expand Down

0 comments on commit f2887c4

Please sign in to comment.