Loading cpp/build-support/lint_exclusions.txt +1 −2 Original line number Diff line number Diff line Loading @@ -7,4 +7,3 @@ *SqliteMetaImpl.cpp *src/grpc* *src/core* No newline at end of file *src/wrapper* No newline at end of file cpp/src/wrapper/ConfAdapter.cpp +22 −22 Original line number Diff line number Diff line Loading @@ -15,13 +15,14 @@ // specific language governing permissions and limitations // under the License. #include "wrapper/ConfAdapter.h" #include "knowhere/index/vector_index/helpers/IndexParameter.h" #include "utils/Log.h" #include <cmath> #include "ConfAdapter.h" #include "src/utils/Log.h" #include "knowhere/index/vector_index/helpers/IndexParameter.h" #include <memory> // TODO: add conf checker // TODO(lxj): add conf checker namespace zilliz { namespace milvus { Loading Loading @@ -95,10 +96,9 @@ IVFConfAdapter::MatchSearch(const TempMetaConf &metaconf, const IndexType &type) case IndexType::FAISS_IVFPQ_GPU: if (conf->nprobe > GPU_MAX_NRPOBE) { WRAPPER_LOG_WARNING << "When search with GPU, nprobe shoud be no more than " << GPU_MAX_NRPOBE << ", but you passed " << conf->nprobe << ". Search with " << GPU_MAX_NRPOBE << " instead"; << ", but you passed " << conf->nprobe << ". Search with " << GPU_MAX_NRPOBE << " instead"; conf->nprobe = GPU_MAX_NRPOBE; } } return conf; Loading Loading @@ -160,6 +160,6 @@ NSGConfAdapter::MatchSearch(const TempMetaConf &metaconf, const IndexType &type) return conf; } } } } } // namespace engine } // namespace milvus } // namespace zilliz cpp/src/wrapper/ConfAdapter.h +19 −17 Original line number Diff line number Diff line Loading @@ -15,12 +15,12 @@ // specific language governing permissions and limitations // under the License. #pragma once #include "knowhere/common/Config.h" #include "VecIndex.h" #include "knowhere/common/Config.h" #include <memory> namespace zilliz { namespace milvus { Loading Loading @@ -51,7 +51,8 @@ class ConfAdapter { // Dump(){} protected: static void MatchBase(knowhere::Config conf); static void MatchBase(knowhere::Config conf); }; using ConfAdapterPtr = std::shared_ptr<ConfAdapter>; Loading @@ -65,7 +66,8 @@ class IVFConfAdapter : public ConfAdapter { MatchSearch(const TempMetaConf& metaconf, const IndexType& type) override; protected: static int64_t MatchNlist(const int64_t &size, const int64_t &nlist); static int64_t MatchNlist(const int64_t& size, const int64_t& nlist); }; class IVFSQConfAdapter : public IVFConfAdapter { Loading @@ -89,6 +91,6 @@ class NSGConfAdapter : public IVFConfAdapter { MatchSearch(const TempMetaConf& metaconf, const IndexType& type) final; }; } } } } // namespace engine } // namespace milvus } // namespace zilliz cpp/src/wrapper/ConfAdapterMgr.cpp +9 −11 Original line number Diff line number Diff line Loading @@ -15,10 +15,8 @@ // specific language governing permissions and limitations // under the License. #include "src/utils/Exception.h" #include "ConfAdapterMgr.h" #include "wrapper/ConfAdapterMgr.h" #include "utils/Exception.h" namespace zilliz { namespace milvus { Loading @@ -26,7 +24,8 @@ namespace engine { ConfAdapterPtr AdapterMgr::GetAdapter(const IndexType& indexType) { if (!init_) RegisterAdapter(); if (!init_) RegisterAdapter(); auto it = table_.find(indexType); if (it != table_.end()) { Loading @@ -36,8 +35,8 @@ AdapterMgr::GetAdapter(const IndexType &indexType) { } } #define REGISTER_CONF_ADAPTER(T, KEY, NAME) static AdapterMgr::register_t<T> reg_##NAME##_(KEY) void AdapterMgr::RegisterAdapter() { init_ = true; Loading @@ -58,7 +57,6 @@ AdapterMgr::RegisterAdapter() { REGISTER_CONF_ADAPTER(NSGConfAdapter, IndexType::NSG_MIX, nsg_mix); } } // engine } // milvus } // zilliz } // namespace engine } // namespace milvus } // namespace zilliz cpp/src/wrapper/ConfAdapterMgr.h +11 −16 Original line number Diff line number Diff line Loading @@ -15,12 +15,13 @@ // specific language governing permissions and limitations // under the License. #pragma once #include "VecIndex.h" #include "ConfAdapter.h" #include "VecIndex.h" #include <map> #include <memory> namespace zilliz { namespace milvus { Loading @@ -31,9 +32,7 @@ class AdapterMgr { template <typename T> struct register_t { explicit register_t(const IndexType& key) { AdapterMgr::GetInstance().table_.emplace(key, [] { return std::make_shared<T>(); }); AdapterMgr::GetInstance().table_.emplace(key, [] { return std::make_shared<T>(); }); } }; Loading @@ -54,10 +53,6 @@ class AdapterMgr { std::map<IndexType, std::function<ConfAdapterPtr()> > table_; }; } // engine } // milvus } // zilliz } // namespace engine } // namespace milvus } // namespace zilliz Loading
cpp/build-support/lint_exclusions.txt +1 −2 Original line number Diff line number Diff line Loading @@ -7,4 +7,3 @@ *SqliteMetaImpl.cpp *src/grpc* *src/core* No newline at end of file *src/wrapper* No newline at end of file
cpp/src/wrapper/ConfAdapter.cpp +22 −22 Original line number Diff line number Diff line Loading @@ -15,13 +15,14 @@ // specific language governing permissions and limitations // under the License. #include "wrapper/ConfAdapter.h" #include "knowhere/index/vector_index/helpers/IndexParameter.h" #include "utils/Log.h" #include <cmath> #include "ConfAdapter.h" #include "src/utils/Log.h" #include "knowhere/index/vector_index/helpers/IndexParameter.h" #include <memory> // TODO: add conf checker // TODO(lxj): add conf checker namespace zilliz { namespace milvus { Loading Loading @@ -95,10 +96,9 @@ IVFConfAdapter::MatchSearch(const TempMetaConf &metaconf, const IndexType &type) case IndexType::FAISS_IVFPQ_GPU: if (conf->nprobe > GPU_MAX_NRPOBE) { WRAPPER_LOG_WARNING << "When search with GPU, nprobe shoud be no more than " << GPU_MAX_NRPOBE << ", but you passed " << conf->nprobe << ". Search with " << GPU_MAX_NRPOBE << " instead"; << ", but you passed " << conf->nprobe << ". Search with " << GPU_MAX_NRPOBE << " instead"; conf->nprobe = GPU_MAX_NRPOBE; } } return conf; Loading Loading @@ -160,6 +160,6 @@ NSGConfAdapter::MatchSearch(const TempMetaConf &metaconf, const IndexType &type) return conf; } } } } } // namespace engine } // namespace milvus } // namespace zilliz
cpp/src/wrapper/ConfAdapter.h +19 −17 Original line number Diff line number Diff line Loading @@ -15,12 +15,12 @@ // specific language governing permissions and limitations // under the License. #pragma once #include "knowhere/common/Config.h" #include "VecIndex.h" #include "knowhere/common/Config.h" #include <memory> namespace zilliz { namespace milvus { Loading Loading @@ -51,7 +51,8 @@ class ConfAdapter { // Dump(){} protected: static void MatchBase(knowhere::Config conf); static void MatchBase(knowhere::Config conf); }; using ConfAdapterPtr = std::shared_ptr<ConfAdapter>; Loading @@ -65,7 +66,8 @@ class IVFConfAdapter : public ConfAdapter { MatchSearch(const TempMetaConf& metaconf, const IndexType& type) override; protected: static int64_t MatchNlist(const int64_t &size, const int64_t &nlist); static int64_t MatchNlist(const int64_t& size, const int64_t& nlist); }; class IVFSQConfAdapter : public IVFConfAdapter { Loading @@ -89,6 +91,6 @@ class NSGConfAdapter : public IVFConfAdapter { MatchSearch(const TempMetaConf& metaconf, const IndexType& type) final; }; } } } } // namespace engine } // namespace milvus } // namespace zilliz
cpp/src/wrapper/ConfAdapterMgr.cpp +9 −11 Original line number Diff line number Diff line Loading @@ -15,10 +15,8 @@ // specific language governing permissions and limitations // under the License. #include "src/utils/Exception.h" #include "ConfAdapterMgr.h" #include "wrapper/ConfAdapterMgr.h" #include "utils/Exception.h" namespace zilliz { namespace milvus { Loading @@ -26,7 +24,8 @@ namespace engine { ConfAdapterPtr AdapterMgr::GetAdapter(const IndexType& indexType) { if (!init_) RegisterAdapter(); if (!init_) RegisterAdapter(); auto it = table_.find(indexType); if (it != table_.end()) { Loading @@ -36,8 +35,8 @@ AdapterMgr::GetAdapter(const IndexType &indexType) { } } #define REGISTER_CONF_ADAPTER(T, KEY, NAME) static AdapterMgr::register_t<T> reg_##NAME##_(KEY) void AdapterMgr::RegisterAdapter() { init_ = true; Loading @@ -58,7 +57,6 @@ AdapterMgr::RegisterAdapter() { REGISTER_CONF_ADAPTER(NSGConfAdapter, IndexType::NSG_MIX, nsg_mix); } } // engine } // milvus } // zilliz } // namespace engine } // namespace milvus } // namespace zilliz
cpp/src/wrapper/ConfAdapterMgr.h +11 −16 Original line number Diff line number Diff line Loading @@ -15,12 +15,13 @@ // specific language governing permissions and limitations // under the License. #pragma once #include "VecIndex.h" #include "ConfAdapter.h" #include "VecIndex.h" #include <map> #include <memory> namespace zilliz { namespace milvus { Loading @@ -31,9 +32,7 @@ class AdapterMgr { template <typename T> struct register_t { explicit register_t(const IndexType& key) { AdapterMgr::GetInstance().table_.emplace(key, [] { return std::make_shared<T>(); }); AdapterMgr::GetInstance().table_.emplace(key, [] { return std::make_shared<T>(); }); } }; Loading @@ -54,10 +53,6 @@ class AdapterMgr { std::map<IndexType, std::function<ConfAdapterPtr()> > table_; }; } // engine } // milvus } // zilliz } // namespace engine } // namespace milvus } // namespace zilliz