Skip to content

Commit 60769ab

Browse files
authored
Merge branch 'facebookresearch:main' into polysemous-avx512
2 parents fe424e6 + a3a7627 commit 60769ab

406 files changed

Lines changed: 30684 additions & 8137 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/actions/build_cmake/action.yml

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,23 @@ inputs:
1616
description: 'Enable ROCm support.'
1717
required: false
1818
default: OFF
19+
svs:
20+
description: 'Enable SVS support.'
21+
required: false
22+
default: OFF
23+
setup_conda:
24+
description: 'Setup miniconda environment.'
25+
required: false
26+
default: 'true'
27+
upload_artifacts:
28+
description: 'Upload test artifacts. Prevents collisions when multiple jobs need to run build_cmake.'
29+
required: false
30+
default: 'true'
1931
runs:
2032
using: composite
2133
steps:
2234
- name: Setup miniconda
35+
if: inputs.setup_conda == 'true'
2336
uses: conda-incubator/setup-miniconda@v3
2437
with:
2538
python-version: '3.11'
@@ -36,10 +49,10 @@ runs:
3649
conda config --set solver libmamba
3750
# Ensure starting packages are from conda-forge.
3851
conda list --show-channel-urls
39-
conda update -y -q conda
52+
conda install -y -q "conda<=25.07"
4053
echo "$CONDA/bin" >> $GITHUB_PATH
4154
42-
conda install -y -q python=3.11 cmake=3.30.4 make=4.2 swig=4.0 "numpy<2" scipy=1.14 pytest=7.4 gflags=2.2
55+
conda install -y -q python=3.11 cmake=3.30.4 make=4.2 swig=4.0 "numpy>=2.0,<3.0" scipy=1.16 pytest=7.4 gflags=2.2
4356
4457
# install base packages for ARM64
4558
if [ "${{ runner.arch }}" = "ARM64" ]; then
@@ -50,27 +63,33 @@ runs:
5063
if [ "${{ runner.arch }}" = "X64" ]; then
5164
# TODO: merge this with ARM64
5265
conda install -y -q -c conda-forge gxx_linux-64=14.2 sysroot_linux-64=2.17
53-
conda install -y -q mkl=2022.2.1 mkl-devel=2022.2.1
66+
conda install -y -q mkl=2024.2.2 mkl-devel=2024.2.2
5467
fi
5568
5669
# no CUDA needed for ROCm so skip this
5770
if [ "${{ inputs.rocm }}" = "ON" ]; then
5871
:
5972
# regular CUDA for GPU builds
6073
elif [ "${{ inputs.gpu }}" = "ON" ] && [ "${{ inputs.cuvs }}" = "OFF" ]; then
61-
conda install -y -q cuda-toolkit=12.4 -c "nvidia/label/cuda-12.4.0"
74+
conda install -y -q cuda-toolkit=12.6 gxx_linux-64=12.4 -c "nvidia/label/cuda-12.6"
6275
# and CUDA from cuVS channel for cuVS builds
6376
elif [ "${{ inputs.cuvs }}" = "ON" ]; then
64-
conda install -y -q libcuvs=25.08 'cuda-version>=12.0,<=12.5' cuda-toolkit=12.4.1 gxx_linux-64=12.4 -c rapidsai -c rapidsai-nightly -c conda-forge
77+
conda install -y -q libcuvs=25.10 'cuda-version=12.6' cuda-toolkit=12.6 gxx_linux-64=13.4.0 -c rapidsai -c rapidsai-nightly -c conda-forge
78+
fi
79+
80+
# install SVS runtime for SVS builds
81+
if [ "${{ inputs.svs }}" = "ON" ]; then
82+
conda install -y -q libsvs-runtime -c https://software.repos.intel.com/python/conda -c conda-forge
6583
fi
6684
6785
# install test packages
6886
if [ "${{ inputs.rocm }}" = "ON" ]; then
6987
: # skip torch install via conda, we need to install via pip to get
7088
# ROCm-enabled version until it's supported in conda by PyTorch
7189
elif [ "${{ inputs.gpu }}" = "ON" ]; then
72-
conda install -y -q "pytorch<2.5" pytorch-cuda=12.4 -c pytorch -c "nvidia/label/cuda-12.4.0"
90+
conda install -y -q "pytorch>=2.7" "pytorch-gpu>=2.7" -c pytorch -c "nvidia/label/12.6"
7391
else
92+
# TestLowLevelIVF.IVFRQ hangs on pytorch>=2.7, so left it as <2.5 for now.
7493
conda install -y -q "pytorch<2.5" -c pytorch
7594
fi
7695
- name: ROCm - Install dependencies
@@ -121,13 +140,15 @@ runs:
121140
run: |
122141
eval "$(conda shell.bash hook)"
123142
conda activate
143+
conda list --show-channel-urls
124144
cmake -B build \
125145
-DBUILD_TESTING=ON \
126146
-DBUILD_SHARED_LIBS=ON \
127147
-DFAISS_ENABLE_GPU=${{ inputs.gpu }} \
128148
-DFAISS_ENABLE_CUVS=${{ inputs.cuvs }} \
129149
-DFAISS_ENABLE_ROCM=${{ inputs.rocm }} \
130150
-DFAISS_OPT_LEVEL=${{ inputs.opt_level }} \
151+
-DFAISS_ENABLE_SVS=${{ inputs.svs }} \
131152
-DFAISS_ENABLE_C_API=ON \
132153
-DPYTHON_EXECUTABLE=$CONDA/bin/python \
133154
-DCMAKE_BUILD_TYPE=Release \
@@ -138,33 +159,39 @@ runs:
138159
- name: C++ tests
139160
shell: bash
140161
run: |
162+
conda list --show-channel-urls
141163
export GTEST_OUTPUT="xml:$(realpath .)/test-results/googletest/"
142164
make -C build test
143165
- name: C++ perf benchmarks
144166
shell: bash
145167
if: inputs.rocm == 'OFF'
146168
run: |
169+
conda list --show-channel-urls
147170
find ./build/perf_tests/ -executable -type f -name "bench*" -exec '{}' -v \;
148171
- name: Install Python extension
149172
shell: bash
150173
working-directory: build/faiss/python
151174
run: |
175+
conda list --show-channel-urls
152176
$CONDA/bin/python setup.py install
153177
- name: ROCm - install ROCm-enabled torch via pip
154178
if: inputs.rocm == 'ON'
155179
shell: bash
156180
run: |
181+
conda list --show-channel-urls
157182
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm6.1
158183
- name: Python tests (CPU only)
159184
if: inputs.gpu == 'OFF'
160185
shell: bash
161186
run: |
187+
conda list --show-channel-urls
162188
pytest --junitxml=test-results/pytest/results.xml tests/test_*.py
163189
pytest --junitxml=test-results/pytest/results-torch.xml tests/torch_*.py
164190
- name: Python tests (CPU + GPU)
165191
if: inputs.gpu == 'ON'
166192
shell: bash
167193
run: |
194+
conda list --show-channel-urls
168195
pytest --junitxml=test-results/pytest/results.xml tests/test_*.py
169196
pytest --junitxml=test-results/pytest/results-torch.xml tests/torch_*.py
170197
cp tests/common_faiss_tests.py faiss/gpu/test
@@ -174,13 +201,14 @@ runs:
174201
if: inputs.opt_level == 'avx2'
175202
shell: bash
176203
run: |
204+
conda list --show-channel-urls
177205
FAISS_DISABLE_CPU_FEATURES=AVX2 LD_DEBUG=libs $CONDA/bin/python -c "import faiss" 2>&1 | grep faiss.so
178206
LD_DEBUG=libs $CONDA/bin/python -c "import faiss" 2>&1 | grep faiss_avx2.so
179207
- name: Upload test results
180-
if: always()
208+
if: inputs.upload_artifacts == 'true'
181209
uses: actions/upload-artifact@v4
182210
with:
183-
name: test-results-arch=${{ runner.arch }}-opt=${{ inputs.opt_level }}-gpu=${{ inputs.gpu }}-cuvs=${{ inputs.cuvs }}-rocm=${{ inputs.rocm }}
211+
name: test-results-arch=${{ runner.arch }}-opt=${{ inputs.opt_level }}-gpu=${{ inputs.gpu }}-cuvs=${{ inputs.cuvs }}-rocm=${{ inputs.rocm }}-svs=${{ inputs.svs }}
184212
path: test-results
185213
- name: Check installed packages channel
186214
shell: bash

.github/actions/build_conda/action.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,26 @@ runs:
4343
run: |
4444
# Ensure starting packages are from conda-forge.
4545
conda list --show-channel-urls
46-
conda install -y -q "conda!=24.11.0"
46+
conda install -y -q "conda!=24.11.0,<=25.07"
4747
conda install -y -q "conda-build=25.3.1" "liblief=0.14.1"
48-
conda list --show-channel-urls
48+
# Add Intel channel with lowest priority for libsvs-runtime only
49+
conda config --append channels https://software.repos.intel.com/python/conda
50+
conda config --set channel_priority flexible
4951
- name: Enable anaconda uploads
5052
if: inputs.label != ''
5153
shell: ${{ steps.choose_shell.outputs.shell }}
5254
env:
5355
PACKAGE_TYPE: ${{ inputs.label }}
5456
run: |
57+
conda list --show-channel-urls
5558
conda install -y -q anaconda-client
5659
conda config --set anaconda_upload yes
5760
- name: Conda build (CPU)
5861
if: inputs.label == '' && inputs.cuda == ''
5962
shell: ${{ steps.choose_shell.outputs.shell }}
6063
working-directory: conda
6164
run: |
65+
conda list --show-channel-urls
6266
conda build faiss --python 3.11 -c pytorch
6367
- name: Conda build (CPU) w/ anaconda upload
6468
if: inputs.label != '' && inputs.cuda == ''
@@ -67,12 +71,14 @@ runs:
6771
env:
6872
PACKAGE_TYPE: ${{ inputs.label }}
6973
run: |
74+
conda list --show-channel-urls
7075
conda build faiss --user pytorch --label ${{ inputs.label }} -c pytorch
7176
- name: Conda build (GPU)
7277
if: inputs.label == '' && inputs.cuda != '' && inputs.cuvs == ''
7378
shell: ${{ steps.choose_shell.outputs.shell }}
7479
working-directory: conda
7580
run: |
81+
conda list --show-channel-urls
7682
conda build faiss-gpu --variants '{ "cudatoolkit": "${{ inputs.cuda }}" }' \
7783
-c pytorch -c nvidia/label/cuda-${{ inputs.cuda }} -c nvidia
7884
- name: Conda build (GPU) w/ anaconda upload
@@ -82,13 +88,15 @@ runs:
8288
env:
8389
PACKAGE_TYPE: ${{ inputs.label }}
8490
run: |
91+
conda list --show-channel-urls
8592
conda build faiss-gpu --variants '{ "cudatoolkit": "${{ inputs.cuda }}" }' \
8693
--user pytorch --label ${{ inputs.label }} -c pytorch -c nvidia/label/cuda-${{ inputs.cuda }} -c nvidia
8794
- name: Conda build (GPU w/ cuVS)
8895
if: inputs.label == '' && inputs.cuda != '' && inputs.cuvs != ''
8996
shell: ${{ steps.choose_shell.outputs.shell }}
9097
working-directory: conda
9198
run: |
99+
conda list --show-channel-urls
92100
conda build faiss-gpu-cuvs --variants '{ "cudatoolkit": "${{ inputs.cuda }}" }' \
93101
-c pytorch -c rapidsai -c rapidsai-nightly -c conda-forge -c nvidia
94102
- name: Conda build (GPU w/ cuVS) w/ anaconda upload
@@ -98,6 +106,7 @@ runs:
98106
env:
99107
PACKAGE_TYPE: ${{ inputs.label }}
100108
run: |
109+
conda list --show-channel-urls
101110
conda build faiss-gpu-cuvs --variants '{ "cudatoolkit": "${{ inputs.cuda }}" }' \
102111
--user pytorch --label ${{ inputs.label }} -c pytorch -c rapidsai -c rapidsai-nightly -c conda-forge -c nvidia
103112
- name: Check installed packages channel

.github/workflows/autoclose.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,24 @@ name: Close Inactive Issues
22
on:
33
schedule:
44
- cron: "30 1 * * *"
5+
issues:
6+
types: [labeled]
57

68
jobs:
9+
notify-on-label:
10+
if: github.event_name == 'issues' && github.event.label.name == 'autoclose'
11+
runs-on: ubuntu-latest
12+
permissions:
13+
issues: write
14+
steps:
15+
- name: Comment on autoclose label
16+
env:
17+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18+
GH_REPO: ${{ github.repository }}
19+
run: gh issue comment ${{ github.event.issue.number }} --body "This issue has been marked for autoclose and will be closed after 14 days of inactivity."
20+
721
close-issues:
22+
if: github.event_name == 'schedule'
823
runs-on: ubuntu-latest
924
permissions:
1025
issues: write

.github/workflows/build-pull-request.yml

Lines changed: 42 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ jobs:
1717
sudo apt install -y lsb-release wget software-properties-common gnupg
1818
wget https://apt.llvm.org/llvm.sh
1919
chmod u+x llvm.sh
20-
sudo ./llvm.sh 18
21-
sudo apt-get install -y git-core clang-format-18
20+
sudo ./llvm.sh 21
21+
sudo apt-get install -y git-core clang-format-21
2222
- name: Verify clang-format
2323
run: |
24-
git ls-files | grep -E '\.(cpp|h|cu|cuh)$' | xargs clang-format-18 -i
24+
git ls-files | grep -E '\.(cpp|h|cu|cuh)$' | xargs clang-format-21 -i
2525
if git diff --quiet; then
2626
echo "Formatting OK!"
2727
else
@@ -38,6 +38,9 @@ jobs:
3838
uses: actions/checkout@v4
3939
- name: Build and Test (cmake)
4040
uses: ./.github/actions/build_cmake
41+
- name: Build C++ demos
42+
run: |
43+
make -C build demo_diversity_result_handler
4144
linux-x86_64-AVX2-cmake:
4245
name: Linux x86_64 AVX2 (cmake)
4346
needs: linux-x86_64-cmake
@@ -71,6 +74,17 @@ jobs:
7174
uses: ./.github/actions/build_cmake
7275
with:
7376
opt_level: avx512_spr
77+
linux-x86_64-DD-cmake:
78+
name: Linux x86_64 Dynamic Dispatch (cmake)
79+
needs: linux-x86_64-cmake
80+
runs-on: faiss-aws-m7i.large
81+
steps:
82+
- name: Checkout
83+
uses: actions/checkout@v4
84+
- name: Build and Test (cmake)
85+
uses: ./.github/actions/build_cmake
86+
with:
87+
opt_level: dd
7488
linux-x86_64-GPU-cmake:
7589
name: Linux x86_64 GPU (cmake)
7690
needs: linux-x86_64-cmake
@@ -94,31 +108,22 @@ jobs:
94108
with:
95109
gpu: ON
96110
cuvs: ON
97-
linux-x86_64-GPU-w-ROCm-cmake:
98-
name: Linux x86_64 GPU w/ ROCm (cmake)
111+
linux-arm64-SVE-cmake:
112+
name: Linux arm64 SVE (cmake)
99113
needs: linux-x86_64-cmake
100-
runs-on: faiss-amd-MI200
101-
container:
102-
image: ubuntu:22.04
103-
options: --device=/dev/kfd --device=/dev/dri --ipc=host --shm-size 16G --group-add video --cap-add=SYS_PTRACE --cap-add=SYS_ADMIN
114+
runs-on: faiss-aws-r8g.large
104115
steps:
105-
- name: Container setup
106-
run: |
107-
if [ -f /.dockerenv ]; then
108-
apt-get update && apt-get install -y sudo && apt-get install -y git
109-
git config --global --add safe.directory '*'
110-
else
111-
echo 'Skipping. Current job is not running inside a container.'
112-
fi
113116
- name: Checkout
114117
uses: actions/checkout@v4
115118
- name: Build and Test (cmake)
116119
uses: ./.github/actions/build_cmake
117120
with:
118-
gpu: ON
119-
rocm: ON
120-
linux-arm64-SVE-cmake:
121-
name: Linux arm64 SVE (cmake)
121+
opt_level: sve
122+
env:
123+
# Context: https://github.com/facebookresearch/faiss/wiki/Troubleshooting#surprising-faiss-openmp-and-openblas-interaction
124+
OPENBLAS_NUM_THREADS: '1'
125+
linux-arm64-DD-cmake:
126+
name: Linux arm64 Dynamic Dispatch (cmake)
122127
needs: linux-x86_64-cmake
123128
runs-on: faiss-aws-r8g.large
124129
steps:
@@ -127,9 +132,8 @@ jobs:
127132
- name: Build and Test (cmake)
128133
uses: ./.github/actions/build_cmake
129134
with:
130-
opt_level: sve
135+
opt_level: dd
131136
env:
132-
# Context: https://github.com/facebookresearch/faiss/wiki/Troubleshooting#surprising-faiss-openmp-and-openblas-interaction
133137
OPENBLAS_NUM_THREADS: '1'
134138
linux-x86_64-conda:
135139
name: Linux x86_64 (conda)
@@ -167,3 +171,18 @@ jobs:
167171
fetch-tags: true
168172
- name: Build and Package (conda)
169173
uses: ./.github/actions/build_conda
174+
linux-x86_64-svs:
175+
name: Linux x86_64 w/ SVS (cmake)
176+
needs: linux-x86_64-cmake
177+
runs-on: ubuntu-latest
178+
steps:
179+
- name: Checkout
180+
uses: actions/checkout@v4
181+
- name: Build and Test (cmake)
182+
uses: ./.github/actions/build_cmake
183+
with:
184+
svs: ON
185+
index-io-backward-compatibility:
186+
needs: linux-x86_64-cmake
187+
name: Index serialization backward compatibility
188+
uses: ./.github/workflows/index-io-backward-compatibility.yml

.github/workflows/build-release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
with:
2424
label: main
2525
linux-x86_64-GPU-packages-CUDA-12-4-0:
26-
name: Linux x86_64 GPU packages (CUDA 12.4.0)
26+
name: Linux x86_64 GPU packages (CUDA 12.6)
2727
runs-on: 4-core-ubuntu-gpu-t4
2828
env:
2929
CUDA_ARCHS: "70-real;72-real;75-real;80;86-real"
@@ -39,9 +39,9 @@ jobs:
3939
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }}
4040
with:
4141
label: main
42-
cuda: "12.4.0"
42+
cuda: "12.6"
4343
linux-x86_64-GPU-CUVS-packages-CUDA12-4-0:
44-
name: Linux x86_64 GPU w/ cuVS packages (CUDA 12.4.0)
44+
name: Linux x86_64 GPU w/ cuVS packages (CUDA 12.6)
4545
runs-on: 4-core-ubuntu-gpu-t4
4646
env:
4747
CUDA_ARCHS: "70-real;72-real;75-real;80;86-real"
@@ -58,7 +58,7 @@ jobs:
5858
with:
5959
label: main
6060
cuvs: "ON"
61-
cuda: "12.4.0"
61+
cuda: "12.6"
6262
windows-x86_64-packages:
6363
name: Windows x86_64 packages
6464
runs-on: windows-2022

0 commit comments

Comments
 (0)