From b6b56a08528debac57479141cf8b45b784978ff5 Mon Sep 17 00:00:00 2001 From: "shengjun.li" <49774184+shengjun1985@users.noreply.github.com> Date: Thu, 18 Jun 2020 16:56:34 +0800 Subject: [PATCH] Support IVF_PQ on GPU with using metric_type IP (#2593) * Support IVF_PQ on GPU with using metric_type IP Signed-off-by: shengjun.li * remove useless code Signed-off-by: shengjun.li --- CHANGELOG.md | 1 + .../knowhere/index/vector_index/ConfAdapter.cpp | 9 ++------- .../server/delivery/request/CreateIndexRequest.cpp | 14 -------------- core/unittest/db/test_rpc.cpp | 8 -------- 4 files changed, 3 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cb62dbf2bf..4b25b41618 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ Please mark all changes in change log and use the issue from GitHub - \#2319 Redo metadata to support MVCC - \#2509 Count up query statistics for debug ease - \#2572 Support structured data index +- \#2585 Support IVF_PQ on GPU with using metric_type IP ## Improvement - \#2543 Remove secondary_path related code diff --git a/core/src/index/knowhere/knowhere/index/vector_index/ConfAdapter.cpp b/core/src/index/knowhere/knowhere/index/vector_index/ConfAdapter.cpp index 5d038c3710..43c66f6ade 100644 --- a/core/src/index/knowhere/knowhere/index/vector_index/ConfAdapter.cpp +++ b/core/src/index/knowhere/knowhere/index/vector_index/ConfAdapter.cpp @@ -138,16 +138,11 @@ IVFPQConfAdapter::CheckTrain(Config& oricfg, const IndexMode mode) { static int64_t DEFAULT_NBITS = 8; static int64_t MAX_NLIST = 999999; static int64_t MIN_NLIST = 1; - static std::vector CPU_METRICS{knowhere::Metric::L2, knowhere::Metric::IP}; - static std::vector GPU_METRICS{knowhere::Metric::L2}; + static std::vector METRICS{knowhere::Metric::L2, knowhere::Metric::IP}; oricfg[knowhere::IndexParams::nbits] = DEFAULT_NBITS; - if (mode == IndexMode::MODE_GPU) { - CheckStrByValues(knowhere::Metric::TYPE, GPU_METRICS); - } else { - CheckStrByValues(knowhere::Metric::TYPE, CPU_METRICS); - } + CheckStrByValues(knowhere::Metric::TYPE, METRICS); CheckIntByRange(knowhere::meta::DIM, DEFAULT_MIN_DIM, DEFAULT_MAX_DIM); CheckIntByRange(knowhere::meta::ROWS, DEFAULT_MIN_ROWS, DEFAULT_MAX_ROWS); CheckIntByRange(knowhere::IndexParams::nlist, MIN_NLIST, MAX_NLIST); diff --git a/core/src/server/delivery/request/CreateIndexRequest.cpp b/core/src/server/delivery/request/CreateIndexRequest.cpp index ab5b92ad70..c668a78b56 100644 --- a/core/src/server/delivery/request/CreateIndexRequest.cpp +++ b/core/src/server/delivery/request/CreateIndexRequest.cpp @@ -96,20 +96,6 @@ CreateIndexRequest::OnExecute() { } } -#ifdef MILVUS_GPU_VERSION - Status s; - bool enable_gpu = false; - server::Config& config = server::Config::GetInstance(); - s = config.GetGpuResourceConfigEnable(enable_gpu); - fiu_do_on("CreateIndexRequest.OnExecute.ip_meteric", - collection_info.metric_type_ = static_cast(engine::MetricType::IP)); - - if (s.ok() && adapter_index_type == (int)engine::EngineType::FAISS_PQ && - collection_info.metric_type_ == (int)engine::MetricType::IP) { - return Status(SERVER_UNEXPECTED_ERROR, "PQ not support IP in GPU version!"); - } -#endif - rc.RecordSection("check validation"); // step 3: create index diff --git a/core/unittest/db/test_rpc.cpp b/core/unittest/db/test_rpc.cpp index d76566ef11..e7e31873d4 100644 --- a/core/unittest/db/test_rpc.cpp +++ b/core/unittest/db/test_rpc.cpp @@ -245,14 +245,6 @@ TEST_F(RpcHandlerTest, INDEX_TEST) { ASSERT_TRUE(grpc_status.ok()); fiu_disable("CreateIndexRequest.OnExecute.create_index_fail"); -#ifdef MILVUS_GPU_VERSION - request.set_index_type(static_cast(milvus::engine::EngineType::FAISS_PQ)); - fiu_enable("CreateIndexRequest.OnExecute.ip_meteric", 1, NULL, 0); - grpc_status = handler->CreateIndex(&context, &request, &response); - ASSERT_TRUE(grpc_status.ok()); - fiu_disable("CreateIndexRequest.OnExecute.ip_meteric"); -#endif - ::milvus::grpc::CollectionName collection_name; ::milvus::grpc::IndexParam index_param; handler->DescribeIndex(&context, &collection_name, &index_param);