Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[mono][aot] aot compiler crash #115203

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

Closed
lewing opened this issue Apr 30, 2025 · 9 comments · Fixed by #115204
Closed

[mono][aot] aot compiler crash #115203

lewing opened this issue Apr 30, 2025 · 9 comments · Fixed by #115204
Labels
arch-wasm WebAssembly architecture area-Codegen-AOT-mono os-browser Browser variant of arch-wasm
Milestone

Comments

@lewing
Copy link
Member

lewing commented Apr 30, 2025

.\dotnet.cmd build /t:Test /p:TargetOS=browser /p:Configuration=Release /p:EnableAggressiveTrimming=true /p:RunAOTCompilation=true .\src\libraries\System.Runtime.Intrinsics\tests\

Build FAILED.

D:\dotnet\runtime\src\mono\wasm\build\WasmApp.Common.targets(706,5): error : Precompiling failed for D:\dotnet\runtime\
artifacts\obj\System.Runtime.Intrinsics.Tests\Release\net10.0-browser\browser-wasm\wasm\for-publish\aot-in\System.Priva
te.CoreLib.dll with exit code -1073741819. [D:\dotnet\runtime\src\libraries\System.Runtime.Intrinsics\tests\System.Runt
ime.Intrinsics.Tests.csproj::TargetFramework=net10.0-browser]
D:\dotnet\runtime\src\mono\wasm\build\WasmApp.Common.targets(706,5): error :  [D:\dotnet\runtime\src\libraries\System.R
untime.Intrinsics\tests\System.Runtime.Intrinsics.Tests.csproj::TargetFramework=net10.0-browser]
D:\dotnet\runtime\src\mono\wasm\build\WasmApp.Common.targets(706,5): error : Precompiling failed for D:\dotnet\runtime\
artifacts\obj\System.Runtime.Intrinsics.Tests\Release\net10.0-browser\browser-wasm\wasm\for-publish\aot-in\aot-instance
s.dll with exit code -1073741819. [D:\dotnet\runtime\src\libraries\System.Runtime.Intrinsics\tests\System.Runtime.Intri
nsics.Tests.csproj::TargetFramework=net10.0-browser]
D:\dotnet\runtime\src\mono\wasm\build\WasmApp.Common.targets(706,5): error :  [D:\dotnet\runtime\src\libraries\System.R
untime.Intrinsics\tests\System.Runtime.Intrinsics.Tests.csproj::TargetFramework=net10.0-browser]
    0 Warning(s)
    2 Error(s)
@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Apr 30, 2025
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Apr 30, 2025
@lewing lewing added arch-wasm WebAssembly architecture area-Codegen-AOT-mono wasm-aot-test WebAssembly AOT Test os-browser Browser variant of arch-wasm and removed untriaged New issue has not been triaged by the area owner needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Apr 30, 2025
Copy link
Contributor

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

@lewing
Copy link
Member Author

lewing commented Apr 30, 2025

