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.
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