enhance: add score compute consistency config for knowhere (#32997)

issue: https://github.com/milvus-io/milvus/issues/32583
related: #32584

Signed-off-by: xianliang.li <xianliang.li@zilliz.com>
pull/33011/head
foxspy 2024-05-13 14:21:31 +08:00 committed by GitHub
parent 4031abd2fa
commit f6777267e3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 41 additions and 1 deletions

View File

@ -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.

View File

@ -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);

View File

@ -25,6 +25,9 @@ KnowhereInitImpl(const char*);
std::string
KnowhereSetSimdType(const char*);
void
EnableKnowhereScoreConsistency();
void
KnowhereInitBuildThreadPool(const uint32_t);

View File

@ -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, [&]() {

View File

@ -34,6 +34,9 @@ SegcoreSetNprobe(const int64_t);
char*
SegcoreSetSimdType(const char*);
void
SegcoreEnableKnowhereScoreConsistency();
void
SegcoreSetKnowhereBuildThreadPoolNum(const uint32_t num_threads);

View File

@ -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}")

View File

@ -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)

View File

@ -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",

View File

@ -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)