Repository navigation
COMP: Fix ccache hit rate on Azure DevOps to near-zero - #6048
Conversation
|
| Filename | Overview |
|---|---|
| Testing/ContinuousIntegration/AzurePipelinesLinux.yml | Replaces CCACHE_NODIRECT=1 with CCACHE_SLOPPINESS=pch_defines,time_macros, adds per-job cache keys (ccache-v4 |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Pipeline starts per job] --> B[Restore ccache per-job key]
B --> C[zero-stats, evict old entries, show-config]
C --> D[ctest build with ccache direct mode]
D --> E{Cache hit?}
E -->|Yes ~99.95pct| F[Reuse cached object]
E -->|No| G[Compile and store]
D --> H[show-stats always runs]
H --> I[report diagnostics and publish]
Reviews (1): Last reviewed commit: "COMP: Fix near-zero ccache hit rate on A..." | Re-trigger Greptile
Remove CCACHE_NODIRECT=1 which disabled ccache's fast direct mode, forcing preprocessor-mode hashing on every compilation unit. The ARM CI (which never had NODIRECT) achieves 98.5% hit rate; Azure DevOps was at 0.02%. Applied to all 7 Azure DevOps pipelines: - AzurePipelinesLinux.yml (3 jobs: Linux, LinuxLegacyRemoved, LinuxCxx20) - AzurePipelinesLinuxPython.yml - AzurePipelinesMacOS.yml - AzurePipelinesMacOSPython.yml - AzurePipelinesWindows.yml - AzurePipelinesWindowsPython.yml - AzurePipelinesBatch.yml Changes per pipeline: - Remove CCACHE_NODIRECT=1 (enable direct mode) - Add CCACHE_SLOPPINESS=pch_defines,time_macros - Add per-job name to cache key (ccache-v4 | OS | JobName | SHA) - Remove ITK_USE_CCACHE:BOOL=ON (redundant with CMAKE_*_LAUNCHER) - Add ccache --zero-stats + --show-config maintenance step - Add ccache --show-stats step after build for monitoring Tested in PR InsightSoftwareConsortium#6047: Run 2 achieved 99.95% hit rate (2166/2167 direct hits) after these fixes on the Linux pipeline.
285b0be to
fb17c4c
Compare
…p-ccache-azure-fix COMP: Fix ccache hit rate on Azure DevOps to near-zero
…p-ccache-azure-fix COMP: Fix ccache hit rate on Azure DevOps to near-zero
Fix ccache configuration on all 7 Azure DevOps pipelines — hit rate was 0.02%, now 99.95%.
Root cause and fix
Root cause:
CCACHE_NODIRECT=1(global variable) disabled ccache's fast "direct mode" which hashes source files directly. Instead, every file was preprocessed before hashing — a slower path that also changes hash inputs, causing near-total cache misses across runs.Evidence: ARM CI (GitHub Actions) never had
NODIRECTand achieves 98.5% hit rate. Azure DevOps withNODIRECT=1was at 0.02% (1 hit out of 5160 cacheable calls).Fixes applied to all 7 Azure pipelines:
CCACHE_NODIRECT=1— enable direct modeCCACHE_SLOPPINESS=pch_defines,time_macros— prevent__DATE__/__TIME__missesccache-v4 | OS | JobName | SHA) — prevents jobs with different build configs from poisoning each other's cachesITK_USE_CCACHE:BOOL=ON— redundant withCMAKE_*_COMPILER_LAUNCHER=ccacheccache --show-stats+ccache --zero-statssteps for monitoringPipelines updated:
Test results from PR #6047