-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[wasm] Compile .bc->.o in parallel, before passing to the linker #54053
Conversation
- this cleans up `Utils.RunProcess` a bit, but doesn't change the behavior for the existing non-wasm users (Apple, and Android build tasks) - New overloads are added to support getting the output, and exit code, and throwing only when really needed - And running shell commands, appropriately on windows, and unix.
Currently, we use `mono-aot-cross` to compile the managed assemblies into bitcode files. Then we pass the `.bc` files to `emcc` for linking. We can save some amount of work, if precompile `.bc` files to `.o` files, and pass them for linking. This would also allow us to rebuild the `.o` files only when needed, thus improving incremental builds. Also, emscripten has recently removed some amount of parallelization, so this allows us to do some pre-linking work in parallel, and speed up the builds a little bit. This is implemented via a new `EmccCompile` task, that is meant *only* for compiling, and not as a general purpose `emcc` invocation task.
`System.IO.MemoryMappedFiles.Tests` - Issue: dotnet#54194
376b844
to
1909fcc
Compare
Tagging subscribers to 'arch-wasm': @lewing Issue Details
|
- `IBuildEngine9.RequestCores` - This is available only in 16.10+, so bump msbuild used for building the tests
@akoeplinger Does the msbuild bump to 16.10.0 look fine? |
/azp run runtime,runtime-staging |
Azure Pipelines successfully started running 2 pipeline(s). |
/azp run runtime |
- This is meant to be disabled for CI (it has `IgnoreForCI=true` in the csproj)
.. because we keep running into the following on browser, and other platforms: ``` /__w/1/s/src/libraries/Microsoft.NETCore.Platforms/tests/Microsoft.NETCore.Platforms.Tests.csproj : error NU1201: Project System.Security.AccessControl is not compatible with net472 (.NETFramework,Version=v4.7.2). Project System.Security.AccessControl supports: net6.0 (.NETCoreApp,Version=v6.0) [/__w/1/s/Build.proj] \#\#[error]src/libraries/Microsoft.NETCore.Platforms/tests/Microsoft.NETCore.Platforms.Tests.csproj(0,0): error NU1201: (NETCORE_ENGINEERING_TELEMETRY=Restore) Project System.Security.AccessControl is not compatible with net472 (.NETFramework,Version=v4.7.2). Project System.Security.AccessControl supports: net6.0 (.NETCoreApp,Version=v6.0) ```
This is already not being sent to CI with `IgnoreForCI=true`. It fails on CI with: ``` /_/src/Shared/NativeMethodsShared.cs(855,29): error IL1005: Microsoft.Build.Shared.NativeMethodsShared.SystemInformation.get: Error processing method 'Microsoft.Build.Shared.NativeMethodsShared.SystemInformationData.SystemInformationData()' in assembly 'Microsoft.Build.Utilities.Core.dll' [/__w/1/s/src/libraries/Microsoft.NETCore.Platforms/tests/Microsoft.NETCore.Platforms.Tests.csproj] \##[error]/_/src/Shared/NativeMethodsShared.cs(855,29): error IL1005: (NETCORE_ENGINEERING_TELEMETRY=Build) Microsoft.Build.Shared.NativeMethodsShared.SystemInformation.get: Error processing method 'Microsoft.Build.Shared.NativeMethodsShared.SystemInformationData.SystemInformationData()' in assembly 'Microsoft.Build.Utilities.Core.dll' Mono.Linker.LinkerFatalErrorException: /_/src/Shared/NativeMethodsShared.cs(855,29): error IL1005: Microsoft.Build.Shared.NativeMethodsShared.SystemInformation.get: Error processing method 'Microsoft.Build.Shared.NativeMethodsShared.SystemInformationData.SystemInformationData()' in assembly 'Microsoft.Build.Utilities.Core.dll' ---> System.NotImplementedException: switch at Mono.Linker.Steps.UnreachableBlocksOptimizer.BodyReducer.IsConstantBranch(OpCode opCode, Int32 operand) in illink.dll:token 0x6000770+0x41 at Mono.Linker.Steps.UnreachableBlocksOptimizer.BodyReducer.RemoveConditions() in illink.dll:token 0x6000768+0x22a at Mono.Linker.Steps.UnreachableBlocksOptimizer.BodyReducer.RewriteBody() in illink.dll:token 0x6000766+0xa at Mono.Linker.Steps.UnreachableBlocksOptimizer.ProcessStack() in illink.dll:token 0x60004e9+0x102 at Mono.Linker.Steps.UnreachableBlocksOptimizer.ProcessMethod(MethodDefinition method) in illink.dll:token 0x60004e5+0x44 at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method, DependencyInfo& reason, Scope& scope) in illink.dll:token 0x600040e+0x9b at Mono.Linker.Steps.MarkStep.ProcessQueue() in illink.dll:token 0x6000399+0x24 --- End of inner exception stack trace --- at Mono.Linker.Steps.MarkStep.ProcessQueue() in illink.dll:token 0x6000399+0xaa at Mono.Linker.Steps.MarkStep.ProcessPrimaryQueue() in illink.dll:token 0x6000396+0xa at Mono.Linker.Steps.MarkStep.Process() in illink.dll:token 0x6000393+0x0 at Mono.Linker.Steps.MarkStep.Process(LinkContext context) in illink.dll:token 0x600038a+0x41 at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step) in illink.dll:token 0x6000264+0x0 at Mono.Linker.Pipeline.Process(LinkContext context) in illink.dll:token 0x6000263+0xf at Mono.Linker.Driver.Run(ILogger customLogger) in illink.dll:token 0x60000fd+0x20 Optimizing assemblies for size, which may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink /__w/1/s/.dotnet/sdk/6.0.100-preview.4.21255.9/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.ILLink.targets(80,5): error NETSDK1144: Optimizing assemblies for size failed. Optimization can be disabled by setting the PublishTrimmed property to false. [/__w/1/s/src/libraries/Microsoft.NETCore.Platforms/tests/Microsoft.NETCore.Platforms.Tests.csproj] \##[error].dotnet/sdk/6.0.100-preview.4.21255.9/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.ILLink.targets(80,5): error NETSDK1144: (NETCORE_ENGINEERING_TELEMETRY=Build) Optimizing assemblies for size failed. Optimization can be disabled by setting the PublishTrimmed property to false. ```
cc @ericstj @ViktorHofer for the change disabling |
1 test failure for wasm:
@Daniel-Genkin is already looking at fixing this. |
fix should be in #54587 |
That very much sounds like NuGet/Home#10368. Usually you can fix this by adding the transitive dependencies, in this case in the Platforms.Tests.csproj file. |
The failures are all unrelated to this PR. |
Usually we link to issues that track the failures according to https://github.com/dotnet/runtime/blob/main/docs/issues-pr-management.md#common-policies. Can you please do so for the issues that you were seeing in the last build? |
Failures:
And for |
…nitial_config * origin/main: (362 commits) [wasm][debugger] Reuse debugger-agent on wasm debugger (dotnet#52300) Put Crossgen2 in sync with dotnet#54235 (dotnet#54438) Move System.Object serialization to ObjectConverter (dotnet#54436) Move setting fHasVirtualStaticMethods out of sanity check section (dotnet#54574) [wasm] Compile .bc->.o in parallel, before passing to the linker (dotnet#54053) Change PathInternal.IsCaseSensitive to a constant (dotnet#54340) Make mono_polling_required a public symbol (dotnet#54592) Respect EventSource::IsSupported setting in more codepaths (dotnet#51977) Root ComActivator for hosting (dotnet#54524) Add ILLink annotations to S.D.Common related to DbConnectionStringBuilder (dotnet#54280) Fix finalizer issue with regions (dotnet#54550) Add support for multi-arch install locations (dotnet#53763) Update library testing docs page to reduce confusion (dotnet#54324) [FileStream] handle UNC and device paths (dotnet#54483) Update NetAnalyzers version (dotnet#54511) Added runtime dependency to fix the intermittent test failures (dotnet#54587) Disable failing System.Reflection.Tests.ModuleTests.GetMethods (dotnet#54564) [wasm] Move AOT builds from `runtime-staging` to `runtime` (dotnet#54577) Keep obj node for ArrayIndex. (dotnet#54584) Disable another failing MemoryCache test (dotnet#54578) ...
Currently, we use
mono-aot-cross
to compile the managed assembliesinto bitcode files. Then we pass the
.bc
files toemcc
for linking.We can save some amount of work, if precompile
.bc
files to.o
files, and pass them for linking.
This would also allow us to rebuild the
.o
files only when needed,thus improving incremental builds.
Also, emscripten has recently removed some amount of parallelization, so
this allows us to do some pre-linking work in parallel, and speed up the
builds a little bit.
This is implemented via a new
EmccCompile
task, that is meant onlyfor compiling, and not as a general purpose
emcc
invocation task.Also, this bumps msbuild used for tasks compilation to
16.9.0
.