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

Improve support for NativeAOT #1960

Merged
merged 9 commits into from
Mar 22, 2022
Merged

Improve support for NativeAOT #1960

merged 9 commits into from
Mar 22, 2022

Conversation

adamsitnik
Copy link
Member

With the following 3 recent fixes:

It required very little work to improve the NativeAOT support. Main changes:

  • CoreRT and NativeAOT are treated as two different runtimes, mostly to be able to run .NET 6 with CoreRT vs .NET 7 with NativeAOT
  • --runtimes no longer supports corert70. The proper name is nativeaot70 (case and dots are ignored, so you can use NativeAOT7.0 as well)
  • the default feed for the CoreRtToolchainBuilder has been upgraded to .NET 7 feed
  • the default ILCompiler for the CoreRtToolchainBuilder has been upgraded to 7.0.0-*
  • I've renamed --coreRtVersion to --ilCompilerVersion as it specifies the ILCompiler version. Sample command:
dotnet run -c Release -f net5.0 --filter *Basic* --runtimes nativeaot70 --ilcompilerversion 7.0.0-preview.3.22123.2

Demo:

dotnet run -c Release -f net5.0 --filter *Basic* --runtimes net50 corert60 nativeaot70

image

In the meantime I am working on getting all dotnet/performance microbenchmarks running with NativeAOT

cc @jkotas @MichalStrehovsky @hez2010 @Beau-Gosse-dev

@adamsitnik adamsitnik added this to the v0.13.2 milestone Mar 22, 2022
@adamsitnik adamsitnik merged commit d66289a into master Mar 22, 2022
@adamsitnik adamsitnik deleted the net7AOT branch March 22, 2022 17:15
@@ -11,6 +12,6 @@ public class GenericTypeArgumentsAttribute : Attribute
// CLS-Compliant Code requires a constructor without an array in the argument list
[PublicAPI] public GenericTypeArgumentsAttribute() => GenericTypeArguments = new Type[0];

public GenericTypeArgumentsAttribute(params Type[] genericTypeArguments) => GenericTypeArguments = genericTypeArguments;
public GenericTypeArgumentsAttribute([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] params Type[] genericTypeArguments) => GenericTypeArguments = genericTypeArguments;
Copy link
Member

Choose a reason for hiding this comment

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

Unfortunately placing the DAMAttribute on an array is a no-op. Arrays are difficult to model in a static analysis.

This should be generating a warning along the lines of Trim analysis warning IL2098: GenericTypeArgumentsAttribute..ctor(Type[]): Parameter '#1' of method 'GenericTypeArgumentsAttribute..ctor(Type[])' has 'DynamicallyAccessedMembersAttribute', but that attribute can only be applied to parameters of type 'System.Type' or 'System.String'.

Copy link
Member

Choose a reason for hiding this comment

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

this actually broke building dotnet/performance with dotnet/runtime. When building a wasm project, I get - https://gist.github.com/radical/b75b5e4063d97be0adac729b611990ea . Can we revert this change? @adamsitnik

Copy link
Member

Choose a reason for hiding this comment

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

If I remove that attribute from the param, then it works fine.

Copy link
Member

Choose a reason for hiding this comment

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

To be clear, this breaks when I update bdn reference in dotnet/performance to 0.13.1.1740.

Copy link
Member

Choose a reason for hiding this comment

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

The attribute is a no-op - it should be removed because even in the absence of the illink bug, it generates a warning. NativeAOT doesn't have the linker bug and that's why it works there. I filed https://github.com/dotnet/linker/issues/2714 on the linker bug - that one should also be fixed independently of this removal.

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 sent #1973 to address that. @radical is there any chance you could test it to see if it actually helps?

Copy link
Member

Choose a reason for hiding this comment

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

I can build with that change 👍

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.

3 participants