Skip to content
Draft
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
24 changes: 22 additions & 2 deletions .github/workflows/build-lance-context.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,23 @@ jobs:
rm lance-linalg.tar.gz
patch -p1 -d lance-linalg-7.0.0-riscv64 < python-wheels/patches/lance-context/${{ env.LANCE_CONTEXT_VERSION }}/0004-lance-linalg-riscv64-simd-fallback.patch

# From 0.6.6 on, crates/lance-context-core depends on `lance = "9.0.0"`
# directly while `lancedb = "0.30.0"` still pulls in the 7.0.0 line,
# so both lines get compiled and both need a riscv64-fixed copy; the
# 9.0.0 pair's patches (0005/0006) exist only in those versions' dirs.
PATCHES=python-wheels/patches/lance-context/${{ env.LANCE_CONTEXT_VERSION }}
if [ -f "$PATCHES/0005-lance-core-9.0.0-riscv64-simd-fallback.patch" ]; then
for crate in lance-core:0005 lance-linalg:0006; do
name=${crate%%:*}
num=${crate##*:}
curl -fsSL -A "python-wheels (https://github.com/riseproject-dev/python-wheels)" -o "$name.tar.gz" "https://crates.io/api/v1/crates/$name/9.0.0/download"
mkdir "$name-9.0.0-riscv64"
tar xzf "$name.tar.gz" -C "$name-9.0.0-riscv64" --strip-components=1
rm "$name.tar.gz"
patch -p1 -d "$name-9.0.0-riscv64" < "$PATCHES/$num-$name-9.0.0-riscv64-simd-fallback.patch"
done
fi

git apply python-wheels/patches/lance-context/${{ env.LANCE_CONTEXT_VERSION }}/0003-cargo-patch-lance-crates-for-riscv64.patch

- name: Free disk space
Expand Down Expand Up @@ -172,10 +189,13 @@ jobs:
# `pytest -v` from python/, no extra flags). test_rollout_remote.py
# skips itself when target/debug/lance-context-server hasn't been
# built, which it isn't here (that crate is a workspace member
# neither the Python wheel nor its tests otherwise need).
# neither the Python wheel nor its tests otherwise need). From 0.6.6
# on that check lives in tests/conftest.py's `server` fixture and
# turns into a hard failure whenever `CI` is set, so `CI` is unset
# for pytest to keep the same skip.
CIBW_TEST_COMMAND: >-
cd python &&
python -m pytest tests -v
env -u CI python -m pytest tests -v

- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
Expand Down
2 changes: 2 additions & 0 deletions docs/packages/lance-context.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ versions:
- filename: lance_context-0.6.5-cp39-abi3-manylinux_2_39_riscv64.whl
sha256: 92d24bb5ae04b93a78c2a04c35b8718f2dd1befa470916b8bb733d24959b1065
requires-python: '>=3.11, <3.14'
- version: 0.6.6
- version: 0.6.7
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ludovic Henry <git@ludovic.dev>
Date: Tue, 13 Oct 2026 00:00:00 +0000
Subject: [PATCH] lance-context-core: drop the unused lance-graph dependency

crates/lance-context-core/Cargo.toml depends on `lance-graph = "0.5.4"`,
but no Rust source file in this workspace imports `lance_graph`
(`grep -rln lance_graph crates/ python/` matches nothing); it is dead
weight in the dependency graph. lance-graph's own Cargo.toml pins
`lance`/`lance-core`/`lance-linalg` at an incompatible `1.x` line, which
Cargo resolves as yet another parallel copy of the whole lance-core/
lance-linalg family, alongside the `9.0.0` one crates/lance-context-core
depends on directly (`lance = "9.0.0"`) and the `7.0.0` one
`lancedb = "0.30.0"` still pulls in. That `1.x` copy's lance-core
SIMD_SUPPORT closure and lance-linalg's f32x8/f32x16/i32x8/f64x4/f64x8
SIMD types have no riscv64 fallback either, so it would need its own
riscv64-patched copy (see 0003-cargo-patch-lance-crates-for-riscv64.patch)
just to compile a crate nothing uses. Removing the dead dependency
drops that whole copy from resolution instead.

Upstream-Status: To upstream [not yet submitted to lance-format/lance-context]

Signed-off-by: Ludovic Henry <git@ludovic.dev>
---
diff --git a/crates/lance-context-core/Cargo.toml b/crates/lance-context-core/Cargo.toml
index 55f7dce..9c2311a 100644
--- a/crates/lance-context-core/Cargo.toml
+++ b/crates/lance-context-core/Cargo.toml
@@ -31,7 +31,6 @@ lance-context-api = { version = "0.6.6", path = "../lance-context-api" }
lance-index = "9.0.0"
lance-namespace = "9.0.0"
lancedb = "0.30.0"
-lance-graph = "0.5.4"
# Version-matched with lance-context-server/-master so one process-wide recorder
# serves every crate.
metrics = { version = "0.24", optional = true }
--
2.43.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ludovic Henry <git@ludovic.dev>
Date: Mon, 06 Oct 2026 00:00:00 +0000
Subject: [PATCH] lance-core: add a portable riscv64 SIMD-tier fallback

lance-core's SIMD_SUPPORT static (src/utils/cpu.rs) picks a SIMD tier
via a `cfg`-gated closure with arms for aarch64, x86_64 and loongarch64
only; none of them match riscv64, so the closure's block has no
trailing expression there and the crate fails to compile with "expected
`SimdSupport`, found `()`". Add a `None`-tier fallback arm beside the
existing ones for every architecture without a dedicated tier.

Applied (via patches/lance-context/0.6.5/0003-cargo-patch-lance-crates-for-riscv64.patch)
to a local copy of this crate's 7.0.0 crates.io release, which
crates/lance-context-core's `lance = "7.0.0"` pulls in transitively
and cannot be patched in place (CLAUDE.md gotcha 300).

Upstream-Status: To upstream [not yet submitted to lance-format/lance]

Signed-off-by: Ludovic Henry <git@ludovic.dev>
---
diff --git a/src/utils/cpu.rs b/src/utils/cpu.rs
index 4e7ab01..34ed3a0 100644
--- a/src/utils/cpu.rs
+++ b/src/utils/cpu.rs
@@ -58,6 +58,17 @@ pub static SIMD_SUPPORT: LazyLock<SimdSupport> = LazyLock::new(|| {
SimdSupport::None
}
}
+ // riscv64 (and any other architecture without a dedicated tier above) has
+ // no SIMD kernels in lance yet; upstream's cfg arms have no catch-all, so
+ // this closure otherwise evaluates to `()` here instead of `SimdSupport`.
+ #[cfg(not(any(
+ target_arch = "aarch64",
+ target_arch = "x86_64",
+ target_arch = "loongarch64"
+ )))]
+ {
+ SimdSupport::None
+ }
});

