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
19 changes: 17 additions & 2 deletions .github/workflows/build-lance-context.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ jobs:
# i32x8/f64x4/f64x8 SIMD types compile only for x86_64/aarch64/
# loongarch64 upstream (CLAUDE.md gotcha 300); both are pulled in from
# crates.io at a pinned `lance = "7.0.0"` (crates/lance-context-core/
# Cargo.toml), so riscv64-fixed copies are vendored here and wired in
# via `[patch.crates-io]`.
# Cargo.toml; "9.0.0" from 0.6.6, see below), so riscv64-fixed copies are
# vendored here and wired in via `[patch.crates-io]`.
- name: Vendor riscv64-fixed lance-core and lance-linalg
run: |
curl -fsSL -A "python-wheels (https://github.com/riseproject-dev/python-wheels)" -o lance-core.tar.gz "https://crates.io/api/v1/crates/lance-core/7.0.0/download"
Expand All @@ -111,6 +111,21 @@ 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"`
# while lancedb 0.30.0 still pulls in the 7.0.0 line, so Cargo.lock holds
# both and each needs its own riscv64-fixed copy.
patches="$PWD/python-wheels/patches/lance-context/${LANCE_CONTEXT_VERSION}"
if grep -q 'lance-core-9.0.0-riscv64' "$patches/0003-cargo-patch-lance-crates-for-riscv64.patch"; then
for crate in lance-core lance-linalg; do
curl -fsSL -A "python-wheels (https://github.com/riseproject-dev/python-wheels)" -o "$crate.tar.gz" "https://crates.io/api/v1/crates/$crate/9.0.0/download"
mkdir "$crate-9.0.0-riscv64"
tar xzf "$crate.tar.gz" -C "$crate-9.0.0-riscv64" --strip-components=1
rm "$crate.tar.gz"
done
patch -p1 -d lance-core-9.0.0-riscv64 < "$patches/0002-lance-core-riscv64-simd-fallback.patch"
patch -p1 -d lance-linalg-9.0.0-riscv64 < "$patches/0004-lance-linalg-riscv64-simd-fallback.patch"
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
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,39 @@
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-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). lance-graph's
own Cargo.toml pins `lance`/`lance-core`/`lance-linalg` at an incompatible
`1.x` line, which Cargo resolves as a third, parallel copy of the whole
lance-core/lance-linalg family next to the `7.0.0` one lancedb pulls in
and the `9.0.0` one `crates/lance-context-core` depends on directly.
Cargo's `[patch]` table needs one entry per semver-incompatible line of a
crate that is to be redirected, and the riscv64 SIMD fallbacks (see
0003-cargo-patch-lance-crates-for-riscv64.patch) only exist for the 7.x
and 9.x lines, so removing the dead dependency drops the 1.x copy from
resolution instead.

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

Signed-off-by: Ludovic Henry <git@ludovic.dev>
---
crates/lance-context-core/Cargo.toml | 1 -
1 file changed, 1 deletion(-)

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,88 @@
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] 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).

Cargo.lock holds two semver-incompatible lines of both crates once
lance-graph is gone: 7.0.0 (pulled in by lancedb 0.30.0) and 9.0.0
(`lance = "9.0.0"` in crates/lance-context-core). `[patch.crates-io]`
redirects one version per crate name, so the 9.0.0 pair uses the plain
name and the 7.0.0 pair an aliased entry (`package = "lance-core"`).
Both are redirected to the riscv64-patched copies the workflow
materializes at build time from the pinned crates.io releases (see
0002/0004, applied to both lines); only the `source`/
`checksum` lines of those four Cargo.lock entries change.

Upstream-Status: Inappropriate [redirects a pinned dependency to a local checkout 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..07f2f68 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -17,3 +17,16 @@ 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. Cargo.lock pins two semver-incompatible lines of each crate
+# (7.0.0 via lancedb, 9.0.0 via lance-context-core), and [patch] can only
+# redirect one per name, so the second is patched through an aliased entry.
+[patch.crates-io]
+lance-core = { path = "lance-core-9.0.0-riscv64" }
+lance-linalg = { path = "lance-linalg-9.0.0-riscv64" }
+lance-core-7 = { path = "lance-core-7.0.0-riscv64", package = "lance-core" }
+lance-linalg-7 = { path = "lance-linalg-7.0.0-riscv64", package = "lance-linalg" }
--
2.43.0
Loading
Loading