Skip to content

make sure we get all the dgml files#54875

Open
baronfel wants to merge 5 commits into
mainfrom
fix-aot-size-analysis-paths
Open

make sure we get all the dgml files#54875
baronfel wants to merge 5 commits into
mainfrom
fix-aot-size-analysis-paths

Conversation

@baronfel

@baronfel baronfel commented Jun 18, 2026

Copy link
Copy Markdown
Member

NativeAOT size-analysis pipeline fixes

This PR fixes how the NativeAOT size-analysis files (dotnet-aot.mstat, dotnet-aot.codegen.dgml.xml, dotnet-aot.scan.dgml.xml) are collected and uploaded from the SDK build legs, and makes the macOS AoT leg actually produce them.

Changes

  1. Correct file globs/names. ILC emits two DGML files (*.codegen.dgml.xml and *.scan.dgml.xml, not *.scan.dgml) plus the *.mstat, all under <config>/<tfm>/<rid>/native/. The copy step now matches all three with a precise <config>/*/*/native/ glob.

  2. Only collect on AoT legs. The Copy/Publish NativeAOT Size Analysis steps were unconditional, so non-AoT legs (TestBuild, FullFramework) were running them and uploading _AotSizeAnalysis artifacts too. They are now gated behind runAoTTests.

  3. Preserve the build binlog. The Copy Logs step uploads Build.binlog, but on every leg it was byte-identical to …Tests.binlog and contained only test projects — never redist/dotnet-aot. Root cause: -ci makes Arcade emit a default Build.binlog, and the test step (also -ci) appended a raw /bl:, so it wrote both files and clobbered the build step's real Build.binlog. The test step now uses Arcade's --binaryLogName, so the build binlog (which captures the redist GenerateSdkLayoutdotnet-aot NativeAOT publish) survives for diagnosis.

  4. Run the macOS AoT leg on native arm64 hardware. The macOS AoT leg targets osx-arm64 but the default macOS pool is the Intel (osx-x64) hosted image, so HostRid (osx-x64) != TargetRid (osx-arm64). Because PublishDotnetAot is (correctly) native-only — NativeAOT does not support cross-compilation — the publish was skipped and the leg produced no .dylib/mstat/dgml. Rather than relax that product gate, the AoT leg now runs on a native arm64 macOS image (macOS-15-arm64) so the build is native (HostRid == TargetRid == osx-arm64) and produces the size-analysis output. Because a per-leg pool override collides with the matrix template's ${{ insert }} expansion ('pool' is already defined), the AoT leg is split into its own dedicated sdk-job-matrix.yml invocation in .vsts-pr.yml whose pool is the arm64 image; the non-AoT macOS TestBuild leg keeps using the x64 hosted image so it does not add load to arm64 hosted capacity. The AoT leg is PR-only (.vsts-ci.yml never includes an AoT macOS category), so it is removed from the shared default macOSJobParameterSets.

Copilot AI review requested due to automatic review settings June 18, 2026 18:29
@baronfel baronfel requested a review from MiYanni as a code owner June 18, 2026 18:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the SDK build pipeline to publish the complete set of NativeAOT size-analysis artifacts by copying additional DGML graph outputs into the _AotSizeAnalysis pipeline artifact.

Changes:

  • Extend NativeAOT size-analysis artifact collection to include dotnet-aot.codegen.dgml.xml and dotnet-aot.scan.dgml.xml.
  • Adjust the copy glob patterns for the NativeAOT size-analysis outputs under artifacts/obj/dotnet-aot.

Comment thread eng/pipelines/templates/jobs/sdk-build.yml Outdated
@baronfel

Copy link
Copy Markdown
Member Author

It would be good to also figure out how to only collect these assets on the AOT legs? We seem to be trying to collect on TestBuild legs too, and I'm not sure everything needed is in place.

@baronfel baronfel linked an issue Jun 22, 2026 that may be closed by this pull request
baronfel and others added 2 commits June 23, 2026 10:34
Only the AoT legs publish the dotnet-aot NativeAOT library, so gate the
Copy/Publish NativeAOT Size Analysis steps behind runAoTTests so they no
longer run (and upload empty artifacts) on non-AoT legs.

Also switch the test step to Arcade's --binaryLogName instead of a raw
/bl:. The raw /bl: left Arcade's default Build.binlog logger active too,
so the test run overwrote the build step's Build.binlog -- the one that
captures the redist GenerateSdkLayout / dotnet-aot NativeAOT publish.
Naming the test binlog explicitly preserves the build binlog so the
dotnet-aot publish is actually captured for diagnosis.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@baronfel baronfel force-pushed the fix-aot-size-analysis-paths branch from 5a989bb to 8842ace Compare June 23, 2026 15:34
The PublishDotnetAot target and its sequencing ProjectReference were gated on
TargetRid == HostRid, which skipped NativeAOT publish on the macOS AoT CI leg
(osx-x64 host cross-building osx-arm64). That left the macOS leg without the
dotnet-aot .dylib and its mstat/dgml size-analysis artifacts.

macOS's Xcode/clang toolchain can target both osx-x64 and osx-arm64 from a
macOS host, so same-OS cross-architecture NativeAOT publishing is supported.
Introduce a shared CanPublishDotnetAot property in src/Layout/Directory.Build.props
that keeps Windows/Linux native-only but allows any osx host -> osx target, and
reference it from both gates so they stay in sync.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@baronfel

baronfel commented Jun 23, 2026

Copy link
Copy Markdown
Member Author

Ok, the macOS AOT steps are now actually AOTing the product - but they are doing so in a cross-compilation-compatible way. We should consider changing the build host to be arm64 and rolling back the cross-compilation changes I added in this PR. Here is the pipeline for this implementation for future reference.

baronfel and others added 2 commits June 23, 2026 14:14
Revert the CanPublishDotnetAot gate relaxation: NativeAOT does not support
cross-compilation, so rather than allowing osx-x64 host -> osx-arm64 publish,
restore the original native-only gate (TargetRid == HostRid) for dotnet-aot in
GenerateLayout.targets and redist.csproj.

Instead, run the macOS AoT CI leg on native arm64 macOS hardware so the build is
native (HostRid == TargetRid == osx-arm64) and produces the dotnet-aot .dylib plus
its mstat/dgml size-analysis output. The pool override is scoped to the AoT leg
only (via the macOSJobParameterSets entry), so the non-AoT macOS TestBuild leg
keeps using the x64 hosted image and does not add load to arm64 hosted capacity.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The previous attempt added a per-leg pool override inside the AoT
macOSJobParameterSets entry. Azure Pipelines rejects that at compile time
("pool is already defined") because sdk-job-matrix.yml merges both the
parameters object and the jobParameters object via two separate inserts,
and duplicate keys across two inserts are an error rather than last-wins.

The AoT leg is PR-only (.vsts-ci.yml always overrides macOSJobParameterSets and
has no AoT category), so move it out of the shared default and into a dedicated
.vsts-pr.yml macOS invocation whose pool is the native arm64 image
(macOS-15-arm64). The default macOSJobParameterSets keeps just the TestBuild leg
on the x64 hosted image, so only the AoT leg uses arm64 hosted capacity.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@baronfel

Copy link
Copy Markdown
Member Author

/ba-g unrelated flaky tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-dotnet AOT Items that are part of the dotnet CLI AOT-ification effort Area-Infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build Errors from Publish NativeAOT Size Analysis step

3 participants