Closed achirkin closed 2 weeks ago
CC @cjnolet @benfred do you have any objections to this? I may be missing some context on why the previous implementation was based on thrust.
The problem is encountered in https://github.com/rapidsai/cuvs/pull/261, which uses a custom container as a workaround at the moment.
Thanks, that's a good point! I've looked at the RMM resources and there were two pinned memory resources, so I was not sure which not to use. But perhaps more importantly, they have the stream semantics in their API, which is a bit misleading in the context of pinned arrays, which are created on the host and do not offer any stream ordering.
It's also worth noting, that we don't need the .resize()
functionality for the mdarrays, which makes the implementation extremely simple compared to RMM.
/merge
thrust::host_vector
initializes its elements at creation and requires the element type be default-constructible. This translates toraft::pinned_mdarray
and makes the mdarray unusable for non-default-constructible objects, likecuda::atomic<>
(and many user-defined types). This is against all other mdarray types in raft, which are based onrmm::device_uvector
and are not initialized at construction time. The PR changes the underlying container to a plain pointer + cudaMallocHost/cudaFreeHost.Breaking change: if anyone relies on the
pinned_mdarray
to initialize itself, the code will break (but mdarrays should not initialize at construction in raft anyway). The affected classes have different private members now, so the ABI changes as well.