fix crash when GPU search (#3074)

* fix crash when GPU search

Signed-off-by: shengjun.li <shengjun.li@zilliz.com>
This commit is contained in:
shengjun.li 2020-07-31 09:46:55 +08:00 committed by GitHub
parent b1b1165c56
commit 09cf1b323e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 0 deletions

View File

@ -8,6 +8,7 @@ Please mark all change in change log and use the issue from GitHub
- \#2890 Fix the index size caculation in cache
- \#2952 Fix the result merging of IVF_PQ IP
- \#2975 Fix config UT failed
- \#3012 If the cache is too small, queries using multiple GPUs will cause to crash
## Feature

View File

@ -588,6 +588,11 @@ ExecutionEngineImpl::CopyToGpu(uint64_t device_id, bool hybrid) {
bool gpu_cache_enable = false;
STATUS_CHECK(server::Config::GetInstance().GetGpuResourceConfigCacheEnable(gpu_cache_enable));
/* CopyCpuToGpu() is an asynchronous method.
* It should be make sure that the CPU index is always valid.
* Therefore, we reserve its shared pointer.
*/
index_reserve_ = index_;
if (gpu_cache_enable) {
gpu_cache_mgr->Reserve(index_->Size());
index_ = knowhere::cloner::CopyCpuToGpu(index_, device_id, knowhere::Config());

View File

@ -123,6 +123,9 @@ class ExecutionEngineImpl : public ExecutionEngine {
protected:
knowhere::VecIndexPtr index_ = nullptr;
#ifdef MILVUS_GPU_VERSION
knowhere::VecIndexPtr index_reserve_ = nullptr; // reserve the cpu index before copying it to gpu
#endif
std::string location_;
int64_t dim_;
EngineType index_type_;