Skip to content

Enable dedup optimization in FullAOT mode only - #20381

Closed
kotlarmilos wants to merge 2 commits into
net9.0from
bugfix/dedup-condition
Closed

Enable dedup optimization in FullAOT mode only#20381
kotlarmilos wants to merge 2 commits into
net9.0from
bugfix/dedup-condition

Conversation

@kotlarmilos

Copy link
Copy Markdown
Member

Description

This PR enables dedup optimization in FullAOT mode only. If interpreter is used, the optimization can't collect all generics and emit them in a separate assembly, which could cause a program failure. This PR should be backported to net8.0 branch.

Contributes to dotnet/runtime#99248

@kotlarmilos kotlarmilos added the bug If an issue is a bug or a pull request a bug fix label Mar 26, 2024
@kotlarmilos kotlarmilos added this to the .NET 9 milestone Mar 26, 2024
@kotlarmilos
kotlarmilos requested a review from rolfbjarne March 26, 2024 21:18
@kotlarmilos kotlarmilos self-assigned this Mar 26, 2024
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@kotlarmilos kotlarmilos assigned dalexsoto and unassigned dalexsoto Mar 28, 2024
@kotlarmilos
kotlarmilos requested a review from dalexsoto March 28, 2024 11:03
@vs-mobiletools-engineering-service2

This comment has been minimized.

@kotlarmilos
kotlarmilos requested a review from ivanpovazan April 3, 2024 08:35

@ivanpovazan ivanpovazan 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.

How do we test this fix?
Can we add a test which would verify E2E scenario?

Comment thread dotnet/targets/Xamarin.Shared.Sdk.targets Outdated
Co-authored-by: Ivan Povazan <55002338+ivanpovazan@users.noreply.github.com>
@kotlarmilos

Copy link
Copy Markdown
Member Author

How do we test this fix?
Can we add a test which would verify E2E scenario?

I am not aware of any partial AOT test cases. I suggest to introduce a new test based on the customer issue.

@ivanpovazan

Copy link
Copy Markdown
Member

I suggest to introduce a new test based on the customer issue.

That sounds like a good idea.
Do we depend on some runtime fix as well, which we would need to wait to flow in before testing it?

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

📚 [PR Build] Artifacts 📚

Packages generated

View packages

