Skip to content

Commit 45c0498

Browse files
authored
Merge branch 'main' into fix-strided-reduction-block-count
2 parents ca9829b + c7e7678 commit 45c0498

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

cpp/include/raft/core/device_container_policy.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
namespace RAFT_EXPORT raft {
3131
/**
3232
* @brief A simplified version of thrust::device_reference with support for CUDA stream.
33+
*
34+
* @note This proxy performs H2D or D2H transfer and a synchronization on the given
35+
* stream on every access.
3336
*/
3437
template <typename T>
3538
class device_reference {
@@ -53,12 +56,14 @@ class device_reference {
5356
auto* raw = ptr_.get();
5457
value_type v{};
5558
update_host(&v, raw, 1, stream_);
59+
raft::interruptible::synchronize(stream_);
5660
return v;
5761
}
5862
auto operator=(T const& other) -> device_reference&
5963
{
6064
auto* raw = ptr_.get();
6165
update_device(raw, &other, 1, stream_);
66+
raft::interruptible::synchronize(stream_);
6267
return *this;
6368
}
6469
};

cpp/include/raft/core/device_mdarray.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,9 @@ auto make_device_scalar(raft::resources const& handle)
150150

151151
/**
152152
* @brief Create a device scalar from v
153-
* (async copy in the resource-provided stream).
153+
*
154+
* @note This function performs a H2D copy and implicitly synchronizes the resource's stream,
155+
* which impacts performance when there's unfinished work in the stream.
154156
*
155157
* @tparam ElementType the data type of the scalar element
156158
* @tparam IndexType the index type of the extents

0 commit comments

Comments
 (0)