diff --git a/configs/milvus.yaml b/configs/milvus.yaml index fa3e887ec3..e33c93ee3f 100644 --- a/configs/milvus.yaml +++ b/configs/milvus.yaml @@ -312,6 +312,8 @@ queryNode: publishInterval: 1000 # Interval for querynode to report node information (milliseconds) segcore: knowhereThreadPoolNumRatio: 4 # The number of threads in knowhere's thread pool. If disk is enabled, the pool size will multiply with knowhereThreadPoolNumRatio([1, 32]). + # used for zilliz-cloud ; please ignore it for open source. + knowhereScoreConsistency: false chunkRows: 128 # The number of vectors in a chunk. interimIndex: enableIndex: true # Enable segment build with index to accelerate vector search when segment is in growing or binlog. diff --git a/internal/core/src/config/ConfigKnowhere.cpp b/internal/core/src/config/ConfigKnowhere.cpp index 47fa65ad3b..29d0f1134e 100644 --- a/internal/core/src/config/ConfigKnowhere.cpp +++ b/internal/core/src/config/ConfigKnowhere.cpp @@ -73,6 +73,11 @@ KnowhereSetSimdType(const char* value) { } } +void +EnableKnowhereScoreConsistency() { + knowhere::KnowhereConfig::EnablePatchForComputeFP32AsBF16(); +} + void KnowhereInitBuildThreadPool(const uint32_t num_threads) { knowhere::KnowhereConfig::SetBuildThreadPoolSize(num_threads); diff --git a/internal/core/src/config/ConfigKnowhere.h b/internal/core/src/config/ConfigKnowhere.h index d9e8df1fd7..eff8be76f9 100644 --- a/internal/core/src/config/ConfigKnowhere.h +++ b/internal/core/src/config/ConfigKnowhere.h @@ -25,6 +25,9 @@ KnowhereInitImpl(const char*); std::string KnowhereSetSimdType(const char*); +void +EnableKnowhereScoreConsistency(); + void KnowhereInitBuildThreadPool(const uint32_t); diff --git a/internal/core/src/segcore/segcore_init_c.cpp b/internal/core/src/segcore/segcore_init_c.cpp index 8b4a5071b2..060d3e5f32 100644 --- a/internal/core/src/segcore/segcore_init_c.cpp +++ b/internal/core/src/segcore/segcore_init_c.cpp @@ -79,6 +79,11 @@ SegcoreSetSimdType(const char* value) { return ret; } +extern "C" void +SegcoreEnableKnowhereScoreConsistency() { + milvus::config::EnableKnowhereScoreConsistency(); +} + extern "C" void SegcoreCloseGlog() { std::call_once(close_glog_once, [&]() { diff --git a/internal/core/src/segcore/segcore_init_c.h b/internal/core/src/segcore/segcore_init_c.h index 5f6e10ed1a..d617d796a8 100644 --- a/internal/core/src/segcore/segcore_init_c.h +++ b/internal/core/src/segcore/segcore_init_c.h @@ -34,6 +34,9 @@ SegcoreSetNprobe(const int64_t); char* SegcoreSetSimdType(const char*); +void +SegcoreEnableKnowhereScoreConsistency(); + void SegcoreSetKnowhereBuildThreadPoolNum(const uint32_t num_threads); diff --git a/internal/core/thirdparty/knowhere/CMakeLists.txt b/internal/core/thirdparty/knowhere/CMakeLists.txt index dd9bee56e3..28485dfc68 100644 --- a/internal/core/thirdparty/knowhere/CMakeLists.txt +++ b/internal/core/thirdparty/knowhere/CMakeLists.txt @@ -12,7 +12,7 @@ #------------------------------------------------------------------------------- # Update KNOWHERE_VERSION for the first occurrence -set( KNOWHERE_VERSION f29da89 ) +set( KNOWHERE_VERSION ee2e166 ) set( GIT_REPOSITORY "https://github.com/zilliztech/knowhere.git") message(STATUS "Knowhere repo: ${GIT_REPOSITORY}") message(STATUS "Knowhere version: ${KNOWHERE_VERSION}") diff --git a/internal/querynodev2/server.go b/internal/querynodev2/server.go index 108eb22c1e..1f26770f46 100644 --- a/internal/querynodev2/server.go +++ b/internal/querynodev2/server.go @@ -200,6 +200,11 @@ func (node *QueryNode) InitSegcore() error { C.SegcoreSetSimdType(cSimdType) C.free(unsafe.Pointer(cSimdType)) + enableKnowhereScoreConsistency := paramtable.Get().QueryNodeCfg.KnowhereScoreConsistency.GetAsBool() + if enableKnowhereScoreConsistency { + C.SegcoreEnableKnowhereScoreConsistency() + } + // override segcore index slice size cIndexSliceSize := C.int64_t(paramtable.Get().CommonCfg.IndexSliceSize.GetAsInt64()) C.InitIndexSliceSize(cIndexSliceSize) diff --git a/pkg/util/paramtable/component_param.go b/pkg/util/paramtable/component_param.go index a6134d1c7e..83d14c9d8f 100644 --- a/pkg/util/paramtable/component_param.go +++ b/pkg/util/paramtable/component_param.go @@ -2006,6 +2006,8 @@ type queryNodeConfig struct { InterimIndexMemExpandRate ParamItem `refreshable:"false"` InterimIndexBuildParallelRate ParamItem `refreshable:"false"` + KnowhereScoreConsistency ParamItem `refreshable:"false"` + // memory limit LoadMemoryUsageFactor ParamItem `refreshable:"true"` OverloadedMemoryThresholdPercentage ParamItem `refreshable:"false"` @@ -2159,6 +2161,16 @@ func (p *queryNodeConfig) init(base *BaseTable) { } p.EnableTempSegmentIndex.Init(base.mgr) + p.KnowhereScoreConsistency = ParamItem{ + Key: "queryNode.segcore.knowhereScoreConsistency", + Version: "2.3.15", + DefaultValue: "false", + Doc: "Enable knowhere strong consistency score computation logic", + Export: true, + } + + p.KnowhereScoreConsistency.Init(base.mgr) + p.InterimIndexNlist = ParamItem{ Key: "queryNode.segcore.interimIndex.nlist", Version: "2.0.0", diff --git a/pkg/util/paramtable/component_param_test.go b/pkg/util/paramtable/component_param_test.go index 2fb6d2de5c..c7aea9fb82 100644 --- a/pkg/util/paramtable/component_param_test.go +++ b/pkg/util/paramtable/component_param_test.go @@ -355,6 +355,11 @@ func TestComponentParam(t *testing.T) { enableInterimIndex = Params.EnableTempSegmentIndex.GetAsBool() assert.Equal(t, true, enableInterimIndex) + assert.Equal(t, false, Params.KnowhereScoreConsistency.GetAsBool()) + params.Save("queryNode.segcore.knowhereScoreConsistency", "true") + assert.Equal(t, true, Params.KnowhereScoreConsistency.GetAsBool()) + params.Save("queryNode.segcore.knowhereScoreConsistency", "false") + nlist = Params.InterimIndexNlist.GetAsInt64() assert.Equal(t, int64(128), nlist)