fix sq8h deletion (#1830)

Signed-off-by: sahuang <xiaohai.xu@zilliz.com>
This commit is contained in:
Xiaohai Xu 2020-04-01 20:50:48 +08:00 committed by GitHub
parent a15124d6ab
commit 2fcf2855ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 14 deletions

View File

@ -340,9 +340,14 @@ GpuIndexIVFSQHybrid::searchImpl_(int n,
static_assert(sizeof(long) == sizeof(Index::idx_t), "size mismatch"); static_assert(sizeof(long) == sizeof(Index::idx_t), "size mismatch");
Tensor<long, 2, true> outLabels(const_cast<long*>(labels), {n, k}); Tensor<long, 2, true> outLabels(const_cast<long*>(labels), {n, k});
auto bitsetDevice = toDevice<uint8_t, 1>(resources_, device_, nullptr, stream, {0}); if (!bitset) {
auto bitsetDevice = toDevice<uint8_t, 1>(resources_, device_, nullptr, stream, {0});
index_->query(queries, bitsetDevice, nprobe, k, outDistances, outLabels); index_->query(queries, bitsetDevice, nprobe, k, outDistances, outLabels);
} else {
auto bitsetDevice = toDevice<uint8_t, 1>(resources_, device_,
const_cast<uint8_t*>(bitset->data()), stream,{(int) bitset->size()});
index_->query(queries, bitsetDevice, nprobe, k, outDistances, outLabels);
}
} }
} } // namespace } } // namespace

View File

@ -166,17 +166,15 @@ TEST_P(IVFTest, ivf_basic_gpu) {
AssertAnns(result, nq, k); AssertAnns(result, nq, k);
// PrintResult(result, nq, k); // PrintResult(result, nq, k);
if (index_type_ != milvus::knowhere::IndexEnum::INDEX_FAISS_IVFSQ8H) { faiss::ConcurrentBitsetPtr concurrent_bitset_ptr = std::make_shared<faiss::ConcurrentBitset>(nb);
faiss::ConcurrentBitsetPtr concurrent_bitset_ptr = std::make_shared<faiss::ConcurrentBitset>(nb); for (int64_t i = 0; i < nq; ++i) {
for (int64_t i = 0; i < nq; ++i) { concurrent_bitset_ptr->set(i);
concurrent_bitset_ptr->set(i);
}
index_->SetBlacklist(concurrent_bitset_ptr);
auto result_bs_1 = index_->Query(query_dataset, conf_);
AssertAnns(result_bs_1, nq, k, CheckMode::CHECK_NOT_EQUAL);
// PrintResult(result, nq, k);
} }
index_->SetBlacklist(concurrent_bitset_ptr);
auto result_bs_1 = index_->Query(query_dataset, conf_);
AssertAnns(result_bs_1, nq, k, CheckMode::CHECK_NOT_EQUAL);
// PrintResult(result, nq, k);
#ifdef MILVUS_GPU_VERSION #ifdef MILVUS_GPU_VERSION
milvus::knowhere::FaissGpuResourceMgr::GetInstance().Dump(); milvus::knowhere::FaissGpuResourceMgr::GetInstance().Dump();

View File

@ -75,7 +75,8 @@ DeleteByIDRequest::OnExecute() {
table_schema.engine_type_ != (int32_t)engine::EngineType::FAISS_IVFFLAT && table_schema.engine_type_ != (int32_t)engine::EngineType::FAISS_IVFFLAT &&
table_schema.engine_type_ != (int32_t)engine::EngineType::FAISS_BIN_IVFFLAT && table_schema.engine_type_ != (int32_t)engine::EngineType::FAISS_BIN_IVFFLAT &&
table_schema.engine_type_ != (int32_t)engine::EngineType::FAISS_IVFSQ8 && table_schema.engine_type_ != (int32_t)engine::EngineType::FAISS_IVFSQ8 &&
table_schema.engine_type_ != (int32_t)engine::EngineType::FAISS_PQ) { table_schema.engine_type_ != (int32_t)engine::EngineType::FAISS_PQ &&
table_schema.engine_type_ != (int32_t)engine::EngineType::FAISS_IVFSQ8H) {
std::string err_msg = std::string err_msg =
"Index type " + std::to_string(table_schema.engine_type_) + " does not support delete operation"; "Index type " + std::to_string(table_schema.engine_type_) + " does not support delete operation";
SERVER_LOG_ERROR << err_msg; SERVER_LOG_ERROR << err_msg;