Skip to content

Add Distance functions for RISC-V Vector extensions#44

Merged
marcobambini merged 14 commits intosqliteai:mainfrom
afonso360:riscv-rvv
Feb 24, 2026
Merged

Add Distance functions for RISC-V Vector extensions#44
marcobambini merged 14 commits intosqliteai:mainfrom
afonso360:riscv-rvv

Conversation

@afonso360
Copy link
Contributor

@afonso360 afonso360 commented Feb 23, 2026

👋 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.

@marcobambini marcobambini merged commit d9c89b6 into sqliteai:main Feb 24, 2026
@marcobambini
Copy link
Member

@afonso360, we love to support RISC-V. Thanks a lot for the contribution!

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.

2 participants