Commit bee37170 authored by Yukikaze-CZR's avatar Yukikaze-CZR
Browse files

IP search metric_type shouldn't be supported by IVF_PQ index on GPU version #616 #636

parent 41f3604e
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -43,7 +43,9 @@ Please mark all change in change log and use the ticket from JIRA.
- \#599 - Build index log is incorrect
- \#602 - Optimizer specify wrong gpu_id
- \#606 - No log generated during building index with CPU
- \#616 - IP search metric_type is not supported by IVF_PQ index
- \#631 - FAISS isn't compiled with O3 option
- \#636 - [CPU] Create index PQ should be failed if table metric type set Inner Product

## Feature
- \#12 - Pure CPU version for Milvus
+4 −0
Original line number Diff line number Diff line
@@ -32,6 +32,10 @@ namespace knowhere {
IndexModelPtr
GPUIVFPQ::Train(const DatasetPtr& dataset, const Config& config) {
    auto build_cfg = std::dynamic_pointer_cast<IVFPQCfg>(config);
    if (build_cfg->metric_type == knowhere::METRICTYPE::IP) {
        KNOWHERE_LOG_ERROR << "PQ not support IP in GPU version!";
        throw KnowhereException("PQ not support IP in GPU version!");
    }
    if (build_cfg != nullptr) {
        build_cfg->CheckValid();  // throw exception
    }
+2 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
// under the License.

#include "wrapper/gpu/GPUVecImpl.h"
#include <src/wrapper/WrapperException.h>
#include "knowhere/common/Exception.h"
#include "knowhere/index/vector_index/IndexGPUIDMAP.h"
#include "knowhere/index/vector_index/IndexGPUIVF.h"
@@ -58,6 +59,7 @@ IVFMixIndex::BuildAll(const int64_t& nb, const float* xb, const int64_t* ids, co
        }
    } catch (knowhere::KnowhereException& e) {
        WRAPPER_LOG_ERROR << e.what();
        throw WrapperException(e.what());
        return Status(KNOWHERE_UNEXPECTED_ERROR, e.what());
    } catch (std::exception& e) {
        WRAPPER_LOG_ERROR << e.what();
+13 −0
Original line number Diff line number Diff line
@@ -336,6 +336,19 @@ TEST_F(DBTest, SEARCH_TEST) {
    }
#endif

    index.engine_type_ = (int)milvus::engine::EngineType::FAISS_PQ;
    db_->CreateIndex(TABLE_NAME, index);  // wait until build index finish

    {
        std::vector<std::string> tags;
        milvus::engine::ResultIds result_ids;
        milvus::engine::ResultDistances result_distances;
        stat = db_->Query(TABLE_NAME, tags, k, nq, 10, xq.data(), result_ids, result_distances);
        ASSERT_TRUE(stat.ok());
        stat = db_->Query(TABLE_NAME, tags, k, 1100, 10, xq.data(), result_ids, result_distances);
        ASSERT_TRUE(stat.ok());
    }

    {  // search by specify index file
        milvus::engine::meta::DatesT dates;
        std::vector<std::string> file_ids = {"1", "2", "3", "4", "5", "6"};