Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-enable trimming of library tests on Apple mobile #104097

Merged

Conversation

kotlarmilos
Copy link
Member

@kotlarmilos kotlarmilos commented Jun 27, 2024

Description

This PR re-enables the trimming of library tests on Apple mobile platforms. This change prevents the default settings of ILLink switches from targets that are imported. The regression was introduced in #103594.

Fixes #91923

@kotlarmilos
Copy link
Member Author

/azp run runtime-extra-platforms

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

eng/pipelines/runtime.yml Show resolved Hide resolved
@@ -12,6 +12,8 @@
<!-- Forced by ILLink targets -->
<SelfContained>true</SelfContained>
<PublishDir>$(OriginalPublishDir)</PublishDir>
<!-- Prevent getting DynamicCodeSupport=true default from ILLink targets that are imported with the Sdk.targets -->
<DynamicCodeSupport>false</DynamicCodeSupport>
Copy link
Member

Choose a reason for hiding this comment

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

Nice catch! These are difficult to detect when something goes wrong at runtime.

Copy link
Member

Choose a reason for hiding this comment

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

I was under the impression we'd only do AOT on helix, not actual trimming. @steveisok how does this work?

Copy link
Member

@akoeplinger akoeplinger Jun 28, 2024

Choose a reason for hiding this comment

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

The new default for the property should affect many more cases than just AOT on helix so this doesn't sounds like the correct place for this fix.

Copy link
Member

Choose a reason for hiding this comment

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

I was under the impression we'd only do AOT on helix, not actual trimming. @steveisok how does this work?

If you want trimming + AOT on helix, both have to occur in the same place. Otherwise, you have to send individual copies of the trimmed shared framework for each test from the build machine.

Copy link
Member

Choose a reason for hiding this comment

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

That might not be as painful as it seemed initially.

Copy link
Member Author

Choose a reason for hiding this comment

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

@akoeplinger Since we perform trimming on Helix, we can move this to the Directory.Build.props file. However, it will not have effect on other components.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've added a default switch to disable trimming on build machines as well. I haven't found a common location where these switches are set in Mono. Since we don't ship Apple mobile support from the runtime repository, the switch is set in the SDK/Xamarin.

A potential place to set this switch could be the AOT compiler props, but they are invoked after the trimming.

/cc: @sbomer

Copy link
Member

Choose a reason for hiding this comment

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

The ideal solution would be for the AOT compiler props in this repo to be imported before the trimming props, which is how this works in the SDK. But barring that the Directory.Build.props seems like a good place.

Copy link
Member Author

Choose a reason for hiding this comment

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

The ILLink feature switches are moved to ConfigureTrimming target.

@kotlarmilos
Copy link
Member Author

/azp run runtime-extra-platforms

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ivanpovazan
Copy link
Member

Do we get the same ability to detect a failure by comparing a PR build (with trimming) with rolling build (without trimming)? I would like to avoid reducing cost by introducing an additional cost :)

Hm yeah, I see your point.
The problem we are having now is:

  • someone makes a change
  • PR fails on iOS platforms due to a trimming issue
  • the failure looks unrelated to the change, Known Build Error is opened, and the PR is merged (or worse PR is merged on red)
  • the hard-to-detect failure stays, but is flagged by Build Analysis tool
  • we have hard time tracking back what the problem was

To tackle this, it would be great if we would have an ability to rerun the same state with trimming disabled, to rule out that as an issue. With something like /azp rerun ios-platforms-no-trimming we would control the extra cost, and run it only if the failure occurs.

This is just an idea, probably out-of-scope, just thinking of ways of how to improve the triaging experience.

@kotlarmilos
Copy link
Member Author

/azp run runtime-extra-platforms

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@kotlarmilos
Copy link
Member Author

/azp run runtime-extra-platforms

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@kotlarmilos
Copy link
Member Author

/azp run runtime-extra-platforms

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@kotlarmilos
Copy link
Member Author

/azp run runtime-extra-platforms

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@kotlarmilos
Copy link
Member Author

The failures shouldn't be related.

<PropertyGroup Condition="'$(TargetsAppleMobile)' == 'true' and '$(EnableAggressiveTrimming)' == 'true' and '$(UseNativeAotRuntime)' != 'true'">
<_DefaultValueAttributeSupport>true</_DefaultValueAttributeSupport>
<_DesignerHostSupport>true</_DesignerHostSupport>
</PropertyGroup>
Copy link
Member

Choose a reason for hiding this comment

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

nit: move this into tests.mobile.targets enabled by a new property, e.g. OverrideDefaultValueAndDesignerHostSupport, so you don't need to duplicate it across the three projects

@kotlarmilos
Copy link
Member Author

/azp run runtime-extra-platforms

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@kotlarmilos
Copy link
Member Author

/ba-g All failures are known.

@kotlarmilos kotlarmilos merged commit 15bfb23 into dotnet:main Nov 25, 2024
174 of 193 checks passed
mikelle-rogers pushed a commit to mikelle-rogers/runtime that referenced this pull request Dec 10, 2024
* Re-enable trimming of library tests on Apple mobile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[mono] Update tests to be trim-compatible on ios/tvos platforms
6 participants