Skip to content

Commit

Permalink
chore: update pgrx to 0.12.5 & add pg17 in check and release (#600)
Browse files Browse the repository at this point in the history
* chore: update pgrx to 0.12.5 & add pg17 in check and release

Signed-off-by: usamoi <usamoi@outlook.com>

* chore: update vendor

* fix: set pgrx version

Signed-off-by: usamoi <usamoi@outlook.com>

* fix: clippy

Signed-off-by: usamoi <usamoi@outlook.com>

* fix: do not use mul_add

Signed-off-by: usamoi <usamoi@outlook.com>

* fix: temporarily removes the test that fails on PostgreSQL 17

Signed-off-by: usamoi <usamoi@outlook.com>

---------

Signed-off-by: usamoi <usamoi@outlook.com>
  • Loading branch information
usamoi authored Oct 9, 2024
1 parent b3d3243 commit f7c766d
Show file tree
Hide file tree
Showing 31 changed files with 129,395 additions and 1,892 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/psql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
test:
strategy:
matrix:
version: [14, 15, 16]
version: [14, 15, 16, 17]
arch: ["x86_64"]
runs-on: ubuntu-latest
env:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
binary:
strategy:
matrix:
version: [14, 15, 16]
version: [14, 15, 16, 17]
arch: ["x86_64", "aarch64"]
runs-on: ubuntu-20.04
env:
Expand Down Expand Up @@ -109,7 +109,7 @@ jobs:
needs: ["binary", "semver"]
strategy:
matrix:
version: [14, 15, 16]
version: [14, 15, 16, 17]
platform: ["amd64", "arm64"]
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -142,7 +142,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
version: [14, 15, 16]
version: [14, 15, 16, 17]
rootless: [true, false]
steps:
- name: Checkout
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release_enterprise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
binary:
strategy:
matrix:
version: [14, 15, 16]
version: [14, 15, 16, 17]
arch: ["x86_64", "aarch64"]
schema: ["vectors", "extensions", "public"]
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -117,7 +117,7 @@ jobs:
needs: ["binary", "semver"]
strategy:
matrix:
version: [14, 15, 16]
version: [14, 15, 16, 17]
platform: ["amd64", "arm64"]
schema: ["vectors", "extensions", "public"]
runs-on: ubuntu-latest
Expand Down Expand Up @@ -151,7 +151,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
version: [14, 15, 16]
version: [14, 15, 16, 17]
schema: ["vectors", "extensions", "public"]
steps:
- name: Checkout
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ jobs:
touch ~/.cargo/config.toml
echo 'target.aarch64-unknown-linux-gnu.linker = "aarch64-linux-gnu-gcc"' >> ~/.cargo/config.toml
echo 'target.aarch64-unknown-linux-gnu.runner = ["qemu-aarch64-static", "-L", "/usr/aarch64-linux-gnu"]' >> ~/.cargo/config.toml
rustup target add x86_64-unknown-linux-gnu
rustup target add aarch64-unknown-linux-gnu
- name: Set up Sccache
uses: mozilla-actions/sccache-action@v0.0.4
- name: Set up Cache
Expand Down Expand Up @@ -95,6 +97,9 @@ jobs:
export PGRX_PG_CONFIG_PATH=$(pwd)/vendor/pg16_${ARCH}_debian/pg_config/pg_config
export PGRX_TARGET_INFO_PATH_PG16=$(pwd)/vendor/pg16_${ARCH}_debian/pgrx_binding
cargo clippy --package pgvectors --features pg16 --no-deps --target $ARCH-unknown-linux-gnu
export PGRX_PG_CONFIG_PATH=$(pwd)/vendor/pg17_${ARCH}_debian/pg_config/pg_config
export PGRX_TARGET_INFO_PATH_PG17=$(pwd)/vendor/pg17_${ARCH}_debian/pgrx_binding
cargo clippy --package pgvectors --features pg17 --no-deps --target $ARCH-unknown-linux-gnu
- name: Build
run: |
cargo build --workspace --exclude pgvectors --exclude pyvectors --target $ARCH-unknown-linux-gnu
Expand All @@ -107,6 +112,9 @@ jobs:
export PGRX_PG_CONFIG_PATH=$(pwd)/vendor/pg16_${ARCH}_debian/pg_config/pg_config
export PGRX_TARGET_INFO_PATH_PG16=$(pwd)/vendor/pg16_${ARCH}_debian/pgrx_binding
cargo build --package pgvectors --lib --features pg16 --target $ARCH-unknown-linux-gnu
export PGRX_PG_CONFIG_PATH=$(pwd)/vendor/pg17_${ARCH}_debian/pg_config/pg_config
export PGRX_TARGET_INFO_PATH_PG17=$(pwd)/vendor/pg17_${ARCH}_debian/pgrx_binding
cargo build --package pgvectors --lib --features pg17 --target $ARCH-unknown-linux-gnu
- name: Test
run: |
cargo test --workspace --exclude pgvectors --exclude pyvectors --no-fail-fast --target $ARCH-unknown-linux-gnu
Expand Down
16 changes: 10 additions & 6 deletions .github/workflows/update_vendor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,21 @@ jobs:
run: |
export BRANCH=$(grep -o 'pgrx = { git = "https://github.com/tensorchord/pgrx.git", branch = "[^"]*' Cargo.toml | cut -d '"' -f 4)
docker run --rm --platform linux/amd64 -v ./:/mnt/build \
-e "VERSION=14" -e "BRANCH=$BRANCH" debian:buster bash /mnt/build/scripts/update_vendor.sh &
-e "VERSION=14" -e "BRANCH=$BRANCH" debian:bookworm bash /mnt/build/scripts/update_vendor.sh &
docker run --rm --platform linux/amd64 -v ./:/mnt/build \
-e "VERSION=15" -e "BRANCH=$BRANCH" debian:buster bash /mnt/build/scripts/update_vendor.sh &
-e "VERSION=15" -e "BRANCH=$BRANCH" debian:bookworm bash /mnt/build/scripts/update_vendor.sh &
docker run --rm --platform linux/amd64 -v ./:/mnt/build \
-e "VERSION=16" -e "BRANCH=$BRANCH" debian:buster bash /mnt/build/scripts/update_vendor.sh &
-e "VERSION=16" -e "BRANCH=$BRANCH" debian:bookworm bash /mnt/build/scripts/update_vendor.sh &
docker run --rm --platform linux/amd64 -v ./:/mnt/build \
-e "VERSION=17" -e "BRANCH=$BRANCH" debian:bookworm bash /mnt/build/scripts/update_vendor.sh &
docker run --rm --platform linux/arm64 -v ./:/mnt/build \
-e "VERSION=14" -e "BRANCH=$BRANCH" debian:bookworm bash /mnt/build/scripts/update_vendor.sh &
docker run --rm --platform linux/arm64 -v ./:/mnt/build \
-e "VERSION=14" -e "BRANCH=$BRANCH" debian:buster bash /mnt/build/scripts/update_vendor.sh &
-e "VERSION=15" -e "BRANCH=$BRANCH" debian:bookworm bash /mnt/build/scripts/update_vendor.sh &
docker run --rm --platform linux/arm64 -v ./:/mnt/build \
-e "VERSION=15" -e "BRANCH=$BRANCH" debian:buster bash /mnt/build/scripts/update_vendor.sh &
-e "VERSION=16" -e "BRANCH=$BRANCH" debian:bookworm bash /mnt/build/scripts/update_vendor.sh &
docker run --rm --platform linux/arm64 -v ./:/mnt/build \
-e "VERSION=16" -e "BRANCH=$BRANCH" debian:buster bash /mnt/build/scripts/update_vendor.sh &
-e "VERSION=17" -e "BRANCH=$BRANCH" debian:bookworm bash /mnt/build/scripts/update_vendor.sh &
wait
sudo chown -R $USER ./vendor
- name: Create Pull Request
Expand Down
76 changes: 43 additions & 33 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ libc.workspace = true
log.workspace = true
memmap2.workspace = true
paste.workspace = true
pgrx = { version = "=0.12.1", default-features = false, features = [] }
pgrx = { version = "=0.12.5", default-features = false, features = [] }
rand.workspace = true
rustix.workspace = true
serde.workspace = true
Expand Down Expand Up @@ -88,7 +88,7 @@ rust.unused_lifetimes = "warn"
rust.unused_qualifications = "warn"

[patch.crates-io]
pgrx = { git = "https://github.com/tensorchord/pgrx.git", branch = "v0.12.1-patch" }
pgrx = { git = "https://github.com/tensorchord/pgrx.git", branch = "v0.12.5-patch" }

[profile.opt]
inherits = "dev"
Expand Down
4 changes: 2 additions & 2 deletions crates/base/src/scalar/f16.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ mod reduce_sum_of_xy {
a = a.add(1);
b = b.add(1);
n -= 1;
xy = x.mul_add(y, xy);
xy += x * y;
}
xy
}
Expand Down Expand Up @@ -615,7 +615,7 @@ mod reduce_sum_of_d2 {
b = b.add(1);
n -= 1;
let d = x - y;
d2 = d.mul_add(d, d2);
d2 += d * d;
}
d2
}
Expand Down
8 changes: 4 additions & 4 deletions crates/base/src/scalar/f32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ mod reduce_sum_of_x2 {
let x = a.read();
a = a.add(1);
n -= 1;
x2 = x.mul_add(x, x2);
x2 += x * x;
}
x2
}
Expand Down Expand Up @@ -586,7 +586,7 @@ mod reduce_sum_of_x2 {
let n = this.len();
let mut x2 = 0.0f32;
for i in 0..n {
x2 = this[i].mul_add(this[i], x2);
x2 += this[i] * this[i];
}
x2
}
Expand Down Expand Up @@ -815,7 +815,7 @@ mod reduce_sum_of_xy {
a = a.add(1);
b = b.add(1);
n -= 1;
xy = x.mul_add(y, xy);
xy += x * y;
}
xy
}
Expand Down Expand Up @@ -966,7 +966,7 @@ mod reduce_sum_of_d2 {
b = b.add(1);
n -= 1;
let d = x - y;
d2 = d.mul_add(d, d2);
d2 += d * d;
}
d2
}
Expand Down
2 changes: 1 addition & 1 deletion crates/quantization/src/quantize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ mod mul_add_round {
// this hint is used to disable loop unrolling
while std::hint::black_box(n) > 0 {
let x = a.read();
let v = x.mul_add(k, b).round_ties_even() as u8;
let v = (k * x + b).round_ties_even() as u8;
r.write(v);
n -= 1;
a = a.add(1);
Expand Down
3 changes: 0 additions & 3 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
[toolchain]
channel = "nightly-2024-09-14"
profile = "default"
components = ["rust-analyzer", "rust-src"]
targets = ["aarch64-unknown-linux-gnu", "x86_64-unknown-linux-gnu"]
2 changes: 1 addition & 1 deletion src/logger/postgres.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ fn write_pipe_chunks(pid: u32, mut msg: &[u8], dest: LogDestination) {
chunk.extend((len as u16).to_le_bytes());
chunk.extend((pid as i32).to_le_bytes());
#[cfg(feature = "pg14")]
chunk.extend((is_last as u8).to_le_bytes());
chunk.extend(is_last.to_le_bytes());
#[cfg(any(feature = "pg15", feature = "pg16", feature = "pg17"))]
chunk.extend((flags as u8).to_le_bytes());
chunk.extend_from_slice(&msg[..len]);
Expand Down
Loading

0 comments on commit f7c766d

Please sign in to comment.