vectorchord: update for rust 1.88.0

This commit is contained in:
nikolaiser 2025-07-16 16:57:51 +02:00
parent 8c00393746
commit 6b5d556b4f
No known key found for this signature in database
GPG Key ID: 9EE04A6AB88D0DB8
2 changed files with 0 additions and 70 deletions

View File

@ -1,65 +0,0 @@
diff --git a/crates/algorithm/src/operator.rs b/crates/algorithm/src/operator.rs
index 7de8d07..c496dcd 100644
--- a/crates/algorithm/src/operator.rs
+++ b/crates/algorithm/src/operator.rs
@@ -672,7 +672,7 @@ impl Operator for Op<VectOwned<f32>, L2> {
use std::iter::zip;
let dims = vector.dims();
let t = zip(&code.1, centroid.slice())
- .map(|(&sign, &num)| std::hint::select_unpredictable(sign, num, -num))
+ .map(|(&sign, &num)| sign.select_unpredictable(num, -num))
.sum::<f32>()
/ (dims as f32).sqrt();
let sum_of_x_2 = code.0.dis_u_2;
@@ -763,7 +763,7 @@ impl Operator for Op<VectOwned<f32>, Dot> {
use std::iter::zip;
let dims = vector.dims();
let t = zip(&code.1, centroid.slice())
- .map(|(&sign, &num)| std::hint::select_unpredictable(sign, num, -num))
+ .map(|(&sign, &num)| sign.select_unpredictable(num, -num))
.sum::<f32>()
/ (dims as f32).sqrt();
let sum_of_x_2 = code.0.dis_u_2;
@@ -854,7 +854,7 @@ impl Operator for Op<VectOwned<f16>, L2> {
use std::iter::zip;
let dims = vector.dims();
let t = zip(&code.1, centroid.slice())
- .map(|(&sign, &num)| std::hint::select_unpredictable(sign, num, -num).to_f32())
+ .map(|(&sign, &num)| sign.select_unpredictable(num, -num).to_f32())
.sum::<f32>()
/ (dims as f32).sqrt();
let sum_of_x_2 = code.0.dis_u_2;
@@ -945,7 +945,7 @@ impl Operator for Op<VectOwned<f16>, Dot> {
use std::iter::zip;
let dims = vector.dims();
let t = zip(&code.1, centroid.slice())
- .map(|(&sign, &num)| std::hint::select_unpredictable(sign, num, -num).to_f32())
+ .map(|(&sign, &num)| sign.select_unpredictable(num, -num).to_f32())
.sum::<f32>()
/ (dims as f32).sqrt();
let sum_of_x_2 = code.0.dis_u_2;
diff --git a/crates/simd/src/rotate.rs b/crates/simd/src/rotate.rs
index 7a211e5..0fcd955 100644
--- a/crates/simd/src/rotate.rs
+++ b/crates/simd/src/rotate.rs
@@ -31,18 +31,17 @@ pub fn givens(lhs: &mut [f32], rhs: &mut [f32]) {
pub mod flip {
#[crate::multiversion("v4", "v3", "v2", "a2")]
pub fn flip(bits: &[u64; 1024], result: &mut [f32]) {
- use std::hint::select_unpredictable;
let result: &mut [u32] = unsafe { std::mem::transmute(result) };
let (slice, remainder) = result.as_chunks_mut::<64>();
let n = slice.len();
assert!(n <= 1024);
for i in 0..n {
for j in 0..64 {
- slice[i][j] ^= select_unpredictable((bits[i] & (1 << j)) != 0, 0x80000000, 0);
+ slice[i][j] ^= ((bits[i] & (1 << j)) != 0).select_unpredictable(0x80000000, 0);
}
}
for j in 0..remainder.len() {
- remainder[j] ^= select_unpredictable((bits[n] & (1 << j)) != 0, 0x80000000, 0);
+ remainder[j] ^= ((bits[n] & (1 << j)) != 0).select_unpredictable(0x80000000, 0);
}
}
}

View File

@ -44,11 +44,6 @@ buildPgrxExtension (finalAttrs: {
})
# Add feature flags needed for features not yet stabilised in rustc stable
./0002-add-feature-flags.diff
# The select_predictable function has been moved from std::bool to std::hint before it has been stabilized.
# This move isn't present in rustc 1.87, but upstream is using nightly so they have already updated their code.
# This patch changes the code to use the function on std::bool instead.
# See https://github.com/rust-lang/rust/pull/139726
./0003-select_unpredictable-on-bool.diff
];
buildInputs = lib.optionals (useSystemJemalloc) [