From 49ce79c98d9586a280279c89e2ddba7ff98801fd Mon Sep 17 00:00:00 2001 From: Rahul Rampure Date: Thu, 6 Nov 2025 12:49:33 +0530 Subject: [PATCH 1/7] Add GPU Flags --- vector.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/vector.go b/vector.go index 1057cf9..c3177aa 100644 --- a/vector.go +++ b/vector.go @@ -25,6 +25,8 @@ type VectorField interface { Similarity() string // nlist/nprobe config (recall/latency) the index is optimized for IndexOptimizedFor() string + // Whether to use GPU for indexing/searching + GPU() bool } // ----------------------------------------------------------------------------- @@ -68,3 +70,13 @@ var VectorIndexOptimizationsReverseLookup = map[int]string{ 1: IndexOptimizedForLatency, 2: IndexOptimizedForMemoryEfficient, } + +type VectorIndexOptions uint64 + +const ( + FlagUseGPU VectorIndexOptions = 1 << iota +) + +func (vo VectorIndexOptions) UseGPU() bool { + return (vo & FlagUseGPU) != 0 +} From a6e753dc6bf90fb177a2a262ae84798ba4989a14 Mon Sep 17 00:00:00 2001 From: Rahul Rampure Date: Fri, 7 Nov 2025 11:52:06 +0530 Subject: [PATCH 2/7] make gpu part of indexing options --- indexing_options.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/indexing_options.go b/indexing_options.go index 4e92024..be4068f 100644 --- a/indexing_options.go +++ b/indexing_options.go @@ -22,6 +22,7 @@ const ( IncludeTermVectors DocValues SkipFreqNorm + GPU ) const ( @@ -59,6 +60,10 @@ func (o FieldIndexingOptions) SkipFreqNorm() bool { return o&SkipFreqNorm != 0 } +func (o FieldIndexingOptions) UseGPU() bool { + return o&GPU != 0 +} + func (o FieldIndexingOptions) String() string { rv := "" if o.IsIndexed() { @@ -88,5 +93,11 @@ func (o FieldIndexingOptions) String() string { } rv += "FN" } + if !o.UseGPU() { + if rv != "" { + rv += ", " + } + rv += "GPU" + } return rv } From 2a268d5e117cadf8a8cdde5be099e64e83420233 Mon Sep 17 00:00:00 2001 From: Rahul Rampure Date: Fri, 7 Nov 2025 14:56:49 +0530 Subject: [PATCH 3/7] consolidate GPU option to general options --- vector.go | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/vector.go b/vector.go index c3177aa..a647fd6 100644 --- a/vector.go +++ b/vector.go @@ -25,8 +25,8 @@ type VectorField interface { Similarity() string // nlist/nprobe config (recall/latency) the index is optimized for IndexOptimizedFor() string - // Whether to use GPU for indexing/searching - GPU() bool + // Options used for the vector field + Options() FieldIndexingOptions } // ----------------------------------------------------------------------------- @@ -70,13 +70,3 @@ var VectorIndexOptimizationsReverseLookup = map[int]string{ 1: IndexOptimizedForLatency, 2: IndexOptimizedForMemoryEfficient, } - -type VectorIndexOptions uint64 - -const ( - FlagUseGPU VectorIndexOptions = 1 << iota -) - -func (vo VectorIndexOptions) UseGPU() bool { - return (vo & FlagUseGPU) != 0 -} From ca35a35dcd067cb218b7be92eff2be0b55eba60e Mon Sep 17 00:00:00 2001 From: Rahul Rampure Date: Wed, 12 Nov 2025 16:04:56 +0530 Subject: [PATCH 4/7] change type --- indexing_options.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indexing_options.go b/indexing_options.go index be4068f..a9fbbff 100644 --- a/indexing_options.go +++ b/indexing_options.go @@ -14,7 +14,7 @@ package index -type FieldIndexingOptions int +type FieldIndexingOptions uint64 const ( IndexField FieldIndexingOptions = 1 << iota From 8b30f4938bbac41e108e69ed1a39d4ec368e995b Mon Sep 17 00:00:00 2001 From: Rahul Rampure Date: Thu, 13 Nov 2025 18:53:22 +0530 Subject: [PATCH 5/7] Remove Options method from VectorField interface --- vector.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/vector.go b/vector.go index a647fd6..1057cf9 100644 --- a/vector.go +++ b/vector.go @@ -25,8 +25,6 @@ type VectorField interface { Similarity() string // nlist/nprobe config (recall/latency) the index is optimized for IndexOptimizedFor() string - // Options used for the vector field - Options() FieldIndexingOptions } // ----------------------------------------------------------------------------- From 5c26c34ed9b3ce0767c705ea4bff71e5d0433417 Mon Sep 17 00:00:00 2001 From: Rahul Rampure Date: Thu, 13 Nov 2025 19:31:57 +0530 Subject: [PATCH 6/7] support field name --- vector.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vector.go b/vector.go index 1057cf9..97b5146 100644 --- a/vector.go +++ b/vector.go @@ -18,6 +18,9 @@ package index type VectorField interface { + // Name of the vector field + Name() string + // The vector data Vector() []float32 // Dimensionality of the vector Dims() int From f10b3ce168506f9f884be2ce6aa3ee1b02afd39d Mon Sep 17 00:00:00 2001 From: Rahul Rampure Date: Sat, 22 Nov 2025 00:28:42 +0530 Subject: [PATCH 7/7] Update indexing_options.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- indexing_options.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indexing_options.go b/indexing_options.go index a9fbbff..ff27523 100644 --- a/indexing_options.go +++ b/indexing_options.go @@ -93,7 +93,7 @@ func (o FieldIndexingOptions) String() string { } rv += "FN" } - if !o.UseGPU() { + if o.UseGPU() { if rv != "" { rv += ", " }