[SIMD] Move native/vec code to C++#138525
Merged
ldematte merged 5 commits intoelastic:mainfrom Nov 25, 2025
Merged
Conversation
Collaborator
|
Pinging @elastic/es-search-relevance (Team:Search Relevance) |
Contributor
Author
|
This is a preliminary step for #138552 |
ChrisHegarty
approved these changes
Nov 25, 2025
Contributor
Author
Yes :) I do promise to keep templating at a minimum, where it makes our code cleaner. |
ncordon
pushed a commit
to ncordon/elasticsearch
that referenced
this pull request
Nov 26, 2025
Native code in the simdvec library is currently a mix of C and C++ code. We found that C++ templates are helpful to reduce source code duplication while retaining a great (sometime even greater) code inlining and expansion (e.g. loop unrolling) that we use to maximize performance. This PR moves all existing C code to C++; in general, it's just a matter of renaming + disabling name mangling, plus renaming of the exported functions. This last operation is needed as they name clash with the "extended" math functions (e.g. cosf32 which is the cosine function over float32_t types). Now all the exported symbols have a vec_ prefix.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Native code in the simdvec library is currently a mix of C and C++ code.
We found that C++ templates are helpful to reduce source code duplication while retaining a great (sometime even greater) code inlining and expansion (e.g. loop unrolling) that we use to maximize performance.
This PR moves all existing C code to C++; in general, it's just a matter of renaming + disabling name mangling, plus renaming of the exported functions. This last operation is needed as they name clash with the "extended" math functions (e.g.
cosf32which is the cosine function overfloat32_ttypes). Now all the exported symbols have avec_prefix.Relates to: #139057