Trim unused CoreCLR native components from dotnet-linker-tests build - #131666
Open
sbomer wants to merge 3 commits into
Open
Trim unused CoreCLR native components from dotnet-linker-tests build#131666sbomer wants to merge 3 commits into
sbomer wants to merge 3 commits into
Conversation
The Runtime_Release jobs in the dotnet-linker-tests pipeline built the `clr` subset, which expands to `clr.native` and therefore performs a full CoreCLR native build. That includes several components the trimming and NativeAOT tests never use, most notably the `alljits` component (six cross-target alt-JITs) and `spmi` (SuperPMI and its shims). Narrow the subset list to just the components the tests need. This drops 703 of 2837 ninja targets (~25%) from the CoreCLR native build. Measured locally at `ninja -j 4`, matching the parallelism CI uses, the native build goes from 4m03s to 3m05s (-24%). Also drop two subsets that were pulled in by `clr` but are not needed: * `clr.packages` only produces the ILAsm, ILDAsm, TestHost and Sdk.IL nupkgs, which are consumed solely by official-build publishing. * `clr.crossarchtools` is redundant here: `_BuildCrossComponents` is already set whenever `ClrRuntimeBuildSubsets` is non-empty for CoreCLR, and the cross-tool build is gated on `_BuildAnyCrossArch`, which is false for native windows-x64 and linux-x64. Validated from a clean tree with the narrowed subsets: the trimming tests (88) and the NativeAOT test apps (57) all pass. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ce99ab84-7dd0-4307-8dbe-47d695b514de Assisted-by: Copilot:claude-opus-5
|
Azure Pipelines: Successfully started running 5 pipeline(s). 11 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @agocke, @dotnet/ilc-contrib |
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the runtime-linker-tests Azure Pipelines definition to build a narrower set of CoreCLR subsets for the Runtime_Release jobs, aiming to avoid building unused native components during trimming and NativeAOT test runs.
Changes:
- Replaces
-s clr+...with an explicit subset list centered onclr.runtimeplus NativeAOT/tooling subsets. - Adds inline pipeline comments documenting why
alljitsandspmiare intentionally excluded.
Show a summary per file
| File | Description |
|---|---|
| eng/pipelines/runtime-linker-tests.yml | Switches the CoreCLR build from clr to an explicit subset list intended to avoid building unused native components for linker/NativeAOT tests. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 1
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
jkoritzinsky
approved these changes
Jul 31, 2026
crossgen2 and ILC don't load clrjit; they load the JIT named for the target they are compiling for, e.g. clrjit_win_x64_x64 when targeting win-x64. On Unix that JIT is already installed into the `jit` component alongside clrjit, so a build that requests only `-component runtime` (which depends on `jit`) can run them. Windows had no equivalent rule, so the target-specific JIT was only ever installed as part of `alljits`. The result is that a Windows build which selects CoreCLR native components individually, rather than doing a full native build, produces a crossgen2 that fails at runtime with "Dll was not found" as soon as it is invoked, for example while R2R compiling System.Private.CoreLib. Mirror the existing Unix rule for Windows targets. Full native builds are unaffected since `alljits` already installed these JITs; this only makes the `jit` component self-contained on Windows the way it already is on Unix. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ce99ab84-7dd0-4307-8dbe-47d695b514de Assisted-by: Copilot:claude-opus-5
Contributor
There was a problem hiding this comment.
Copilot's findings
Suppressed comments (1)
eng/pipelines/runtime-linker-tests.yml:119
- The comment is slightly inaccurate: the
clrsubset expands to the full$(DefaultCoreClrSubsets)list (which includesclr.nativeamong others), not toclr.nativealone. Rewording avoids confusion for future maintainers reading the pipeline.
# This replaces the previous `clr` subset (which expands to `clr.native` and builds every native component)
- Files reviewed: 2/2 changed files
- Comments generated: 0 new
This was referenced Aug 4, 2026
sbomer
marked this pull request as ready for review
August 4, 2026 16:48
|
Azure Pipelines: Successfully started running 7 pipeline(s). 9 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
Runtime_Releasejobs in thedotnet-linker-testspipeline build theclrsubset. That expands to a list of CoreCLR subsets (eng/Subsets.props,DefaultCoreClrSubsets) which includesclr.native, andclr.nativeperforms a full CoreCLR native build. That pulls in components the trimming and NativeAOT tests never use — most notably the cross-target alt-JITs and SuperPMI.This PR narrows the subset list to what those tests actually need, and fixes a Windows/Unix asymmetry in the JIT install rules that blocked doing so.
1.
src/coreclr/jit/CMakeLists.txt— install the target-specific JIT into thejitcomponent on Windowscrossgen2 and ILC don't load
clrjit; they load the JIT named for the target they're compiling for, e.g.clrjit_win_x64_x64when targeting win-x64.On Unix that JIT is already installed into the
jitcomponent alongsideclrjit:Windows had no equivalent rule, so there the target-specific JIT was only ever installed as part of
alljits. Any Windows build that selects native components individually rather than doing a full native build therefore produces a crossgen2 that fails as soon as it runs:This mirrors the existing Unix rule for Windows targets. Full native builds are unaffected, since
alljitsalready installed these JITs — it only makes thejitcomponent self-contained on Windows the way it already is on Unix.2.
eng/pipelines/runtime-linker-tests.yml— narrow the subset listclr.nativeis replaced byclr.runtime+clr.nativeaotruntime(theruntimeandnativeaotCMake components).src/coreclr/components.cmakeshowsruntimealready depends onjit,iltools,debugandhosts, and with the fix abovejitnow also carries the JIT crossgen2/ILC need.Dropped as a result:
alljits— the cross-target alt-JITs. On win-x64 onlyclrjitandclrjit_win_x64_x64are now built; on linux-x64 onlyclrjitandclrjit_unix_x64_x64.spmi— SuperPMI and its shims.clr.packages— only produces the ILAsm/ILDAsm/TestHost/Sdk.IL nupkgs, referenced solely byeng/Publishing.propsfor official-build publishing. Packing them takes ~2.5s, so this is a cleanliness change, not a perf one.clr.crossarchtools— redundant here:_BuildCrossComponentsis already set wheneverClrRuntimeBuildSubsetsis non-empty for CoreCLR, and the cross-tool build is gated on_BuildAnyCrossArch, which is false for native windows-x64/linux-x64. Verified that no cross-arch build directory is produced either way.Measurements
Measured on CI, comparing build 1538104 (this PR) against 1534932 (a recent PR build of the unchanged pipeline):
mono)The windows-x64 job as a whole goes from 62.4m to 56.5m. Total build wall clock went from 75.0m to 68.0m, though that figure includes queue variance across runs — the "Build product" numbers are the reliable ones. linux-x64 saves time too but stays off the critical path.
Locally, isolating just the CoreCLR native build on linux-x64 at
ninja -j 4(the parallelism CI uses) gives 4m03s → 3m05s, i.e. −24%, consistent with the CI result.Validation
Locally, from a clean tree with the narrowed subsets:
libcoreclr.so,ilc,crossgen2,ilasm/ildasm, DAC/mscordbi and theaotsdkall still present; superpmi and the unused alt-JITs goneOn CI, all three
dotnet-linker-testsjobs (windows-x64, linux-x64, browser-wasm) pass, including the trimming and NativeAOT test app steps, with no change in test counts or coverage.Two unrelated failures show up on this PR and are not caused by it:
runtime (Build openbsd-x64 Debug CoreCLR_Bootstrapped)— fails withNETSDK1203on every recent PR (sampled 6/6); the leg only passes onmainbecause rolling builds run it as Release.System.Net.Security.Tests.TlsSessionTests.SslStreamServer_RejectsClientCert_ClientObservesAlerton linux-arm64 — known flaky, tracked by Disable TLS resume in SslStreamServer_RejectsClientCert_ClientObservesAlert #131755 (44 hits in the last month).Note
This content was created with assistance from AI.