unsurprisingly it looks like the smoke tests are not sufficient to catch regressions everywhere :(

@lewing lewing added this to the 10.0.0 milestone Apr 30, 2025
@lewing lewing removed the wasm-aot-test WebAssembly AOT Test label Apr 30, 2025
@lewing
Copy link
Member Author

lewing commented Apr 30, 2025

It passes in the interpreter and with EAT but no AOT

@lewing
Copy link
Member Author

lewing commented Apr 30, 2025

#115204 to enable tests in the smoke builds

@lewing
Copy link
Member Author

lewing commented Apr 30, 2025

MSBuild version 17.14.0-preview-25177-05+903614e16 for .NET
  ** Building a proxy for the original test project, to AOT on helix. In order to do that, this recreates the original inputs for the *wasm* part of the build. See /root/helix/work/workitem/e/publish/ProxyProjectForAOTOnHelix.proj, and /root/helix/work/workitem/e/publish/ProxyProjectForAOTOnHelix.props. **
CSC : warning CS8021: No value for RuntimeMetadataVersion found. No assembly containing System.Object was found nor was a value for RuntimeMetadataVersion specified through options. [/root/helix/work/workitem/e/publish/ProxyProjectForAOTOnHelix.proj]
  AOT'ing 47 assemblies
  [1/47] Microsoft.DotNet.XHarness.TestRunners.Common.dll -> Microsoft.DotNet.XHarness.TestRunners.Common.dll.bc
  [2/47] Microsoft.DotNet.XHarness.TestRunners.Xunit.dll -> Microsoft.DotNet.XHarness.TestRunners.Xunit.dll.bc
  [3/47] Microsoft.Win32.Registry.dll -> Microsoft.Win32.Registry.dll.bc
  [4/47] Microsoft.DotNet.XUnitExtensions.dll -> Microsoft.DotNet.XUnitExtensions.dll.bc
  [5/47] Mono.Options.dll -> Mono.Options.dll.bc
  [6/47] System.Collections.dll -> System.Collections.dll.bc
  [7/47] System.Collections.Concurrent.dll -> System.Collections.Concurrent.dll.bc
  [8/47] System.Collections.NonGeneric.dll -> System.Collections.NonGeneric.dll.bc
  [9/47] System.ComponentModel.dll -> System.ComponentModel.dll.bc
  [10/47] System.ComponentModel.Primitives.dll -> System.ComponentModel.Primitives.dll.bc
  [11/47] System.Collections.Specialized.dll -> System.Collections.Specialized.dll.bc
  [12/47] System.Console.dll -> System.Console.dll.bc
  [13/47] System.ComponentModel.TypeConverter.dll -> System.ComponentModel.TypeConverter.dll.bc
  [14/47] System.Diagnostics.Process.dll -> System.Diagnostics.Process.dll.bc
  [15/47] System.Diagnostics.TraceSource.dll -> System.Diagnostics.TraceSource.dll.bc
  [16/47] System.dll -> System.dll.bc
  [17/47] System.Diagnostics.DiagnosticSource.dll -> System.Diagnostics.DiagnosticSource.dll.bc
  [18/47] System.Linq.dll -> System.Linq.dll.bc
  [19/47] System.Memory.dll -> System.Memory.dll.bc
  [20/47] System.Net.Http.dll -> System.Net.Http.dll.bc
  [21/47] System.Net.Primitives.dll -> System.Net.Primitives.dll.bc
  [22/47] System.ObjectModel.dll -> System.ObjectModel.dll.bc
  [23/47] System.Linq.Expressions.dll -> System.Linq.Expressions.dll.bc
  [24/47] System.Private.Uri.dll -> System.Private.Uri.dll.bc
  [System.Private.CoreLib.dll] Exec (with response file contents expanded) in /root/helix/work/workitem/e/wasm_build/obj/wasm/for-build/aot-in: MONO_PATH=/root/helix/work/workitem/e/wasm_build/obj/wasm/for-build/aot-in:/root/helix/work/correlation/build/microsoft.netcore.app.runtime.browser-wasm/runtimes/browser-wasm/native/:/root/helix/work/correlation/build/microsoft.netcore.app.runtime.browser-wasm/runtimes/browser-wasm/lib/net10.0 MONO_ENV_OPTIONS= /root/helix/work/correlation/build/cross/mono-aot-cross --wasm-exceptions --debug --llvm "--aot=no-opt,static,direct-icalls,deterministic,compile-in-child,mattr=simd,nodebug,llvm-path=/root/helix/work/correlation/build/emsdk/bin/,static,dwarfdebug,dedup-skip,trimming-eligible-methods-outfile=/root/helix/work/workitem/e/wasm_build/obj/wasm/for-build/tokens/System_Private_CoreLib_dll_compiled_methods.txt,llvmonly,interp,asmonly,llvm-outfile=/root/helix/work/workitem/e/wasm_build/obj/wasm/for-build/System.Private.CoreLib.dll.bc.tmp,temp-path=/root/helix/work/workitem/e/wasm_build/obj/wasm/for-build/System.Private.CoreLib.dll.tmp" "System.Private.CoreLib.dll"
  
/root/helix/work/correlation/build/wasm-shared/WasmApp.Common.targets(706,5): error : Precompiling failed for /root/helix/work/workitem/e/wasm_build/obj/wasm/for-build/aot-in/System.Private.CoreLib.dll with exit code 1. [/root/helix/work/workitem/e/publish/ProxyProjectForAOTOnHelix.proj]
/root/helix/work/correlation/build/wasm-shared/WasmApp.Common.targets(706,5): error : Segmentation fault (core dumped) [/root/helix/work/workitem/e/publish/ProxyProjectForAOTOnHelix.proj]
/root/helix/work/correlation/build/wasm-shared/WasmApp.Common.targets(706,5): error : AOT of image /root/helix/work/workitem/e/wasm_build/obj/wasm/for-build/aot-in/System.Private.CoreLib.dll failed. [/root/helix/work/workitem/e/publish/ProxyProjectForAOTOnHelix.proj]
/root/helix/work/correlation/build/wasm-shared/WasmApp.Common.targets(706,5): error : Mono Ahead of Time compiler - compiling assembly /root/helix/work/workitem/e/wasm_build/obj/wasm/for-build/aot-in/System.Private.CoreLib.dll [/root/helix/work/workitem/e/publish/ProxyProjectForAOTOnHelix.proj]
/root/helix/work/correlation/build/wasm-shared/WasmApp.Common.targets(706,5): error : Executing: /root/helix/work/correlation/build/cross/mono-aot-cross "--wasm-exceptions" "--debug" "--llvm" "--aot=no-opt,static,direct-icalls,deterministic,_child,mattr=simd,nodebug,llvm-path=/root/helix/work/correlation/build/emsdk/bin/,static,dwarfdebug,dedup-skip,trimming-eligible-methods-outfile=/root/helix/work/workitem/e/wasm_build/obj/wasm/for-build/tokens/System_Private_CoreLib_dll_compiled_methods.txt,llvmonly,interp,asmonly,llvm-outfile=/root/helix/work/workitem/e/wasm_build/obj/wasm/for-build/System.Private.CoreLib.dll.bc.tmp,temp-path=/root/helix/work/workitem/e/wasm_build/obj/wasm/for-build/System.Private.CoreLib.dll.tmp" "/root/helix/work/workitem/e/wasm_build/obj/wasm/for-build/aot-in/System.Private.CoreLib.dll" [/root/helix/work/workitem/e/publish/ProxyProjectForAOTOnHelix.proj]
  [25/47] System.Private.Xml.dll -> System.Private.Xml.dll.bc
  [26/47] System.Private.Xml.Linq.dll -> System.Private.Xml.Linq.dll.bc

from the pr

@lewing
Copy link
Member Author

lewing commented Apr 30, 2025

Looks like #99596 caused the regression

@lewing
Copy link
Member Author

lewing commented May 1, 2025

crashes are in the range covered by 2745546

@lewing
Copy link
Member Author

lewing commented May 1, 2025

First failing method:

        [Fact]
        public void Vector128DoubleShuffleNativeOneInputTest()
        {
            Vector128<double> vector = Vector128.Create((double)1, 2);
            Vector128<double> result = Vector128.ShuffleNative(vector, Vector128.Create((long)1, 0));

            for (int index = 0; index < Vector128<double>.Count; index++)
            {
                Assert.Equal((double)(Vector128<double>.Count - index), result.GetElement(index));
            }
        }

@lewing
Copy link
Member Author

lewing commented May 1, 2025

This is very odd changing it to call Shuffle directly does not crash

        [Fact]
        public void Vector128DoubleShuffleNativeOneInputTest()
        {
            Vector128<double> vector = Vector128.Create((double)1, 2);
            Vector128<double> result = Vector128.Shuffle(vector, Vector128.Create((long)1, 0));
            for (int index = 0; index < Vector128<double>.Count; index++)
            {
                Assert.Equal((double)(Vector128<double>.Count - index), result.GetElement(index));
            }
        }

But Vector128 ShuffleNative is the following

#if !MONO
        [Intrinsic]
#else
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
        public static Vector128<double> ShuffleNative(Vector128<double> vector, Vector128<long> indices)
        {
#if !MONO
            return ShuffleNativeFallback(vector, indices);
#else
            return Shuffle(vector, indices);
#endif
        }

Is it crashing trying to inline it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-wasm WebAssembly architecture area-Codegen-AOT-mono os-browser Browser variant of arch-wasm
Projects
None yet
1 participant