Skip to content

NativeAOT: Asking for Array<T> MethodTable #88287

Closed

Description

@filipnavara

Repro: https://1drv.ms/u/s!AgaMhbe7wFq8m8MQC0XPpTlHpadgrg?e=uS9Aqw

I was trying to debug why compilation of the repro above takes 10+ hours (never managed to actually run to the end). When running with debug version of ILCompiler I hit the following assertion early on:

Asking for Array<T> MethodTable
   at ILCompiler.DependencyAnalysis.EETypeNode.OnMarked(NodeFactory context) in C:\Users\filip_pq4cffv\Documents\runtime\src\coreclr\tools\aot\ILCompiler.Compiler\Compiler\DependencyAnalysis\EETypeNode.cs:line 1331
   at ILCompiler.DependencyAnalysisFramework.DependencyNodeCore`1.CallOnMarked(DependencyContextType context) in C:\Users\filip_pq4cffv\Documents\runtime\src\coreclr\tools\aot\ILCompiler.DependencyAnalysisFramework\DependencyNodeCore.cs:line 134
   at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.AddToMarkStack(DependencyNodeCore`1 node, String reason, DependencyNodeCore`1 reason1, DependencyNodeCore`1 reason2) in C:\Users\filip_pq4cffv\Documents\runtime\src\coreclr\tools\aot\ILCompiler.DependencyAnalysisFramework\DependencyAnalyzer.cs:line 363
   at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.GetStaticDependenciesImpl(DependencyNodeCore`1 node) in C:\Users\filip_pq4cffv\Documents\runtime\src\coreclr\tools\aot\ILCompiler.DependencyAnalysisFramework\DependencyAnalyzer.cs:line 187
   at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.GetStaticDependencies(DependencyNodeCore`1 node) in C:\Users\filip_pq4cffv\Documents\runtime\src\coreclr\tools\aot\ILCompiler.DependencyAnalysisFramework\DependencyAnalyzer.cs:line 222
   at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ProcessMarkStack() in C:\Users\filip_pq4cffv\Documents\runtime\src\coreclr\tools\aot\ILCompiler.DependencyAnalysisFramework\DependencyAnalyzer.cs:line 257
   at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ComputeMarkedNodes() in C:\Users\filip_pq4cffv\Documents\runtime\src\coreclr\tools\aot\ILCompiler.DependencyAnalysisFramework\DependencyAnalyzer.cs:line 308
   at ILCompiler.RyuJitCompilation.CompileInternal(String outputFile, ObjectDumper dumper) in C:\Users\filip_pq4cffv\Documents\runtime\src\coreclr\tools\aot\ILCompiler.RyuJit\Compiler\RyuJitCompilation.cs:line 88
   at ILCompiler.Compilation.ILCompiler.ICompilation.Compile(String outputFile, ObjectDumper dumper) in C:\Users\filip_pq4cffv\Documents\runtime\src\coreclr\tools\aot\ILCompiler.Compiler\Compiler\Compilation.cs:line 523
   at ILCompiler.Program.Run() in C:\Users\filip_pq4cffv\Documents\runtime\src\coreclr\tools\aot\ILCompiler\Program.cs:line 545
   at ILCompiler.ILCompilerRootCommand.<>c__DisplayClass215_0.<.ctor>b__0(InvocationContext context) in C:\Users\filip_pq4cffv\Documents\runtime\src\coreclr\tools\aot\ILCompiler\ILCompilerRootCommand.cs:line 286
   at System.CommandLine.Invocation.AnonymousCommandHandler.Invoke(InvocationContext context)
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<BuildInvocationChain>b__0(InvocationContext invocationContext, Func`2 _)
   at System.CommandLine.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<<UseParseErrorReporting>b__0>d.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at System.CommandLine.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<UseParseErrorReporting>b__0(InvocationContext context, Func`2 next)
   at System.CommandLine.CommandLineBuilderExtensions.<>c__DisplayClass11_0.<<UseHelp>b__0>d.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at System.CommandLine.CommandLineBuilderExtensions.<>c__DisplayClass11_0.<UseHelp>b__0(InvocationContext context, Func`2 next)
   at System.CommandLine.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseVersionOption>b__0>d.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at System.CommandLine.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<UseVersionOption>b__0(InvocationContext context, Func`2 next)
   at System.CommandLine.Invocation.InvocationPipeline.<Invoke>g__FullInvocationChain|3_0(InvocationContext context)
   at System.CommandLine.Invocation.InvocationPipeline.Invoke(IConsole console)
   at ILCompiler.Program.Main(String[] args) in C:\Users\filip_pq4cffv\Documents\runtime\src\coreclr\tools\aot\ILCompiler\Program.cs:line 709

Note: The assemblies were preprocessed with Xamarin ILLink steps with the following PRs applied - dotnet/macios#18524, dotnet/macios#18519, and dotnet/macios#18421

Activity

  1. ghost added
    untriaged
    on Jul 1, 2023
  2. filipnavara commented on Jul 1, 2023

    @filipnavara
    MemberAuthor

    Apparently basically all the assemblies end up as --root on the ILC command line. I'm going back in the MSBuild chain to figure out how that happened.

  3. filipnavara commented on Jul 1, 2023

    @filipnavara
    MemberAuthor

    Looks like this may affect any publish with -c Debug for Xamarin+NativeAOT. In that configuration it uses copy trim mode by default and it ends up having some unintended side effects. It's fine if that's unsupported but it should be caught early instead of running for hours with no error.

    cc @ivanpovazan

  4. filipnavara commented on Jul 1, 2023

    @filipnavara
    MemberAuthor

    Interestingly, it also fails in release mode but at least it produces some warning:

    /Users/filipnavara/Projects/xamarin-macios/builds/downloads/dotnet-sdk-8.0.100-preview.7.23328.2/packs/Microsoft.macOS.Sdk/13.3.8657-ci.macos-nativeaot-wip/targets/Xamarin.Shared.Sdk.targets(501,3): warning : All assemblies must be processed by the linker when using NativeAOT. Please don't set neither the 'LinkMode' nor the 'TrimMode' property, so that the build can default to linking all assemblies. [/Users/filipnavara/Projects/emclient/MailClient/MailClient.csproj::TargetFramework=net8.0-macos]

    There may be something wrong in the project file (although it doesn't obviously set TrimMode or LinkMode in the .csproj files). I'll close the issue until I can provide some meaningful details.

  5. ghost removed
    untriaged
    on Jul 1, 2023
  6. filipnavara commented on Jul 1, 2023

    @filipnavara
    MemberAuthor

    This seems to be caused by inverted condition: dotnet/macios#18530

  7. ghost locked as resolved and limited conversation to collaborators on Jul 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions