From 359348840e10037bb443b15d66f9d893b6a88371 Mon Sep 17 00:00:00 2001 From: Andy Gocke Date: Tue, 12 May 2026 07:32:13 +0000 Subject: [PATCH 1/5] Enable sccache for arm64 and FreeBSD cross-builds Widen the sccache condition to cover arm64 (cross-compiled on x64 machines) and FreeBSD in addition to linux-x64. Also include osSubgroup in the cache key so musl builds get a separate cache entry when that change lands. All these targets use the same x64 sccache binary since the builds are cross-compiled in ADO. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- eng/pipelines/coreclr/templates/sccache-stats.yml | 2 +- eng/pipelines/coreclr/templates/setup-sccache.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/coreclr/templates/sccache-stats.yml b/eng/pipelines/coreclr/templates/sccache-stats.yml index fdef7e530fc2fd..6f2d9e4f98ea54 100644 --- a/eng/pipelines/coreclr/templates/sccache-stats.yml +++ b/eng/pipelines/coreclr/templates/sccache-stats.yml @@ -12,7 +12,7 @@ parameters: osSubgroup: '' steps: - - ${{ if and(eq(parameters.osGroup, 'linux'), or(eq(parameters.osSubgroup, ''), eq(parameters.osSubgroup, '_musl')), eq(parameters.archType, 'x64')) }}: + - ${{ if and(or(eq(parameters.osGroup, 'linux'), eq(parameters.osGroup, 'freebsd')), or(eq(parameters.archType, 'x64'), eq(parameters.archType, 'arm64'))) }}: - script: sccache --show-stats || true displayName: Sccache stats condition: always() diff --git a/eng/pipelines/coreclr/templates/setup-sccache.yml b/eng/pipelines/coreclr/templates/setup-sccache.yml index cdd232589cd80a..e4559a3e371b51 100644 --- a/eng/pipelines/coreclr/templates/setup-sccache.yml +++ b/eng/pipelines/coreclr/templates/setup-sccache.yml @@ -15,7 +15,7 @@ parameters: sccacheVersion: '0.15.0' steps: - - ${{ if and(eq(parameters.osGroup, 'linux'), or(eq(parameters.osSubgroup, ''), eq(parameters.osSubgroup, '_musl')), eq(parameters.archType, 'x64')) }}: + - ${{ if and(or(eq(parameters.osGroup, 'linux'), eq(parameters.osGroup, 'freebsd')), or(eq(parameters.archType, 'x64'), eq(parameters.archType, 'arm64'))) }}: # Set up the Azure Pipeline Cache for sccache's local cache directory. # Use a rolling key so each build can update the cache; restoreKeys # falls back to the most recent saved entry. From 2f6b8033da6430d48c01d0172c042779bde8ca31 Mon Sep 17 00:00:00 2001 From: Andy Gocke Date: Tue, 12 May 2026 18:40:16 +0000 Subject: [PATCH 2/5] Increase sccache cache size to 5 GiB The 3.5 GiB limit was causing sccache to evict useful entries, dropping the hit rate from ~97% to ~89%. The full working set is around 7-8 GiB. Bumping to 5 GiB should recover most of the hit rate. With continueOnError on the Cache task (#128052), any disk space issues during upload will no longer fail the build. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- eng/pipelines/coreclr/templates/setup-sccache.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/coreclr/templates/setup-sccache.yml b/eng/pipelines/coreclr/templates/setup-sccache.yml index e4559a3e371b51..3472ffe296bf34 100644 --- a/eng/pipelines/coreclr/templates/setup-sccache.yml +++ b/eng/pipelines/coreclr/templates/setup-sccache.yml @@ -43,7 +43,7 @@ steps: chmod +x "$sccacheDir/sccache" echo "##vso[task.prependpath]$sccacheDir" echo "##vso[task.setvariable variable=SCCACHE_DIR]$(Pipeline.Workspace)/.sccache" - echo "##vso[task.setvariable variable=SCCACHE_CACHE_SIZE]3584M" + echo "##vso[task.setvariable variable=SCCACHE_CACHE_SIZE]5120M" echo "##vso[task.setvariable variable=SCCACHE_IDLE_TIMEOUT]0" echo "##vso[task.setvariable variable=USE_SCCACHE]true" displayName: Download and configure sccache From 28bffde96c349bc74a23a8ecc7ef0ca78f0321c5 Mon Sep 17 00:00:00 2001 From: Andy Gocke Date: Tue, 12 May 2026 18:48:08 +0000 Subject: [PATCH 3/5] Add sccache to additional CoreCLR build legs Add setup-sccache.yml and sccache-stats.yml to build legs that were missing them: - AllSubsets_CoreCLR_ReleaseRuntimeLibs (linux_musl_arm, linux_musl_arm64) - AllSubsets_CoreCLR (linux_arm64, linux_musl_x64) - Libraries_CheckedCoreCLR (linux_arm64) - CoreCLR_ReleaseLibraries (linux_x64, linux_musl_arm, linux_musl_arm64) - CoreCLR_Bootstrapped (freebsd_x64) The sccache condition filters to linux/freebsd x64/arm64 only, so arm32 legs will be a no-op. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- eng/pipelines/runtime.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/eng/pipelines/runtime.yml b/eng/pipelines/runtime.yml index 58f08f5f183f3c..f763b97ae48dff 100644 --- a/eng/pipelines/runtime.yml +++ b/eng/pipelines/runtime.yml @@ -83,6 +83,10 @@ extends: nameSuffix: AllSubsets_CoreCLR_ReleaseRuntimeLibs buildArgs: -s clr+libs+host+packs -rc Release -lc Release -c $(_BuildConfig) timeoutInMinutes: 120 + preBuildSteps: + - template: /eng/pipelines/coreclr/templates/setup-sccache.yml + postBuildSteps: + - template: /eng/pipelines/coreclr/templates/sccache-stats.yml condition: >- or( eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_non_mono_and_wasm.containsChange'], true), @@ -99,6 +103,10 @@ extends: nameSuffix: AllSubsets_CoreCLR buildArgs: -s clr+libs+host+packs -rc Release -c Release -lc $(_BuildConfig) timeoutInMinutes: 120 + preBuildSteps: + - template: /eng/pipelines/coreclr/templates/setup-sccache.yml + postBuildSteps: + - template: /eng/pipelines/coreclr/templates/sccache-stats.yml condition: >- or( eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_non_mono_and_wasm.containsChange'], true), @@ -360,7 +368,10 @@ extends: nameSuffix: Libraries_CheckedCoreCLR buildArgs: -s clr+libs+libs.tests -c $(_BuildConfig) -rc Checked /p:ArchiveTests=true timeoutInMinutes: 120 + preBuildSteps: + - template: /eng/pipelines/coreclr/templates/setup-sccache.yml postBuildSteps: + - template: /eng/pipelines/coreclr/templates/sccache-stats.yml - template: /eng/pipelines/coreclr/templates/build-native-test-assets-step.yml - template: /eng/pipelines/common/upload-artifact-step.yml parameters: @@ -539,7 +550,10 @@ extends: nameSuffix: CoreCLR_ReleaseLibraries buildArgs: -s clr+libs+libs.tests -rc $(_BuildConfig) -c Release /p:ArchiveTests=true timeoutInMinutes: 120 + preBuildSteps: + - template: /eng/pipelines/coreclr/templates/setup-sccache.yml postBuildSteps: + - template: /eng/pipelines/coreclr/templates/sccache-stats.yml - template: /eng/pipelines/common/upload-artifact-step.yml parameters: rootFolder: $(Build.SourcesDirectory)/artifacts/bin @@ -649,6 +663,10 @@ extends: nameSuffix: CoreCLR_Bootstrapped buildArgs: -s clr+libs+host+packs+tools.cdac -c $(_BuildConfig) -rc Checked --bootstrap timeoutInMinutes: 120 + preBuildSteps: + - template: /eng/pipelines/coreclr/templates/setup-sccache.yml + postBuildSteps: + - template: /eng/pipelines/coreclr/templates/sccache-stats.yml condition: >- or( eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'], true), From b55a125165e7a69d13163ffdc723b0b6430db85f Mon Sep 17 00:00:00 2001 From: Andy Gocke Date: Tue, 12 May 2026 18:49:23 +0000 Subject: [PATCH 4/5] Add sccache to hardware-intrinsics pipeline Add setup-sccache.yml and sccache-stats.yml to both the CoreCLR and NativeAOT job groups in jit-hardware-intrinsics-common.yml. Covers linux_x64 and linux_arm64 legs; arm32 is filtered out by the sccache condition. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../coreclr/templates/jit-hardware-intrinsics-common.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/eng/pipelines/coreclr/templates/jit-hardware-intrinsics-common.yml b/eng/pipelines/coreclr/templates/jit-hardware-intrinsics-common.yml index 64b273543d065d..a9cc53ed926d99 100644 --- a/eng/pipelines/coreclr/templates/jit-hardware-intrinsics-common.yml +++ b/eng/pipelines/coreclr/templates/jit-hardware-intrinsics-common.yml @@ -21,7 +21,10 @@ jobs: nameSuffix: CoreCLR buildArgs: -s clr+libs -c $(_BuildConfig) timeoutInMinutes: 360 + preBuildSteps: + - template: /eng/pipelines/coreclr/templates/setup-sccache.yml postBuildSteps: + - template: /eng/pipelines/coreclr/templates/sccache-stats.yml - template: /eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml parameters: creator: dotnet-bot @@ -48,7 +51,10 @@ jobs: nameSuffix: NativeAOT buildArgs: -s clr.aot+libs.native+libs.sfx -c $(_BuildConfig) timeoutInMinutes: 360 + preBuildSteps: + - template: /eng/pipelines/coreclr/templates/setup-sccache.yml postBuildSteps: + - template: /eng/pipelines/coreclr/templates/sccache-stats.yml - template: /eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml parameters: creator: dotnet-bot From e43ed7df1f2e1a4cc7c15fdeac2b0a5b37c48fca Mon Sep 17 00:00:00 2001 From: Andy Gocke Date: Tue, 12 May 2026 18:51:02 +0000 Subject: [PATCH 5/5] Add sccache to dev-innerloop Musl_Validation leg The global-build.yml Musl_Validation leg builds clr.native+libs.native+ host.native on linux_musl_x64 and benefits from sccache caching. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- eng/pipelines/global-build.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/eng/pipelines/global-build.yml b/eng/pipelines/global-build.yml index f1a62719914144..49f2a156acc1ca 100644 --- a/eng/pipelines/global-build.yml +++ b/eng/pipelines/global-build.yml @@ -113,6 +113,10 @@ extends: nameSuffix: Musl_Validation buildArgs: -subset clr.native+libs.native+host.native -c $(_BuildConfig) timeoutInMinutes: 120 + preBuildSteps: + - template: /eng/pipelines/coreclr/templates/setup-sccache.yml + postBuildSteps: + - template: /eng/pipelines/coreclr/templates/sccache-stats.yml condition: or( eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_non_mono_and_wasm.containsChange'], true),