feat: Add support for printing skipped AOT methods

This commit is contained in:
Jerome Laban 2023-10-06 12:33:52 -04:00
Родитель ab2d74ed33
Коммит 217f202e2a
5 изменённых файлов: 29 добавлений и 0 удалений

Просмотреть файл

@ -133,6 +133,20 @@ At this time, it is only possible to exclude assemblies from being compiled to W
```
Adding assemblies to this list will exclude them from being compiled to WebAssembly.
### Troubleshooting Mixed AOT/Interpreter Mode
When using the Mixed AOT/Interpreter mode, it is possible that some methods may not be compiled to
WebAssembly for a variety of reasons. This can cause performance issues, as the interpreter is slower
than the AOT generated code.
In order to determine which methods are still using the interpreter, you can use the following property:
```xml
<PropertyGroup>
<WasmShellPrintAOTSkippedMethods>true</WasmShellPrintAOTSkippedMethods>
</PropertyGroup>
```
The logs from the AOT compiler can be found in [binlogs generated](https://aka.platform.uno/msbuild-troubleshoot) from the build.
## Required configuration for AOT, Mixed Mode or external bitcode support compilation on Windows 10
### Native windows tooling

Просмотреть файл

@ -167,6 +167,8 @@ namespace Uno.Wasm.Bootstrap
public bool GenerateAOTProfileDebugList { get; set; } = false;
public bool PrintAOTSkippedMethods { get; set; } = false;
public Microsoft.Build.Framework.ITaskItem[]? CompressedExtensions { get; set; }
public Microsoft.Build.Framework.ITaskItem[]? ExtraEmccFlags { get; set; }
@ -800,6 +802,7 @@ namespace Uno.Wasm.Bootstrap
+ (EnableThreads ? "-threads" : "") + " "
+ (EnableSimd ? "-simd" : "") + " "
+ (EnableJiterpreter ? "-jiterpreter" : "") + " "
+ (PrintAOTSkippedMethods ? "-print-skipped-aot-methods" : "") + " "
+ (string.IsNullOrWhiteSpace(RuntimeOptions) ? "" : $"--runtime-options \"{RuntimeOptions}\" ");
var pthreadPoolSizeParam = $"--pthread-pool-size={PThreadsPoolSize}";

Просмотреть файл

@ -25,6 +25,7 @@
<WasmShellEmccLinkOptimization Condition="'$(WasmShellEmccLinkOptimization)'=='' and '$(Configuration)'=='Release'">true</WasmShellEmccLinkOptimization>
<WasmShellEnableThreads Condition="'$(WasmShellEnableThreads)'==''">false</WasmShellEnableThreads>
<WasmShellEnableSimd Condition="'$(WasmShellEnableSimd)'==''">true</WasmShellEnableSimd>
<WasmShellPrintAOTSkippedMethods Condition="'$(WasmShellPrintAOTSkippedMethods)'==''">false</WasmShellPrintAOTSkippedMethods>
<!--
Force all applicable references to be present in the ReferenceCopyLocalPaths property.

Просмотреть файл

@ -444,6 +444,7 @@ class Driver {
public bool EnableThreads;
public bool EnableJiterpreter;
public bool Simd;
public bool PrintSkippedAOTMethods;
public bool EnableDynamicRuntime;
public bool LinkerExcludeDeserialization;
public bool EnableCollation;
@ -483,6 +484,7 @@ class Driver {
bool is_netcore = false;
bool is_windows = Environment.OSVersion.Platform == PlatformID.Win32NT;
bool enable_simd = false;
bool print_skipped_aot_methods = false;
var il_strip = false;
var linker_verbose = false;
var runtimeTemplate = "runtime.js";
@ -589,6 +591,7 @@ class Driver {
AddFlag (p, new BoolFlag ("enable-fs", "enable filesystem support (through Emscripten's file_packager.py in a later phase)", opts.EnableFS, b => opts.EnableFS = b));
AddFlag (p, new BoolFlag ("threads", "enable threads", opts.EnableThreads, b => opts.EnableThreads = b));
AddFlag (p, new BoolFlag ("jiterpreter", "enable jiterpreter", opts.EnableJiterpreter, b => opts.EnableJiterpreter = b));
AddFlag (p, new BoolFlag ("print-skipped-aot-methods", "enable jiterpreter", opts.PrintSkippedAOTMethods, b => opts.PrintSkippedAOTMethods = b));
AddFlag (p, new BoolFlag ("dedup", "enable dedup pass", opts.EnableDedup, b => opts.EnableDedup = b));
AddFlag (p, new BoolFlag ("dynamic-runtime", "enable dynamic runtime (support for Emscripten's dlopen)", opts.EnableDynamicRuntime, b => opts.EnableDynamicRuntime = b));
AddFlag (p, new BoolFlag ("simd", "enable SIMD support", opts.Simd, b => opts.Simd = b));
@ -638,6 +641,7 @@ class Driver {
enable_threads = opts.EnableThreads;
enable_dynamic_runtime = opts.EnableDynamicRuntime;
enable_simd = opts.Simd;
print_skipped_aot_methods = opts.PrintSkippedAOTMethods;
invariant_globalization = opts.InvariantGlobalization;
// Dedup is disabled by default https://github.com/dotnet/runtime/issues/48814
@ -1370,6 +1374,12 @@ class Driver {
emcc_flags += "-msimd128 ";
emcc_flags += "-DCONFIGURATION_COMPILE_OPTIONS=\"-msimd128\" -DCONFIGURATION_INTERPSIMDTABLES_LIB=\"simd\" ";
}
if (print_skipped_aot_methods)
{
aot_args += "print-skipped,";
}
if (is_netcore) {
emcc_flags += $"-DGEN_PINVOKE -I{src_prefix} ";

Просмотреть файл

@ -11,6 +11,7 @@
<WasmPWAManifestFile>manifest.json</WasmPWAManifestFile>
<!--<WasmShellEnableEmccProfiling>true</WasmShellEnableEmccProfiling>-->
<!--<WasmShellGenerateAOTProfile>true</WasmShellGenerateAOTProfile>-->
<WasmShellPrintAOTSkippedMethods>true</WasmShellPrintAOTSkippedMethods>
</PropertyGroup>
<Import Project="..\Uno.Wasm.Sample.RayTracer.Shared\Uno.Wasm.Sample.RayTracer.Shared.projitems" Label="Shared" />