Skip to content

MB-72542: Fallback to CPU vector search if k > 2048 for a GPU index#429

Merged
capemox merged 1 commit into
masterfrom
fiass_gpu_max_k
Jun 23, 2026
Merged

MB-72542: Fallback to CPU vector search if k > 2048 for a GPU index#429
capemox merged 1 commit into
masterfrom
fiass_gpu_max_k

Conversation

@capemox

@capemox capemox commented Jun 23, 2026

Copy link
Copy Markdown
Member

Faiss's GPU impl sets a max k value of 2048, and errors out for values higher than it. In case k is higher, the request falls back to the CPU index.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 prevents Faiss GPU vector searches from erroring when k exceeds the GPU implementation limit (2048) by explicitly falling back to the CPU index for large top‑k requests.

Changes:

  • Introduces a maxGPUSearchK constant documenting Faiss GPU’s maximum supported k.
  • Updates GPU index search routing to use GPU only when k <= 2048 (and no selector/params), otherwise falls back to CPU.
  • Clarifies fallback comment to include the “k too large” case.

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

Comment thread faiss_vector_index_gpu_float32.go
@capemox capemox merged commit c4cc2f0 into master Jun 23, 2026
10 checks passed
@capemox capemox deleted the fiass_gpu_max_k branch June 23, 2026 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants