|
23 | 23 |
|
24 | 24 | #if defined USE_NVIDIA_CUVS |
25 | 25 | #include <raft/core/device_resources.hpp> |
26 | | -#include <rmm/mr/device/managed_memory_resource.hpp> |
27 | | -#include <rmm/mr/device/per_device_resource.hpp> |
28 | | -#include <rmm/mr/host/pinned_memory_resource.hpp> |
| 26 | +#include <rmm/mr/managed_memory_resource.hpp> |
| 27 | +#include <rmm/mr/per_device_resource.hpp> |
| 28 | +#include <rmm/mr/pinned_host_memory_resource.hpp> |
29 | 29 | #include <memory> |
30 | 30 | #endif |
31 | 31 |
|
@@ -93,7 +93,7 @@ StandardGpuResourcesImpl::StandardGpuResourcesImpl() |
93 | 93 | : |
94 | 94 | #if defined USE_NVIDIA_CUVS |
95 | 95 | mmr_(new rmm::mr::managed_memory_resource), |
96 | | - pmr_(new rmm::mr::pinned_memory_resource), |
| 96 | + pmr_(new rmm::mr::pinned_host_memory_resource), |
97 | 97 | #endif |
98 | 98 | pinnedMemAlloc_(nullptr), |
99 | 99 | pinnedMemAllocSize_(0), |
@@ -164,7 +164,7 @@ StandardGpuResourcesImpl::~StandardGpuResourcesImpl() { |
164 | 164 |
|
165 | 165 | if (pinnedMemAlloc_) { |
166 | 166 | #if defined USE_NVIDIA_CUVS |
167 | | - pmr_->deallocate(pinnedMemAlloc_, pinnedMemAllocSize_); |
| 167 | + pmr_->deallocate_sync(pinnedMemAlloc_, pinnedMemAllocSize_); |
168 | 168 | #else |
169 | 169 | auto err = cudaFreeHost(pinnedMemAlloc_); |
170 | 170 | FAISS_ASSERT_FMT( |
@@ -350,7 +350,7 @@ void StandardGpuResourcesImpl::initializeForDevice(int device) { |
350 | 350 | // pinned memory allocation |
351 | 351 | if (defaultStreams_.empty() && pinnedMemSize_ > 0) { |
352 | 352 | try { |
353 | | - pinnedMemAlloc_ = pmr_->allocate(pinnedMemSize_); |
| 353 | + pinnedMemAlloc_ = pmr_->allocate_sync(pinnedMemSize_); |
354 | 354 | } catch (const std::bad_alloc& rmm_ex) { |
355 | 355 | FAISS_THROW_MSG("CUDA memory allocation error"); |
356 | 356 | } |
@@ -549,7 +549,7 @@ void* StandardGpuResourcesImpl::allocMemory(const AllocRequest& req) { |
549 | 549 | rmm::mr::device_memory_resource* current_mr = |
550 | 550 | rmm::mr::get_per_device_resource( |
551 | 551 | rmm::cuda_device_id{adjReq.device}); |
552 | | - p = current_mr->allocate_async(adjReq.size, adjReq.stream); |
| 552 | + p = current_mr->allocate(adjReq.stream, adjReq.size); |
553 | 553 | adjReq.mr = current_mr; |
554 | 554 | } catch (const std::bad_alloc& rmm_ex) { |
555 | 555 | FAISS_THROW_MSG("CUDA memory allocation error"); |
@@ -584,7 +584,7 @@ void* StandardGpuResourcesImpl::allocMemory(const AllocRequest& req) { |
584 | 584 | // TODO: change this to use the current device resource once RMM has |
585 | 585 | // a way to retrieve a "guaranteed" managed memory resource for a |
586 | 586 | // device. |
587 | | - p = mmr_->allocate_async(adjReq.size, adjReq.stream); |
| 587 | + p = mmr_->allocate(adjReq.stream, adjReq.size); |
588 | 588 | adjReq.mr = mmr_.get(); |
589 | 589 | } catch (const std::bad_alloc& rmm_ex) { |
590 | 590 | FAISS_THROW_MSG("CUDA memory allocation error"); |
@@ -648,7 +648,7 @@ void StandardGpuResourcesImpl::deallocMemory(int device, void* p) { |
648 | 648 | req.space == MemorySpace::Device || |
649 | 649 | req.space == MemorySpace::Unified) { |
650 | 650 | #if defined USE_NVIDIA_CUVS |
651 | | - req.mr->deallocate_async(p, req.size, req.stream); |
| 651 | + req.mr->deallocate(req.stream, p, req.size); |
652 | 652 | #else |
653 | 653 | auto err = cudaFree(p); |
654 | 654 | FAISS_ASSERT_FMT( |
|
0 commit comments