Skip to content

Conversation

@thecoop
Copy link
Member

@thecoop thecoop commented Feb 24, 2025

Followon from #122381, introduce vectorized operations for float-byte comparisons

JMH shows a ~16x speedup:

Benchmark                                  (dims)  (docType)  (function)  (queryType)  (type)  Mode  Cnt    Score   Error  Units
DistanceFunctionBenchmark.benchmark          1024       BYTE         DOT        FLOAT  BINARY  avgt    2  880.346          ns/op
DistanceFunctionBenchmark.vectorBenchmark    1024       BYTE         DOT        FLOAT  BINARY  avgt    2   55.105          ns/op

Unrolling the loop doesn't give any additional performance benefit here, so I've left it as-is (it looks like hotspot may already be unrolling it itself)

@thecoop thecoop force-pushed the float-byte-vector-op branch from e6a2e19 to ff2e0e2 Compare March 3, 2025 10:38
@thecoop thecoop added the :Search Relevance/Vectors Vector search label Mar 3, 2025
@thecoop thecoop marked this pull request as ready for review March 3, 2025 10:45
@elasticsearchmachine elasticsearchmachine added the Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch label Mar 3, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-search-relevance (Team:Search Relevance)

@benwtrent
Copy link
Member

Not sure how to test as part of Elasticsearch, as this is new functionality we don't have performance tests for these operations yet...

We should at a minimum add some clauses here: ESVectorUtilTests (missing for some other things I think). This way we capture that we are actually doing the math correct with various random vector sizes.

For performance, we should add a new JMH benchmark if possible for folks to run in the future.

@benwtrent benwtrent requested a review from ChrisHegarty March 3, 2025 19:11
@thecoop thecoop requested a review from benwtrent March 7, 2025 11:52
@thecoop
Copy link
Member Author

thecoop commented Mar 7, 2025

The JMH tests need some rework to support heterogenous types - let me take a closer look at the infrastructure...

@thecoop
Copy link
Member Author

thecoop commented Mar 10, 2025

JMH tests refactored in #124351 ready for this implementation

@thecoop thecoop merged commit 2ba9e9f into elastic:main Mar 24, 2025
17 checks passed
@thecoop thecoop deleted the float-byte-vector-op branch March 24, 2025 10:30
omricohenn pushed a commit to omricohenn/elasticsearch that referenced this pull request Mar 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>non-issue :Search Relevance/Vectors Vector search Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants