Skip to content

Commit a77f60f

Browse files
Michael Norrisfacebook-github-bot
authored andcommitted
Fix ccache for GPU, Metal, and Windows CI builds
Summary: Fix ccache configuration to actually achieve cache hits across CI runs: 1. (P0) Configure ccache sloppiness for CUDA/ROCm builds — without `hash_dir=false` and relaxed sloppiness settings, nvcc/hipcc absolute paths cause 100% cache misses even when source is unchanged. 2. (P1) Add missing `-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache` to the Metal build step, which had its own cmake invocation that was missed in D102926935. 3. (P2) Increase cache size from 2G to 4G for GPU builds since CUDA object files are significantly larger. 4. (P3) Add ccache to the Windows build in build-pull-request.yml, which uses inline build steps instead of the build_cmake composite action. Differential Revision: D103482603
1 parent 46def46 commit a77f60f

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

.github/actions/build_cmake/action.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,14 @@ runs:
168168
uses: hendrikmuhs/ccache-action@v1
169169
with:
170170
key: ${{ runner.os }}-${{ runner.arch }}-${{ inputs.opt_level }}-gpu${{ inputs.gpu }}-cuvs${{ inputs.cuvs }}-rocm${{ inputs.rocm }}-svs${{ inputs.svs }}
171-
max-size: 2G
171+
max-size: ${{ inputs.gpu == 'ON' && '4G' || '2G' }}
172172
update-package-index: true
173+
- name: Configure ccache for CUDA/ROCm
174+
if: inputs.gpu == 'ON'
175+
shell: bash
176+
run: |
177+
ccache --set-config=sloppiness=pch_defines,time_macros,include_file_mtime,include_file_ctime
178+
ccache --set-config=hash_dir=false
173179
- name: Setup macOS Metal environment
174180
if: inputs.metal == 'ON'
175181
shell: bash
@@ -209,6 +215,8 @@ runs:
209215
-DFAISS_ENABLE_PYTHON=OFF \
210216
-DBUILD_TESTING=ON \
211217
-DCMAKE_BUILD_TYPE=Release \
218+
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
219+
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
212220
-DCMAKE_PREFIX_PATH="$(brew --prefix libomp)" \
213221
.
214222
cmake --build build --target faiss_metal TestMetalIndexFlat -j$(sysctl -n hw.logicalcpu)

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,11 @@ jobs:
201201
run: |
202202
conda install -y -q cmake swig "numpy>=2.0,<3.0" scipy pytest gflags setuptools
203203
conda install -y -q mkl=2024.2.2 mkl-devel=2024.2.2
204+
- name: Setup ccache
205+
uses: hendrikmuhs/ccache-action@v1
206+
with:
207+
key: ${{ runner.os }}-${{ runner.arch }}-dd-gpuOFF
208+
max-size: 2G
204209
- name: Build
205210
shell: pwsh
206211
run: |
@@ -217,6 +222,8 @@ jobs:
217222
-DFAISS_ENABLE_C_API=OFF `
218223
-DBLA_VENDOR=Intel10_64_dyn `
219224
-DCMAKE_BUILD_TYPE=Release `
225+
-DCMAKE_C_COMPILER_LAUNCHER=ccache `
226+
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache `
220227
-DPython_ROOT_DIR="$pythonDir" `
221228
.
222229
# Add faiss.dll and dependency DLLs to PATH for GoogleTest discovery

0 commit comments

Comments
 (0)