Skip to content

[Android] Enable Composite Partial ReadyToRun on Release builds by default - #33234

Merged
rmarinho merged 26 commits into
net11.0from
android-r2r
Feb 6, 2026
Merged

rmarinho merged 26 commits into
net11.0from
android-r2r

Conversation

@davidnguyen-tech

@davidnguyen-tech davidnguyen-tech commented Dec 19, 2025 •

Copy link
Copy Markdown
Member

Summary

Closes #33387
Closes #33388

This PR enables Composite Partial ReadyToRun by default for CoreCLR on Android Release builds.

The users can customize the ReadyToRun configuration too:

Property Default Customization
PublishReadyToRun true Set false to Disable R2R entirely
PublishReadyToRunComposite true Set false to Use non-composite R2R (separate native images per assembly)
_MauiPublishReadyToRunPartial true Set false to Use full R2R (AOT-compile all methods, not just profiled)
_MauiUseDefaultReadyToRunPgoFiles true Set false to Exclude MAUI's default MIBC profiles

To include custom MIBC profiles:

<ItemGroup>
    <_ReadyToRunPgoFiles Include=<path-to-custom-profile> />
</ItemGroup>

Progress

  • Restore MIBC profiles for PGO
    • Use Android specific profile once available (using irrelevant profiles now just for local testing)
  • Pack the profiles into Microsoft.Maui.Controls.Build.Tasks.nupkg
  • Setup a Maestro subscription
  • Use the profiles to enable Composite Partial ReadyToRun on Android

@davidnguyen-tech davidnguyen-tech self-assigned this Dec 19, 2025
@davidnguyen-tech davidnguyen-tech changed the title [WIP][Android] Enable ReadyToRun with PGO [WIP][Android] Add restoring optimization data Jan 6, 2026
@davidnguyen-tech
davidnguyen-tech deleted the android-r2r branch January 6, 2026 10:53
@davidnguyen-tech
davidnguyen-tech restored the android-r2r branch January 6, 2026 10:55
@davidnguyen-tech
davidnguyen-tech changed the base branch from main to net11.0 January 6, 2026 12:15
@davidnguyen-tech davidnguyen-tech changed the title [WIP][Android] Add restoring optimization data [WIP][Android] Enable Composite Partial ReadyToRun on Release builds by default Jan 14, 2026
@davidnguyen-tech davidnguyen-tech added platform/android perf/app-size Application Size / Trimming (sub: perf) perf/startup-time Issues relating to startup time (sub: perf) labels Jan 14, 2026
@davidnguyen-tech davidnguyen-tech changed the title [WIP][Android] Enable Composite Partial ReadyToRun on Release builds by default [WIP][Android] Enable Composite Profile-Guided Partial ReadyToRun on Release builds by default Jan 14, 2026
@davidnguyen-tech davidnguyen-tech changed the title [WIP][Android] Enable Composite Profile-Guided Partial ReadyToRun on Release builds by default [WIP][Android] Enable Composite Partial ReadyToRun on Release builds by default Jan 15, 2026
@rmarinho

Copy link
Copy Markdown
Member

/rebase

@davidnguyen-tech
davidnguyen-tech marked this pull request as ready for review January 30, 2026 13:09
Copilot AI review requested due to automatic review settings January 30, 2026 13:09
@simonrozsival simonrozsival changed the title [WIP][Android] Enable Composite Partial ReadyToRun on Release builds by default [Android] Enable Composite Partial ReadyToRun on Release builds by default Jan 30, 2026

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

Enables Composite Partial ReadyToRun (R2R) by default for Android CoreCLR Release builds, and adds infrastructure to restore/package MIBC (PGO) profiles into the MAUI build tasks NuGet so those defaults have profiles available.

Changes:

  • Enable PublishReadyToRun + composite R2R and add --partial by default for Android CoreCLR Release builds via Microsoft.Maui.Controls.targets.
  • Add an eng/optimizationData.targets restore step to download/copy .mibc optimization data into $(ArtifactsDir)\mibc.
  • Pack copied .mibc files into Microsoft.Maui.Controls.Build.Tasks (buildTransitive/netstandard2.0/mibc) and add a new dependency version.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/Controls/src/Build.Tasks/nuget/buildTransitive/netstandard2.0/Microsoft.Maui.Controls.targets Turns on composite/partial R2R and wires default _ReadyToRunPgoFiles to packaged .mibc profiles for Android CoreCLR Release.
src/Controls/src/Build.Tasks/Controls.Build.Tasks.csproj Packs .mibc files into the Build.Tasks nupkg and copies them into the build tasks output layout.
eng/optimizationData.targets Introduces restore-time download/copy of MIBC optimization data into $(ArtifactsDir)\mibc.
eng/Versions.props Adds the MIBC package version property.
eng/Version.Details.xml Adds dependency flow entry for the MIBC package.
Directory.Build.targets Imports the new optimization data restore logic repo-wide.
Directory.Build.props Defines MibcOptimizationDataDir under $(ArtifactsDir).

Comment thread Directory.Build.targets Resolved
Comment thread eng/optimizationData.targets Resolved
Comment thread eng/optimizationData.targets Resolved
Comment thread eng/Versions.props Resolved
Comment thread Directory.Build.targets Resolved
Comment thread Directory.Build.props Resolved
Comment thread eng/optimizationData.targets Resolved
@davidnguyen-tech

Copy link
Copy Markdown
Member Author

/ba-g Test failures are irrelevant - there are the same failures in a build of net11.0 https://dev.azure.com/dnceng-public/public/_build/results?buildId=1277799&view=results

@simonrozsival

Copy link
Copy Markdown
Member

/azp run maui-pr-uitests,maui-pr-devicetests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 2 pipeline(s).

@simonrozsival simonrozsival left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

CI failures appear unrelated

@rmarinho
rmarinho merged commit 5e0f4e1 into net11.0 Feb 6, 2026
188 of 211 checks passed
@rmarinho
rmarinho deleted the android-r2r branch February 6, 2026 11:29
jfversluis pushed a commit that referenced this pull request Mar 5, 2026
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

## Summary

Fixes the `UseMonoRuntime` check in the R2R configuration added by
#33234.

`dotnet/android` does not set `UseMonoRuntime` for Release builds — it
leaves the property empty/unset.

**Fix:** Change the condition from `== 'false'` to `!= 'true'` so it
correctly matches when `UseMonoRuntime` is empty (default in Release) or
explicitly set to `false`.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 29, 2026
@PureWeen PureWeen added this to the .NET 11.0-preview1 milestone Jun 10, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

copilot perf/app-size Application Size / Trimming (sub: perf) perf/startup-time Issues relating to startup time (sub: perf) platform/android

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Android][CoreCLR] Package PGO profiles in the .NET MAUI workload

6 participants