Pipeline on Agent
Hash: [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

💻 [PR Build] Tests on macOS X64 - Mac Sonoma (14) passed 💻

All tests on macOS X64 - Mac Sonoma (14) passed.

Pipeline on Agent
Hash: [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

💻 [PR Build] Tests on macOS M1 - Mac Monterey (12) passed 💻

All tests on macOS M1 - Mac Monterey (12) passed.

Pipeline on Agent
Hash: [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

💻 [PR Build] Tests on macOS M1 - Mac Ventura (13) passed 💻

All tests on macOS M1 - Mac Ventura (13) passed.

Pipeline on Agent
Hash: [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

💻 [CI Build] Windows Integration Tests passed 💻

All Windows Integration Tests passed.

Pipeline on Agent
Hash: 6acb3add1b4c6c248d69ce347e2fe613af3a3304 [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ API diff for current PR / commit

Legacy Xamarin (No breaking changes)
  • iOS (no change detected)
  • tvOS (no change detected)
  • watchOS (no change detected)
  • macOS (no change detected)
NET (empty diffs)
  • iOS: (empty diff detected)
  • tvOS: (empty diff detected)
  • MacCatalyst: (empty diff detected)
  • macOS: (empty diff detected)

✅ API diff vs stable

Legacy Xamarin (No breaking changes)
.NET (No breaking changes)
Legacy Xamarin (stable) vs .NET

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: 6acb3add1b4c6c248d69ce347e2fe613af3a3304 [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

🔥 [CI Build] Test results 🔥

Test results

❌ Tests failed on VSTS: test results

0 tests crashed, 2 tests failed, 170 tests passed.

Failures

❌ monotouch tests (MacCatalyst)

1 tests failed, 7 tests passed.
Details
  • monotouch-test/Mac Catalyst [dotnet]/Release (static registrar, all optimizations) [dotnet]: Failed (Test run failed.
    Tests run: 2966 Passed: 2828 Inconclusive: 10 Failed: 10 Ignored: 128)

Html Report (VSDrops) Download

❌ xammac tests

1 tests failed, 2 tests passed.
Details
  • xammac tests/Mac Modern/Release: Failed (Test run failed.
    Tests run: 2923 Passed: 2766 Inconclusive: 9 Failed: 1 Ignored: 156)

Html Report (VSDrops) Download

Successes

✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
✅ framework: All 8 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 7 tests passed. Html Report (VSDrops) Download
✅ generator: All 2 tests passed. Html Report (VSDrops) Download
✅ install-source: All 1 tests passed. Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 7 tests passed. Html Report (VSDrops) Download
✅ introspection: All 8 tests passed. Html Report (VSDrops) Download
✅ linker: All 65 tests passed. Html Report (VSDrops) Download
✅ mac-binding-project: All 1 tests passed. Html Report (VSDrops) Download
✅ mmp: All 2 tests passed. Html Report (VSDrops) Download
✅ mononative: All 6 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 11 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 9 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 11 tests passed. Html Report (VSDrops) Download
✅ monotouch (watchOS): All 4 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ mtouch: All 1 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 8 tests passed. Html Report (VSDrops) Download
✅ xtro: All 2 tests passed. Html Report (VSDrops) Download

Pipeline on Agent
Hash: 6acb3add1b4c6c248d69ce347e2fe613af3a3304 [PR build]

@kotlarmilos

Copy link
Copy Markdown
Member Author

Do we depend on some runtime fix as well, which we would need to wait to flow in before testing it?

The fix dotnet/runtime#100025 has been merged and we should be able to add a functional test.

@ivanpovazan

Copy link
Copy Markdown
Member

Do we depend on some runtime fix as well, which we would need to wait to flow in before testing it?

The fix dotnet/runtime#100025 has been merged and we should be able to add a functional test.

I see, thanks. The current tip of net9.0 branch is built against dotnet/runtime@5e603d5 so if we choose to add a test for this will have to wait for the fix to flow in.

@rolfbjarne

Copy link
Copy Markdown
Member

Do we depend on some runtime fix as well, which we would need to wait to flow in before testing it?

The fix dotnet/runtime#100025 has been merged and we should be able to add a functional test.

I see, thanks. The current tip of net9.0 branch is built against dotnet/runtime@5e603d5 so if we choose to add a test for this will have to wait for the fix to flow in.

Since this requires a dotnet/runtime fix, would it mean there's no point in backporting to .NET 8? Or will the dotnet/runtime fix be backported too?

FWIW, if the fix is to be backported, then it should go into main (which is periodically merged into net9.0).

@kotlarmilos

Copy link
Copy Markdown
Member Author

Actually, this PR doesn't rely on the fix. The initial problem involved deduplication during partial AOT compilation, where the runtime would search for wrappers and gsharedvts in the dedup assembly, but without collecting them during AOT compilation. The issue with the interpreter was identified after the dedup was disabled, but the reason was the same -- a wrapper wasn't found.

To resolve this issue, we need to enable deduplication only in fullAOT mode.

@rolfbjarne

Copy link
Copy Markdown
Member

Actually, this PR doesn't rely on the fix. The initial problem involved deduplication during partial AOT compilation, where the runtime would search for wrappers and gsharedvts in the dedup assembly, but without collecting them during AOT compilation. The issue with the interpreter was identified after the dedup was disabled, but the reason was the same -- a wrapper wasn't found.

To resolve this issue, we need to enable deduplication only in fullAOT mode.

If you could put this change in main then that would be great :)

@kotlarmilos

Copy link
Copy Markdown
Member Author

Thanks, I will open a new PR with a corresponding functional test.

@kotlarmilos kotlarmilos closed this Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug If an issue is a bug or a pull request a bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants