-
Notifications
You must be signed in to change notification settings - Fork 515
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
Enable dedup optimization in FullAOT mode only #20687
Conversation
var dllPath = Path.Combine (appPath, "aot-instances.dll"); | ||
Assert.That (dllPath, Does.Not.Exist, "Dedup optimization shouldn't been enabled for partial AOT compilation"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will always pass on macOS and Mac Catalyst, because assemblies are in a subdirectory of the app bundle (Contents/MonoBundle/*.dll).
I think I would just list all the files in the app bundle, and assert that none of them are named 'aot-instances.dll'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. I wasn't sure if there was the existing function for .dll
search, so I added a new one.
var dllPath = Path.Combine (appPath, "aot-instances.dll"); | ||
Assert.That (dllPath, Does.Not.Exist, "Dedup optimization shouldn't been enabled for partial AOT compilation"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
var appExecutable = GetNativeExecutable (platform, appPath); | ||
ExecuteWithMagicWordAndAssert (platform, runtimeIdentifiers, appExecutable); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to check if we can execute first, like this:
xamarin-macios/tests/dotnet/UnitTests/ProjectTest.cs
Lines 1601 to 1604 in 5566f49
if (CanExecute (platform, runtimeIdentifiers)) { | |
var output = ExecuteWithMagicWordAndAssert (appExecutable); | |
Assert.That (output, Does.Contain ("42"), "Execution"); | |
} |
Otherwise ExecuteWithMagicWordAndAssert
will try to run iOS and tvOS executables on macOS.
|
} | ||
catch (Exception ex) | ||
{ | ||
Console.WriteLine($"An error occurred: {ex.Message}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason to ignore any exceptions? Wouldn't it be better to just let exceptions flow, which would eventually fail the test? This seems like it could end up hiding problems at some point.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I only left two minor comments.
[Test] | ||
[TestCase (ApplePlatform.iOS, "ios-arm64;")] | ||
[TestCase (ApplePlatform.MacOSX, "osx-arm64;osx-x64")] | ||
[TestCase (ApplePlatform.MacCatalyst, "maccatalyst-x64;")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we test maccatalyst-arm64
as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added. I didn't add simulators since we already test this on physical devices.
var project_path = GetProjectPath (project, runtimeIdentifiers: runtimeIdentifiers, platform: platform, out var appPath); | ||
Clean (project_path); | ||
var properties = GetDefaultProperties (runtimeIdentifiers); | ||
properties ["MtouchInterpreter"] = "-all,System.Private.CoreLib.dll"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Just a thought. As far as I can see the added two test methods only differ by this setting, maybe it could have been an additional parameter to a single test method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, thanks.
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…arin/xamarin-macios into bugfix/dedup-partial-aot-compilation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
📚 [PR Build] Artifacts 📚Packages generatedView packagesPipeline on Agent |
✅ API diff for current PR / commitLegacy Xamarin (No breaking changes)
NET (empty diffs)
✅ API diff vs stableLegacy Xamarin (No breaking changes).NET (No breaking changes)ℹ️ Generator diffGenerator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes) Pipeline on Agent |
/sudo backport release/8.0.1xx-xcode15.1 |
Backport Job to branch release/8.0.1xx-xcode15.1 Created! The magic is happening here |
Oh no! Backport failed! Please see https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=9694077 for more details. |
… only (#20701) ## Description This PR enables the dedup optimization in FullAOT mode only. The optimization can only run in FullAOT mode with complete application context. Without it, the AOT compiler may fail to collect all generic instances, and the runtime can't find them as they are searched in the dedup assembly. ## Changes This PR updates the SDK targets to enable dedup optimization in FullAOT mode only. This change doesn't depend on any runtime changes. ## Verification This PR also introduces partial AOT tests. They inspect the bundle for `aot-instances.dll`, which shouldn't be generated in a partial AOT compilation setup. Additionally, basic functionality is tested by asserting at app startup. ## Additional notes This change should be backported to .NET 8 as well. Fixes dotnet/runtime#99248 Backport of #20687 --------- Co-authored-by: Milos Kotlar <kotlarmilos@gmail.com>
Description
This PR enables the dedup optimization in FullAOT mode only. The optimization can only run in FullAOT mode with complete application context. Without it, the AOT compiler may fail to collect all generic instances, and the runtime can't find them as they are searched in the dedup assembly.
Changes
This PR updates the SDK targets to enable dedup optimization in FullAOT mode only. This change doesn't depend on any runtime changes.
Verification
This PR also introduces partial AOT tests. They inspect the bundle for
aot-instances.dll
, which shouldn't be generated in a partial AOT compilation setup. Additionally, basic functionality is tested by asserting at app startup.Additional notes
This change should be backported to .NET 8 as well.
Fixes dotnet/runtime#99248