Skip to content

Commit

Permalink
Fixed #472: Can now enqueue memset's in stream_t using region_t's
Browse files Browse the repository at this point in the history
  • Loading branch information
eyalroz committed Feb 19, 2023
1 parent 6ce302b commit a8cff17
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/cuda/api/stream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ class stream_t {
auto unique_ptr_to_tuple = ::std::unique_ptr<tuple_type>{tuple_ptr}; // Ensures deletion when we leave this function.
auto device_id = ::std::get<0>(*unique_ptr_to_tuple.get());
auto context_handle = ::std::get<1>(*unique_ptr_to_tuple.get());
auto stream_handle = ::std::get<2>(*unique_ptr_to_tuple.get());
auto stream_handle = ::std::get<2>(*unique_ptr_to_tuple.get());
const auto& callable = ::std::get<3>(*unique_ptr_to_tuple.get());
callable( stream_t{device_id, context_handle, stream_handle, do_not_take_ownership} );
}
Expand Down Expand Up @@ -460,6 +460,11 @@ class stream_t {
memory::device::async::detail_::set(destination, byte_value, num_bytes, associated_stream.handle_);
}

void memset(memory::region_t region, int byte_value) const
{
memset(region.data(), byte_value, region.size());
}

/**
* Set all bytes of a certain region in device memory (or unified memory,
* but using the CUDA device to do it) to zero.
Expand All @@ -477,6 +482,11 @@ class stream_t {
memory::device::async::detail_::zero(destination, num_bytes, associated_stream.handle_);
}

void memzero(memory::region_t region) const
{
memzero(region.data(), region.size());
}

/**
* Have an event 'fire', i.e. marked as having occurred,
* after all hereto-scheduled work on this stream has been completed.
Expand Down

0 comments on commit a8cff17

Please sign in to comment.