Skip to content

Commit

Permalink
Automatically set AVX2/FMA flags on x86
Browse files Browse the repository at this point in the history
  • Loading branch information
syvb authored Jan 6, 2025
1 parent 8bd2acf commit 07562eb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[target.'cfg(target_os="macos")']
# Postgres symbols won't be available until runtime
rustflags = ["-Clink-arg=-Wl,-undefined,dynamic_lookup"]

[target.'cfg(any(target_arch = "x86", target_arch = "x86_64"))']
rustflags = ["-Ctarget-feature=+avx2,+fma"]
4 changes: 1 addition & 3 deletions .github/workflows/deb-packager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@ jobs:
platform:
- type: amd64
runs_on: ubuntu-latest
rustflags: '-C target-feature=+avx2,+fma'
- type: arm64
runs_on: cloud-image-runner-arm64
rustflags: ''

env:
PG_SRC_DIR: pgbuild
Expand Down Expand Up @@ -81,7 +79,7 @@ jobs:
id: debbuild
run: |
export PATH=~/${{ env.PG_INSTALL_DIR }}/bin:$PATH
(cd ${{ env.TAG_DIR }} && ${{ matrix.platform.rustflags != '' && format('RUSTFLAGS="{0}"', matrix.platform.rustflags) || '' }} make package)
(cd ${{ env.TAG_DIR }} && make package)
bash scripts/package-deb.sh "${{ env.TAG }}" "${PWD}/${{ env.TAG_DIR }}" "$RUNNER_OS" "${{ matrix.pg.major }}"
# Use a GH artifact, then we can make use of the (quite limited) GH API https://docs.github.com/en/rest/actions/artifacts
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/pgrx_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@ jobs:
platform:
- type: amd64
runs_on: ubuntu-22.04
rustflags: '-C target-feature=+avx2,+fma'
- type: arm64
runs_on: cloud-image-runner-arm64
rustflags: ''

env:
PG_SRC_DIR: pgbuild
Expand Down Expand Up @@ -70,12 +68,10 @@ jobs:
id: clippy
run: |
cd pgvectorscale
${{ matrix.platform.rustflags != '' && format('export RUSTFLAGS="{0}"', matrix.platform.rustflags) || '' }}
cargo clippy --all-targets --no-default-features --features 'pg_test pg${{ matrix.pg.major }}'
- name: Run tests
id: runtests
run: |
cd pgvectorscale
${{ matrix.platform.rustflags != '' && format('export RUSTFLAGS="{0}"', matrix.platform.rustflags) || '' }}
cargo pgrx test -- pg${{ matrix.pg.major }}

0 comments on commit 07562eb

Please sign in to comment.