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

AOT Compilation Canary #7458

Draft
wants to merge 9 commits into
base: v1.6
Choose a base branch
from

Conversation

Aaronontheweb
Copy link
Member

@Aaronontheweb Aaronontheweb commented Jan 10, 2025

Changes

AOT Canary for the Core Akka module - we'll have to gradually expand our AOT support as we're able to, but everything starts with this.

Checklist

For significant changes, please ensure that the following have been completed (delete if not relevant):

@Aaronontheweb Aaronontheweb added the AOT Ahead-of-Time (AOT) Compilation label Jan 10, 2025
@Aaronontheweb Aaronontheweb added this to the 1.6.0 milestone Jan 10, 2025
@Aaronontheweb
Copy link
Member Author

Derivative of what we've done on TurboMqtt: petabridge/TurboMqtt#231

Copy link
Member Author

@Aaronontheweb Aaronontheweb left a comment

Choose a reason for hiding this comment

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

Detailed my changes and how the canary works

inputs:
targetType: 'inline'
script: |
./tools/test-aot-compatibility.ps1 net8.0
Copy link
Member Author

@Aaronontheweb Aaronontheweb Jan 11, 2025

Choose a reason for hiding this comment

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

This uses a PowerShell script to tabulate the total number of AOT trim warnings and throw an exception if they're above 0 - taken from one of Microsoft's blogs on AOT support for library authors

@@ -152,3 +152,15 @@ jobs:
scriptArgs: CreateNuget nugetprerelease=dev incremental
outputDirectory: "bin/nuget"
artifactName: "nuget_pack-$(Build.BuildId)"

- template: azure.aot.template.yaml
Copy link
Member Author

Choose a reason for hiding this comment

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

We do AOT on both Windows and Linux just in-case there are platform-specific issues. Should never happen, but you never know.

{
public AotReceiveActor()
{
ReceiveAny(o => Sender.Tell(o));
Copy link
Member Author

Choose a reason for hiding this comment

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

We know ReceiveActors use the ExpressionCompiler in v1.5 and earlier, which should trip AOT warnings. I might need to add a stricter Receive<string> with a predicate prior to this one just to make sure that code gets exercised properly in the test,


namespace Akka.AOT.App.Actors;

public class AotUntypedActor : UntypedActor
Copy link
Member Author

Choose a reason for hiding this comment

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

UntypedActor is already AOT-friendly, but we should still see that show up.

Copy link
Member Author

Choose a reason for hiding this comment

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

We probably need to add more cases to the canary over time, such as:

  1. IStash support
  2. IWithTimers support
  3. Custom dispatchers
  4. Custom mailboxes
  5. Routers

Just to gradually add full trim coverage to everything in the default Akka library, minus default serialization (which we know will not work)

<IsPackable>false</IsPackable>
</PropertyGroup>

<PropertyGroup Label="AotSettings">
Copy link
Member Author

Choose a reason for hiding this comment

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

These are all the MSBUILD settings needed to get the compiler to produce the AOT warnings we're looking for

{
static async Task Main(string[] args)
{
var system = ActorSystem.Create("MySystem");
Copy link
Member Author

Choose a reason for hiding this comment

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

Does some end to end messaging and uses the default configuration loading, which currently triggers a number of AOT warnings due to how we load Types from HOCON strings - those are all issues on the #7246 epic we will have to gradually fix before this spec can pass.

@Aaronontheweb
Copy link
Member Author

Not going to be able to merge this until we make significant progress on #7246

@Aaronontheweb
Copy link
Member Author

We could, in theory, merge this and just remove it from the CI/CD pipeline so we can get incremental validation locally while we're implementing the AOT epic - would that be a good idea? cc @akkadotnet/core

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AOT Ahead-of-Time (AOT) Compilation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant