dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.03k stars 4.68k forks source link

NativeAOT: write dgml regardless the failure of compilation #66813

Closed hez2010 closed 2 years ago

hez2010 commented 2 years ago

ilc may fail during marking or compilation, in this case no dgml would be written out so we cannot diagnostic the issue with the dependency graph (though it's incomplete).

https://github.com/dotnet/runtime/blob/5371203d5820a21922357e954e8c43eb4b76fd1d/src/coreclr/tools/aot/ILCompiler/Program.cs#L817

I think instead of throwing the exception directly in the compilation process, we should just write the dgml even if the dependency graph is incomplete, if appliable.

MichalStrehovsky commented 2 years ago

The DependencyGraphViewer tool tends to work better for the cases where the graph is incomplete. Thanks to it being out-of-process, it can better handle all sorts of fatal situations like running out of memory. It might be interesting to add DGML export to the viewer tool.

hez2010 commented 2 years ago

The DependencyGraphViewer tool

I tried it but nothing showed up in the list after launching an ilc process. Am I missing something?

MichalStrehovsky commented 2 years ago

I tried it but nothing showed up in the list after launching an ilc process. Am I missing something?

Did you have the DGML logging option specified by any chance? EventSource logging (consumed by the DependencyGraphViewer) doesn't happen if DGML is requested.

hez2010 commented 2 years ago

EventSource logging (consumed by the DependencyGraphViewer) doesn't happen if DGML is requested.

Seems to be the case. Thank you.

hez2010 commented 2 years ago

Closing since we can already use DGViewer for the purpose.