Skip to content

Commit e878fe5

Browse files
authored
enhance: Set the default GPU version autoindex to use the CAgra index (#41906)
issue: #41907 Signed-off-by: yusheng.ma <[email protected]>
1 parent e04e5b4 commit e878fe5

File tree

4 files changed

+64
-10
lines changed

4 files changed

+64
-10
lines changed

internal/util/indexparamcheck/constraints.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ const (
3939
CagraGraphDegree = "graph_degree"
4040
CagraBuildAlgo = "build_algo"
4141

42-
CargaBuildAlgoIVFPQ = "IVF_PQ"
43-
CargaBuildAlgoNNDESCENT = "NN_DESCENT"
42+
CagraBuildAlgoIVFPQ = "IVF_PQ"
43+
CagraBuildAlgoNNDESCENT = "NN_DESCENT"
4444

4545
// Sparse Index Param
4646
SparseDropRatioBuild = "drop_ratio_build"
@@ -64,7 +64,7 @@ var (
6464
BinIvfMetrics = []string{metric.HAMMING, metric.JACCARD} // const
6565
HnswMetrics = []string{metric.L2, metric.IP, metric.COSINE} // const
6666
RaftMetrics = []string{metric.L2, metric.IP}
67-
CagraBuildAlgoTypes = []string{CargaBuildAlgoIVFPQ, CargaBuildAlgoNNDESCENT}
67+
CagraBuildAlgoTypes = []string{CagraBuildAlgoIVFPQ, CagraBuildAlgoNNDESCENT}
6868
supportDimPerSubQuantizer = []int{32, 28, 24, 20, 16, 12, 10, 8, 6, 4, 3, 2, 1} // const
6969
supportSubQuantizer = []int{96, 64, 56, 48, 40, 32, 28, 24, 20, 16, 12, 8, 4, 3, 2, 1} // const
7070
SparseMetrics = []string{metric.IP, metric.BM25} // const

pkg/util/paramtable/autoindex_param.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,7 @@ func (p *AutoIndexConfig) init(base *BaseTable) {
8686
}
8787
p.EnableResultLimitCheck.Init(base.mgr)
8888

89-
p.IndexParams = ParamItem{
90-
Key: "autoIndex.params.build",
91-
Version: "2.2.0",
92-
DefaultValue: `{"M": 18,"efConstruction": 240,"index_type": "HNSW", "metric_type": "COSINE"}`,
93-
Formatter: GetBuildParamFormatter(FloatVectorDefaultMetricType, "autoIndex.params.build"),
94-
Export: true,
95-
}
89+
p.IndexParams = GetIndexParam()
9690
p.IndexParams.Init(base.mgr)
9791

9892
p.SparseIndexParams = ParamItem{
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Licensed to the LF AI & Data foundation under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing, software
12+
// distributed under the License is distributed on an "AS IS" BASIS,
13+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
// See the License for the specific language governing permissions and
15+
// limitations under the License.
16+
17+
//go:build cuda
18+
// +build cuda
19+
20+
package paramtable
21+
22+
func GetIndexParam() ParamItem {
23+
return ParamItem{
24+
Key: "autoIndex.params.build",
25+
Version: "2.2.0",
26+
DefaultValue: `{"intermediate_graph_degree":64, "graph_degree": 32, "index_type": "GPU_CAGRA", "metric_type": "COSINE"}`,
27+
Formatter: GetBuildParamFormatter(FloatVectorDefaultMetricType, "autoIndex.params.build"),
28+
Export: true,
29+
}
30+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Licensed to the LF AI & Data foundation under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing, software
12+
// distributed under the License is distributed on an "AS IS" BASIS,
13+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
// See the License for the specific language governing permissions and
15+
// limitations under the License.
16+
17+
//go:build !cuda
18+
// +build !cuda
19+
20+
package paramtable
21+
22+
func GetIndexParam() ParamItem {
23+
return ParamItem{
24+
Key: "autoIndex.params.build",
25+
Version: "2.2.0",
26+
DefaultValue: `{"M": 18,"efConstruction": 240,"index_type": "HNSW", "metric_type": "COSINE"}`,
27+
Formatter: GetBuildParamFormatter(FloatVectorDefaultMetricType, "autoIndex.params.build"),
28+
Export: true,
29+
}
30+
}

0 commit comments

Comments
 (0)