Add Distance functions for RISC-V Vector extensions#44
Merged
marcobambini merged 14 commits intosqliteai:mainfrom Feb 24, 2026
Merged
Add Distance functions for RISC-V Vector extensions#44marcobambini merged 14 commits intosqliteai:mainfrom
marcobambini merged 14 commits intosqliteai:mainfrom
Conversation
HWCAP_NEON does not seem to be defined for the RISCV-64 arch (understandably). To avoid build issues hide it behind the ifdef
Member
|
@afonso360, we love to support RISC-V. Thanks a lot for the contribution! |
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.
👋 Hey,
This PR Implements a new distance backend for the RISC-V Vector extenstions.
Unlike more common SIMD architectures, RVV has no defined vector register size at compile time, therefore we use a strip-mining approach to iterate on the input vectors and process as much data as possible per iteration.
There's a few more optimizations that could be done here, namely for the hamming distance adding a special implementation with
Zvbb(which contains the popcnt instruction).And additionally adding another set of implementations with the f16 and bf16 extensions, for native support.
The current implementations just expand the values to f64 like is done in other backends.
I've also added some more exact distance tests so I could make sure that this implementation works, however they are not very complete, there may still be bugs.