Skip to content

Commit 0058999

Browse files
committed
lancedb: fix riscv64 SIMD-fallback patches for 0.38.0/0.39.0
CI failed applying patches/lancedb/<version>/0001*.patch for the two new pending versions: no patch directory existed for them yet (only 0.37.1 had one), so the glob matched nothing and `git apply` errored on a literal, missing filename. lancedb pins lance-core/lance-linalg to a different exact version per release (10.0.0 for v0.37.1, 11.0.0 for v0.38.0, 12.0.0 for v0.39.0), but the workflow hardcoded checking out lance v10.0.0 for the riscv64 SIMD fallback regardless of which lancedb version was being built. Make that checkout track whatever lance-core version the checked-out lancedb's own Cargo.toml pins, and add the corresponding per-version patch directories: - 0001 (Cargo.toml `[patch.crates-io]` redirect) is unchanged across lance versions, copied verbatim from 0.37.1. - 0002 (portable riscv64 SIMD fallback for lance-linalg's f32x8/f32x16/ i32x8/f64x4/f64x8) reuses patches/pylance/11.0.0's fallback patch, which applies cleanly to both lance v11.0.0 (0.38.0) and v12.0.0 (0.39.0) unchanged (verified locally with `git apply --check` against real lancedb/lance checkouts at both tags).
1 parent 84cf4c3 commit 0058999

5 files changed

Lines changed: 2721 additions & 2 deletions

‎.github/workflows/build-lancedb.yml‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,23 @@ jobs:
7777
- name: Apply lancedb patches
7878
run: git apply -v python-wheels/patches/lancedb/${{ env.LANCEDB_VERSION }}/0001*.patch
7979

80+
# lancedb pins lance-core/lance-linalg to a different exact version per
81+
# release (10.0.0 for v0.37.1, 11.0.0 for v0.38.0, 12.0.0 for v0.39.0),
82+
# so the sibling checkout below must track whatever this lancedb tag's
83+
# own Cargo.toml pins rather than a fixed tag.
84+
- name: Determine the lance-core/lance-linalg version lancedb pins
85+
run: echo "LANCE_VERSION=$(grep -m1 '^lance-core = ' Cargo.toml | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')" >> "$GITHUB_ENV"
86+
8087
# lance-core's SIMD_SUPPORT static and lance-linalg's f32x8/f32x16/
8188
# i32x8/f64x4/f64x8 SIMD types compile only for x86_64/aarch64/
8289
# loongarch64 upstream; the 0002 patch adds a portable riscv64 fallback
8390
# to this checkout, and Cargo.toml's `[patch.crates-io]` (0001) redirects
8491
# both crates here.
85-
- name: Checkout lance v10.0.0 and add a riscv64 SIMD fallback
92+
- name: Checkout lance v${{ env.LANCE_VERSION }} and add a riscv64 SIMD fallback
8693
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
8794
with:
8895
repository: lancedb/lance
89-
ref: v10.0.0
96+
ref: v${{ env.LANCE_VERSION }}
9097
path: lance
9198
persist-credentials: false
9299

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: Ludovic Henry <git@ludovic.dev>
3+
Date: Thu, 03 Sep 2026 00:00:00 +0000
4+
Subject: [PATCH] cargo: redirect lance-core/lance-linalg to a riscv64-patched
5+
checkout
6+
7+
lance-core's SIMD_SUPPORT static (rust/lance-core/src/utils/cpu.rs) and
8+
lance-linalg's f32x8/f32x16/i32x8/f64x4/f64x8 SIMD types
9+
(rust/lance-linalg/src/simd/{f32,i32,f64}.rs) are compiled for
10+
x86_64/aarch64/loongarch64 only, with no fallback arm for any other
11+
architecture: the SIMD_SUPPORT closure has no trailing expression on
12+
riscv64 ("expected SimdSupport, found ()"), and the SIMD type structs are
13+
defined only under those three `#[cfg(target_arch = ...)]` attributes
14+
while every method implementing them is unconditional, so riscv64 hits
15+
"cannot find type `f32x8` in this scope" as soon as lance-linalg is
16+
built.
17+
18+
Both crates are pulled in from crates.io at a pinned `=10.0.0`, so the
19+
fix cannot be applied in place. Redirect them to a checkout of the same
20+
v10.0.0 tag carrying a portable scalar fallback for both, see
21+
0002-lance-linalg-add-a-portable-riscv64-simd-fallback.patch. `exclude`
22+
keeps that checkout's own [workspace] from being silently absorbed into
23+
this one, which would drop its `[workspace.package]` inheritance
24+
(version, edition, ...) for lance-core and lance-linalg.
25+
26+
Only the source line of the lance-core/lance-linalg entries changes in
27+
Cargo.lock, so every other dependency stays pinned exactly as upstream
28+
released it.
29+
30+
Upstream-Status: Inappropriate [redirects two pinned dependencies to a local checkout; the fix itself belongs in lancedb/lance]
31+
32+
Signed-off-by: Ludovic Henry <git@ludovic.dev>
33+
---
34+
Cargo.toml | 12 ++++++++++++
35+
1 file changed, 12 insertions(+)
36+
37+
diff --git a/Cargo.toml b/Cargo.toml
38+
index a47e59e..ab6cf5c 100644
39+
--- a/Cargo.toml
40+
+++ b/Cargo.toml
41+
@@ -1,5 +1,10 @@
42+
[workspace]
43+
members = ["rust/lancedb", "nodejs", "python"]
44+
+# ./lance (see [patch.crates-io] below) carries its own [workspace]; excluding
45+
+# it keeps that workspace independent instead of being silently absorbed into
46+
+# this one, which would drop its `[workspace.package]` inheritance (version,
47+
+# edition, ...) for lance-core and lance-linalg.
48+
+exclude = ["lance"]
49+
resolver = "2"
50+
51+
[workspace.package]
52+
@@ -80,3 +85,10 @@ debug = false
53+
debug-assertions = false
54+
strip = "debuginfo"
55+
incremental = false
56+
+
57+
+# lance-core's SIMD_SUPPORT and lance-linalg's f32x8/f32x16/i32x8/f64x4/f64x8
58+
+# SIMD types compile only for x86_64/aarch64/loongarch64 upstream; ./lance is
59+
+# the same v10.0.0 tag with a riscv64 scalar fallback added to both.
60+
+[patch.crates-io]
61+
+lance-core = { path = "lance/rust/lance-core" }
62+
+lance-linalg = { path = "lance/rust/lance-linalg" }
63+
--
64+
2.43.0

0 commit comments

Comments
 (0)