Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,28 @@ jobs:
path: dist/*
# after the upload, so dist/test-unit stays out of the artifact
- run: make test-unit
build-linux-aarch64-extension:
needs: memory-gate # Require memory tests to pass
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
persist-credentials: false
- uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7.1.6
with:
enable-cache: true
- run: ./scripts/vendor.sh
- run: make loadable static
# Ubuntu's system Python links the system SQLite (3.45.1 on 24.04); uv's
# managed Python bundles a newer one, as on the macOS runners
- run: uv sync --locked --managed-python --directory tests
- run: make test-loadable python=./tests/.venv/bin/python
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: sqlite-vec-linux-aarch64-extension
path: dist/*
# after the upload, so dist/test-unit stays out of the artifact
- run: make test-unit
build-macos-x86_64-extension:
runs-on: macos-15-intel
steps:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Changed

- Reading a vector column without a KNN query, as in `select embedding from v`, reads each chunk's vectors through one blob handle instead of opening the chunk's blob again for every row: selecting every vector of a 10,000-row `float[768]` table took 25 ms instead of 2,080 ms, and `select vec_distance_cosine(embedding, ?) from v` 41 ms instead of 2,093 ms.
- The linux-arm64 and linux-arm64-musl binaries use NEON, as the darwin-arm64 binary does: `make` enables it on Linux arm64, and `OMIT_SIMD=1` builds without it. An L2 KNN query on a 100,000-row `float[768]` table took 19 ms instead of 57 ms there. L1 and Hamming distances are unchanged, but `float32` L2 distances can differ from 2.1.1's in the last digits, closer to the exact value (at 768 dimensions, a mean relative error of 3.0e-8 instead of 1.7e-7), so a KNN query can order rows with nearly equal distances differently; `int8` L2 distances whose squared differences sum past 2^24 are computed from the exact sum.

### Fixed

Expand Down
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Run `./scripts/vendor.sh` first to download vendored dependencies (sqlite3.c, sh
- Set `AR=` to use a different archiver (default: ar)

**SIMD control:**
- SIMD is auto-enabled on Darwin x86_64 (AVX) and Darwin arm64 (NEON)
- SIMD is auto-enabled on Darwin x86_64 (AVX), Darwin arm64 (NEON), and Linux arm64 (NEON)
- Set `OMIT_SIMD=1` to disable SIMD optimizations

### Testing
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,16 @@ else
# Windows: -ldl not needed (Win32 API), math is linked by default
endif

# ── SIMD (auto-enabled on Apple Silicon and x86_64 Mac) ──────────────────────────
# ── SIMD (auto-enabled on Apple Silicon, arm64 Linux and x86_64 Mac) ─────────────
# NEON is in the arm64 baseline (GCC and Clang define __ARM_NEON for aarch64
# with no -m flag), so the Linux build needs only the define.
ifndef OMIT_SIMD
ifeq ($(shell uname -sm),Darwin x86_64)
CFLAGS += -mavx -DSQLITE_VEC_ENABLE_AVX
else ifeq ($(shell uname -sm),Darwin arm64)
CFLAGS += -mcpu=apple-m1 -DSQLITE_VEC_ENABLE_NEON
else ifeq ($(shell uname -sm),Linux aarch64)
CFLAGS += -DSQLITE_VEC_ENABLE_NEON
endif
endif

Expand Down