#[cfg(target_arch = "x86_64")]
--
2.43.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ludovic Henry <git@ludovic.dev>
Date: Tue, 13 Oct 2026 00:00:00 +0000
Subject: [PATCH] cargo: redirect lance-core/lance-linalg to riscv64-patched
checkouts

lance-core's SIMD_SUPPORT static (src/utils/cpu.rs) and lance-linalg's
f32x8/f32x16/i32x8/f64x4/f64x8 SIMD types (src/simd/{f32,i32,f64}.rs)
are compiled for x86_64/aarch64/loongarch64 only, with no fallback arm
for any other architecture (CLAUDE.md gotcha 300): the SIMD_SUPPORT
closure has no trailing expression on riscv64 ("expected SimdSupport,
found ()"), and the SIMD type structs are defined only under those
three `#[cfg(target_arch = ...)]` attributes while every method
implementing them is unconditional, so riscv64 hits "cannot find type
`f32x8` in this scope" as soon as lance-linalg is built.

Two semver-incompatible lines of both crates are compiled here: 9.0.0,
via crates/lance-context-core's direct `lance = "9.0.0"`, and 7.0.0,
which `lancedb = "0.30.0"` (and lance-namespace-impls 7.0.0 under it)
still pulls in. (lance-graph's own, unused `1.x` copy is dropped
entirely by 0001-remove-unused-lance-graph-dependency.patch instead.)
Redirect all four to the riscv64-patched copies the workflow
materializes at build time from the pinned crates.io releases (see
0002/0004-lance-{core,linalg}-riscv64-simd-fallback.patch for 7.0.0
and 0005/0006-lance-{core,linalg}-9.0.0-riscv64-simd-fallback.patch
for 9.0.0). The 7.0.0 pair is listed under renamed keys with
`package = ...`, which is how Cargo's [patch] table accepts more than
one semver-incompatible version of the same crate. Each copy is at the
same version Cargo.lock already pins -- only the `source`/`checksum`
lines of those four entries change there, so every other dependency
stays pinned exactly as upstream released it.

Upstream-Status: Inappropriate [redirects pinned dependencies to local checkouts materialized at build time; the fix itself belongs in lance-format/lance]

Signed-off-by: Ludovic Henry <git@ludovic.dev>
---
diff --git a/Cargo.lock b/Cargo.lock
index ac263f7..d87b7b3 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -6491,8 +6491,6 @@ dependencies = [
[[package]]
name = "lance-core"
version = "7.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "13f84020da5a484e2f07dd1796e09785ed7cd889857ebc4cb77e32ef214ee594"
dependencies = [
"arrow-array 58.3.0",
"arrow-buffer 58.3.0",
@@ -6528,8 +6526,6 @@ dependencies = [
[[package]]
name = "lance-core"
version = "9.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "238c8a58308e7718d6bd96b53494eb7953fa299778bc4911cc571c3576e9446d"
dependencies = [
"arrow-array 58.3.0",
"arrow-buffer 58.3.0",
@@ -7387,8 +7383,6 @@ dependencies = [
[[package]]
name = "lance-linalg"
version = "7.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6b4c51cad0ac780b02dc4da48528479e7693c03e8d05390510bbc69ca2a9a1f1"
dependencies = [
"arrow-array 58.3.0",
"arrow-buffer 58.3.0",
@@ -7405,8 +7399,6 @@ dependencies = [
[[package]]
name = "lance-linalg"
version = "9.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0e5a9b99bd1f49bc2fe5afb81323141abc506c818f589de95dbab4f6143d9a88"
dependencies = [
"arrow-array 58.3.0",
"arrow-buffer 58.3.0",
diff --git a/Cargo.toml b/Cargo.toml
index 2efab19..e85f652 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -17,3 +17,18 @@ license = "Apache-2.0"

[workspace.metadata]
# reserved for future use
+
+# lance-core's SIMD_SUPPORT static and lance-linalg's f32x8/f32x16/i32x8/
+# f64x4/f64x8 SIMD types compile only for x86_64/aarch64/loongarch64
+# upstream (CLAUDE.md gotcha 300); the riscv64-patched copies below are
+# materialized from the pinned crates.io releases by the workflow at
+# build time. Both the 9.0.0 line (crates/lance-context-core's direct
+# `lance = "9.0.0"`) and the 7.0.0 line (still pulled in by
+# `lancedb = "0.30.0"`) are compiled, so each is redirected; the second
+# pair uses renamed `package =` keys, which is how Cargo's [patch] table
+# takes more than one semver-incompatible version of the same crate.
+[patch.crates-io]
+lance-core = { path = "lance-core-9.0.0-riscv64" }
+lance-linalg = { path = "lance-linalg-9.0.0-riscv64" }
+lance-core-7 = { package = "lance-core", path = "lance-core-7.0.0-riscv64" }
+lance-linalg-7 = { package = "lance-linalg", path = "lance-linalg-7.0.0-riscv64" }
--
2.43.0
Loading
Loading