Skip to content

MB-59670: GPU-Accelerated Vector Search#2236

Open
CascadingRadium wants to merge 8 commits intomasterfrom
gpu
Open

MB-59670: GPU-Accelerated Vector Search#2236
CascadingRadium wants to merge 8 commits intomasterfrom
gpu

Conversation

@CascadingRadium
Copy link
Member

@CascadingRadium CascadingRadium commented Nov 6, 2025

@CascadingRadium CascadingRadium changed the title Support GPU-Accelerated Vector Search GPU-Accelerated Vector Search Nov 6, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds GPU acceleration support for vector field indexing and searching. The changes enable users to specify whether GPU should be used for vector operations through a new configuration field.

Key changes:

  • Added GPU boolean field to FieldMapping struct for configuration
  • Extended vector field constructors to accept and store GPU parameter
  • Added GPU() getter method to VectorField for accessing the GPU configuration

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
mapping/field.go Added GPU boolean field to FieldMapping struct with JSON tag
mapping/mapping_vectors.go Updated vector field creation to pass fm.GPU parameter
document/field_vector.go Added gpu field to VectorField struct, updated constructors with GPU parameter, and added GPU() getter method
document/field_vector_base64.go Updated NewVectorBase64Field constructor to accept and forward GPU parameter
Comments suppressed due to low confidence (1)

document/field_vector_base64.go:163

  • VectorBase64Field is missing a GPU() method to match the pattern of delegating VectorField interface methods. Since VectorBase64Field already exposes other VectorField methods like IndexOptimizedFor(), Similarity(), Dims(), and Vector(), it should also expose the GPU() method for API consistency. Add the following method after line 163:\n\ngo\nfunc (n *VectorBase64Field) GPU() bool {\n\treturn n.vectorField.GPU()\n}\n
func (n *VectorBase64Field) IndexOptimizedFor() string {
	return n.vectorField.IndexOptimizedFor()
}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@CascadingRadium CascadingRadium changed the title MB-68591: GPU-Accelerated Vector Search MB-59670: GPU-Accelerated Vector Search Feb 5, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}
if field.UseGPU != fieldAlias.UseGPU {
return fmt.Errorf("field: '%s', invalid alias "+
"(different useGPU values %v and %v)", fieldAlias.Name,
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message uses 'fieldAlias.Name' to report the field name, but this is inconsistent with other error messages in the same function. All other error messages in validateVectorFieldAlias use 'effectiveFieldName' to report the field being validated. This inconsistency could cause confusion since fieldAlias.Name might be empty or differ from the effective field name used elsewhere in validation errors.

Suggested change
"(different useGPU values %v and %v)", fieldAlias.Name,
"(different useGPU values %v and %v)", effectiveFieldName,

Copilot uses AI. Check for mistakes.
return nil, fmt.Errorf("vectorIndexOptimizedFor cannot be updated for vector and vector_base64 fields")
}
if original.UseGPU != updated.UseGPU {
return nil, fmt.Errorf("useGPU cannot be updated for vector and vector_base64 fields")
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message uses "useGPU" to refer to this field, but the JSON tag is "gpu" and the struct field is "UseGPU". Other similar error messages in the codebase use the exact field property name or descriptive text. For consistency with line 512's error message "vectorIndexOptimizedFor cannot be updated", this should use "gpu cannot be updated" or maintain the same camelCase style as the JSON tag throughout.

Suggested change
return nil, fmt.Errorf("useGPU cannot be updated for vector and vector_base64 fields")
return nil, fmt.Errorf("gpu cannot be updated for vector and vector_base64 fields")

Copilot uses AI. Check for mistakes.
Comment on lines +514 to +516
if original.UseGPU != updated.UseGPU {
return nil, fmt.Errorf("useGPU cannot be updated for vector and vector_base64 fields")
}
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new UseGPU field validation logic lacks test coverage. The TestCompareFieldMapping function in index_update_test.go has comprehensive test cases for similar vector field properties like VectorIndexOptimizedFor (see line 127-142), but no test case exists for the UseGPU field. A test case should be added to verify that changing UseGPU for vector or vector_base64 fields correctly returns an error, following the same pattern as the VectorIndexOptimizedFor test.

Copilot uses AI. Check for mistakes.
Comment on lines +268 to +272
if field.UseGPU != fieldAlias.UseGPU {
return fmt.Errorf("field: '%s', invalid alias "+
"(different useGPU values %v and %v)", fieldAlias.Name,
field.UseGPU, fieldAlias.UseGPU)
}
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new UseGPU alias validation logic lacks test coverage. The TestVectorFieldAliasValidation function in mapping/mapping_vectors_test.go has comprehensive test cases for other vector field properties including VectorIndexOptimizedFor (see test "different_optimization_alias" at line 180-207), but no test case exists to verify that fields with different UseGPU values are correctly rejected as invalid aliases. A test case should be added to ensure this validation works as expected.

Copilot uses AI. Check for mistakes.

SynonymSource string `json:"synonym_source,omitempty"`

// Flag that indicates whether to use GPU for field indexing and searching
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new GPU field lacks documentation. Similar vector field properties like VectorIndexOptimizedFor are documented in docs/vectors.md (line 32) and docs/index_update.md (line 24). The GPU field should be documented in both locations:

  1. docs/vectors.md should mention the gpu field option alongside other vector field properties
  2. docs/index_update.md should include gpu in the list of non-updatable vector field properties on line 24, updating it to mention that "Vector and VectorBase64 fields changing dims, similarity, vectorIndexOptimizedFor or gpu"
Suggested change
// Flag that indicates whether to use GPU for field indexing and searching
// Applicable to vector fields only - enables GPU acceleration for indexing
// and searching when the "gpu" field option is set in the mapping.

Copilot uses AI. Check for mistakes.
@CascadingRadium CascadingRadium moved this from Todo to In Progress in GPU-Accelerated Vector Search Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants