postgresqlPackages.vectorchord: disable avx512vnni support

Due to a bug in LLVM 21, build fails on x86_64 with:
`rustc-LLVM ERROR: Cannot select: intrinsic %llvm.x86.avx512.vpdpbusd.512`.
This has been fixed in Rust's build of LLVM and LLVM 22 [1]
but this is not reflected in nixpkgs' packaging of rustc.
For this reason, we temporarily disable avx512vnni support until this is fixed in nixpkgs.
This might cause a performance penalty, but should not affect correctness.

See https://github.com/NixOS/nixpkgs/pull/537113#issuecomment-4846239887

[1]: 94e2c19f86
This commit is contained in:
Diogo Correia 2026-07-06 16:58:41 +01:00
commit 1ed61918a9
No known key found for this signature in database
GPG key ID: 12B4F3AC9C065D08
2 changed files with 42 additions and 0 deletions

View file

@ -0,0 +1,29 @@
diff --git a/crates/simd/src/byte.rs b/crates/simd/src/byte.rs
index 0c7c4be..87737d4 100644
--- a/crates/simd/src/byte.rs
+++ b/crates/simd/src/byte.rs
@@ -389,7 +389,7 @@ mod reduce_sum_of_xy {
}
}
- #[crate::multiversion(@"v4:avx512vnni", @"v4", @"v3", @"v2", @"a2:dotprod", @"a2", "z17", "z16", "z15", "z14", "z13", "p9", "p8", "p7", "r1")]
+ #[crate::multiversion(@"v4", @"v3", @"v2", @"a2:dotprod", @"a2", "z17", "z16", "z15", "z14", "z13", "p9", "p8", "p7", "r1")]
pub fn reduce_sum_of_xy(s: &[u8], t: &[u8]) -> u32 {
assert_eq!(s.len(), t.len());
let n = s.len();
diff --git a/crates/simd/src/halfbyte.rs b/crates/simd/src/halfbyte.rs
index e1aa016..f7dc3dc 100644
--- a/crates/simd/src/halfbyte.rs
+++ b/crates/simd/src/halfbyte.rs
@@ -411,7 +411,7 @@ mod reduce_sum_of_xy {
}
}
- #[crate::multiversion(@"v4:avx512vnni", @"v4", @"v3", @"v2", @"a2:dotprod", @"a2", "z17", "z16", "z15", "z14", "z13", "p9", "p8", "p7", "r1")]
+ #[crate::multiversion(@"v4", @"v3", @"v2", @"a2:dotprod", @"a2", "z17", "z16", "z15", "z14", "z13", "p9", "p8", "p7", "r1")]
pub fn reduce_sum_of_xy(s: &[u8], t: &[u8]) -> u32 {
assert_eq!(s.len(), t.len());
let n = s.len();
--
2.54.0

View file

@ -6,6 +6,8 @@
nix-update-script,
postgresql,
postgresqlTestExtension,
rustc,
stdenv,
}:
buildPgrxExtension (finalAttrs: {
inherit postgresql;
@ -23,6 +25,17 @@ buildPgrxExtension (finalAttrs: {
cargoHash = "sha256-IXOCzKJArNOcb/2TcJbLz1XdCquUpyF/cLHYU5vmlko=";
patches = lib.optional (lib.versionOlder rustc.llvm.version "22.0.0" && stdenv.isx86_64) [
# Due to a bug in LLVM 21, build fails on x86_64 with:
# `rustc-LLVM ERROR: Cannot select: intrinsic %llvm.x86.avx512.vpdpbusd.512`.
# This has been fixed in Rust's build of LLVM and LLVM 22 with https://github.com/rust-lang/llvm-project/commit/94e2c19f86a699d7a19ff0f4130b696699189c8d,
# but this is not reflected in nixpkgs' packaging of rustc.
# For this reason, we temporarily disable avx512vnni support until this is fixed in nixpkgs.
# This might cause a performance penalty, but should not affect correctness.
# See https://github.com/NixOS/nixpkgs/pull/537113#issuecomment-4846239887
./0001-disable-avx512vnni.patch
];
# Include upgrade scripts in the final package
# https://github.com/supervc-stack/VectorChord/blob/0.5.0/crates/make/src/main.rs#L366
postInstall = ''