From 279bb62393b13b52afc67ca371f43766ce8d5a1e Mon Sep 17 00:00:00 2001 From: Steve Pfister Date: Mon, 18 Jul 2022 17:55:58 -0400 Subject: [PATCH 1/6] [wasm] Modify workload to pick threading runtime packs This change adds the 2 wasm threading runtime packs to the wasm workload. In order for a threading runtime pack to be chosen, WorkloadManifest.targets is also modified to override the runtime pack name when the following props are set: WasmEnableThreads - full threading support and will load Microsoft.NETCore.App.Runtime.multithread.Mono.browser-wasm WasmEnablePerfTrace - runtime only threading support and will load Microsoft.NETCore.App.Runtime.perftrace.Mono.browser-wasm --- .../WorkloadManifest.json.in | 12 +++++++++++- .../WorkloadManifest.targets.in | 3 +++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/WorkloadManifest.json.in b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/WorkloadManifest.json.in index e0b21a86a2ddb..64d946adca32e 100644 --- a/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/WorkloadManifest.json.in +++ b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/WorkloadManifest.json.in @@ -17,7 +17,9 @@ "wasm-experimental": { "description": ".NET WebAssembly experimental", "packs": [ - "Microsoft.NET.Runtime.WebAssembly.Templates" + "Microsoft.NET.Runtime.WebAssembly.Templates", + "Microsoft.NETCore.App.Runtime.Mono.multithread.browser-wasm", + "Microsoft.NETCore.App.Runtime.Mono.perftrace.browser-wasm" ], "extends": [ "wasm-tools" ], "platforms": [ "win-x64", "linux-x64", "osx-x64", "osx-arm64" ] @@ -367,6 +369,14 @@ "kind": "framework", "version": "${PackageVersion}" }, + "Microsoft.NETCore.App.Runtime.Mono.multithread.browser-wasm" : { + "kind": "framework", + "version": "${PackageVersion}" + }, + "Microsoft.NETCore.App.Runtime.Mono.perftrace.browser-wasm" : { + "kind": "framework", + "version": "${PackageVersion}" + }, "Microsoft.NETCore.App.Runtime.win-x64" : { "kind": "framework", "version": "${PackageVersion}" diff --git a/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/WorkloadManifest.targets.in b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/WorkloadManifest.targets.in index df6b5c918ea43..83a50409e89c7 100644 --- a/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/WorkloadManifest.targets.in +++ b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/WorkloadManifest.targets.in @@ -93,6 +93,9 @@ **FromWorkload** + + Microsoft.NETCore.App.Runtime.Mono.multithread.**RID** + Microsoft.NETCore.App.Runtime.Mono.perftrace.**RID** From 0f9e3b48f1c141f09db75a9375160cd563bdbed6 Mon Sep 17 00:00:00 2001 From: Steve Pfister Date: Tue, 19 Jul 2022 10:30:38 -0400 Subject: [PATCH 2/6] Add error condition when both WasmEnableThreading and WasmEnablePerfTrace are true --- .../WorkloadManifest.targets.in | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/WorkloadManifest.targets.in b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/WorkloadManifest.targets.in index 83a50409e89c7..19e5fdb7c585c 100644 --- a/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/WorkloadManifest.targets.in +++ b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/WorkloadManifest.targets.in @@ -40,12 +40,6 @@ - @@ -116,4 +110,10 @@ + + + + From d6e57a4bc068f5d4161ed006b6c257aadc6db589 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Tue, 26 Jul 2022 23:37:04 +0000 Subject: [PATCH 3/6] [wasm] Set default value for MonoWasmBuildVariant, for runtime pack nuget --- .../Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.props | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.props b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.props index 230e91e97e457..f9bd09eae85d6 100644 --- a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.props +++ b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.props @@ -15,6 +15,9 @@ true true The .NET Shared Framework + + multithread + perftrace From 6efec93d60621ac7588eaca3cd02a0c71de28aac Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Tue, 26 Jul 2022 23:58:34 +0000 Subject: [PATCH 4/6] [wasm] Wasm.Build.Tests: add support for multiple runtime packs - Runtime pack nugets other than the one that gets built might not be available. In that case, we copy the only one available as the missing ones. - This is useful for local builds, allowing running Wasm.Build.Tests without having to build all 3 runtimes. - This is enabled for CI also, in this commit. But once CI gets the ability to fetch the other runtime packs, this will change. --- eng/testing/workloads-testing.targets | 49 ++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/eng/testing/workloads-testing.targets b/eng/testing/workloads-testing.targets index 0dc8c88d157f3..472b81c8e1f2a 100644 --- a/eng/testing/workloads-testing.targets +++ b/eng/testing/workloads-testing.targets @@ -97,7 +97,7 @@ @@ -133,6 +133,53 @@ + + + + + + <_PackageVersion>$(PackageVersion) + <_PackageVersion Condition="'$(StabilizePackageVersion)' == 'true'">$(ProductVersion) + + + + <_RuntimePackNuget Include="$(LibrariesShippingPackagesDir)Microsoft.NETCore.App.Runtime.Mono*$(_PackageVersion).nupkg" /> + + <_ExpectedRuntimePackNuGet Include="Microsoft.NETCore.App.Runtime.Mono.browser-wasm.$(_PackageVersion)" /> + <_ExpectedRuntimePackNuGet Include="Microsoft.NETCore.App.Runtime.Mono.multithread.browser-wasm.$(_PackageVersion)" /> + <_ExpectedRuntimePackNuGet Include="Microsoft.NETCore.App.Runtime.Mono.perftrace.browser-wasm.$(_PackageVersion)" /> + + + + + + + + + + + From 0fa442f658af9f7f41e887ab997a022bbcebfadc Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Wed, 27 Jul 2022 04:00:12 +0000 Subject: [PATCH 5/6] [wasm] Wasm.Build.Tests: build runtime pack nugets with different names - The earlier approach of simply making copies of the existing runtime pack nuget with different names doesn't work, and `dotnet workload install` rejects it. ``` Installing pack Microsoft.NETCore.App.Runtime.Mono.multithread.browser-wasm version 7.0.0-ci... Workload installation failed. Rolling back installed packs... ``` Instead, now we build the missing nugets from the project with different values for `$(MonoWasmBuildVariant)`. - this handles local builds, and incremental builds also - To skip building the missing nugets, for example, when you have all of them available, then set `WasmSkipMissingRuntimePackBuild=true`. --- docs/workflow/testing/testing-workloads.md | 11 +++ eng/testing/workloads-testing.targets | 97 +++++++++++++--------- 2 files changed, 71 insertions(+), 37 deletions(-) diff --git a/docs/workflow/testing/testing-workloads.md b/docs/workflow/testing/testing-workloads.md index cb03515554a01..4bb29e96ec657 100644 --- a/docs/workflow/testing/testing-workloads.md +++ b/docs/workflow/testing/testing-workloads.md @@ -23,6 +23,17 @@ Example for wasm: - Currently, this is used only by `src/tests/BuildWasmApps/Wasm.Build.Tests` +## Multiple runtime packs + +The workload depends on three runtime packs - single threaded, multithreaded, and for perf tracing. If you have a local +runtime build, for say multithreaded, then the workload install will fail because of missing runtime pack nugets for +the other two variants. + +For non-CI builds, we build the same runtime pack nuget but with the different expected names. So, essentially you get all +the expected nugets, but they are all the same except for the name. + +If you have all the nugets available, and want to avoid the above behavior then set `WasmSkipMissingRuntimeBuild=true`. + ## Limitations: - The cross compiler package is built manually from the `InstallWorkloadUsingArtifacts` target diff --git a/eng/testing/workloads-testing.targets b/eng/testing/workloads-testing.targets index 472b81c8e1f2a..e795b75feeb2f 100644 --- a/eng/testing/workloads-testing.targets +++ b/eng/testing/workloads-testing.targets @@ -5,6 +5,13 @@ true + + <_DefaultPropsForNuGetBuild Include="Configuration=$(Configuration)" /> + <_DefaultPropsForNuGetBuild Include="TargetOS=Browser" /> + <_DefaultPropsForNuGetBuild Include="TargetArchitecture=wasm" /> + <_DefaultPropsForNuGetBuild Include="ContinuousIntegrationBuild=$(ContinuousIntegrationBuild)" /> + + @@ -97,10 +104,10 @@ - + <_PackageVersion>$(PackageVersion) <_PackageVersion Condition="'$(StabilizePackageVersion)' == 'true'">$(ProductVersion) @@ -109,73 +116,89 @@ - <_PropsForNuGetBuild Include="Configuration=$(Configuration)" /> - <_PropsForNuGetBuild Include="TargetOS=Browser" /> - <_PropsForNuGetBuild Include="TargetArchitecture=wasm" /> - <_PropsForNuGetBuild Include="ContinuousIntegrationBuild=$(ContinuousIntegrationBuild)" /> + <_DefaultPropsForNuGetBuild Include="Configuration=$(Configuration)" /> + <_DefaultPropsForNuGetBuild Include="TargetOS=Browser" /> + <_DefaultPropsForNuGetBuild Include="TargetArchitecture=wasm" /> + <_DefaultPropsForNuGetBuild Include="ContinuousIntegrationBuild=$(ContinuousIntegrationBuild)" /> + + <_NuGetsToBuild Include="$(LibrariesShippingPackagesDir)Microsoft.NETCore.App.Ref.$(_PackageVersion).nupkg" + Project="$(InstallerProjectRoot)pkg/sfx/Microsoft.NETCore.App\Microsoft.NETCore.App.Ref.sfxproj" + BuildArgs="@(_DefaultPropsForNuGetBuild -> '-p:%(Identity)', ' ')" + Descriptor="Ref pack"/> - <_PropsForAOTCrossBuild Include="@(_PropsForNuGetBuild)" /> + + <_PropsForAOTCrossBuild Include="@(_DefaultPropsForNuGetBuild)" /> <_PropsForAOTCrossBuild Include="TestingWorkloads=true" /> <_PropsForAOTCrossBuild Include="RuntimeIdentifier=$(NETCoreSdkRuntimeIdentifier)" /> <_PropsForAOTCrossBuild Include="TargetCrossRid=$(RuntimeIdentifier)" /> <_NuGetsToBuild Include="$(_AOTCrossNuGetPath)" Project="$(InstallerProjectRoot)pkg/sfx/Microsoft.NETCore.App\Microsoft.NETCore.App.MonoCrossAOT.sfxproj" - BuildArgs="@(_PropsForAOTCrossBuild -> '-p:%(Identity)', ' ')" /> - - <_NuGetsToBuild Include="$(LibrariesShippingPackagesDir)Microsoft.NETCore.App.Ref.$(_PackageVersion).nupkg" - Project="$(InstallerProjectRoot)pkg/sfx/Microsoft.NETCore.App\Microsoft.NETCore.App.Ref.sfxproj" - BuildArgs="@(_PropsForNuGetBuild -> '-p:%(Identity)', ' ')" /> + BuildArgs="@(_PropsForAOTCrossBuild -> '-p:%(Identity)', ' ')" + Descriptor="AOT Cross compiler"/> - - + + + - + - + <_PackageVersion>$(PackageVersion) <_PackageVersion Condition="'$(StabilizePackageVersion)' == 'true'">$(ProductVersion) + + <_DefaultBuildVariant Condition="'$(WasmEnableThreads)' == 'true' or '$(MonoWasmBuildVariant)' == 'multithread'">.multithread. + <_DefaultBuildVariant Condition="'$(WasmEnablePerfTracing)' == 'true' or '$(MonoWasmBuildVariant)' == 'perftrace'">.perftrace. + <_DefaultBuildVariant Condition="'$(_DefaultBuildVariant)' == ''">. + + <_DefaultRuntimePackNuGetPath>$(LibrariesShippingPackagesDir)Microsoft.NETCore.App.Runtime.Mono$(_DefaultBuildVariant)browser-wasm$(_PackageVersion).nupkg - <_RuntimePackNuget Include="$(LibrariesShippingPackagesDir)Microsoft.NETCore.App.Runtime.Mono*$(_PackageVersion).nupkg" /> - - <_ExpectedRuntimePackNuGet Include="Microsoft.NETCore.App.Runtime.Mono.browser-wasm.$(_PackageVersion)" /> - <_ExpectedRuntimePackNuGet Include="Microsoft.NETCore.App.Runtime.Mono.multithread.browser-wasm.$(_PackageVersion)" /> - <_ExpectedRuntimePackNuGet Include="Microsoft.NETCore.App.Runtime.Mono.perftrace.browser-wasm.$(_PackageVersion)" /> + <_RuntimePackNugetAvailable Include="$(LibrariesShippingPackagesDir)Microsoft.NETCore.App.Runtime.Mono*$(_PackageVersion).nupkg" /> - + - - - + + <_BuildVariants Include="multithread" Condition="'$(_DefaultBuildVariant)' != '.multithread.'" /> + <_BuildVariants Include="perftrace" Condition="'$(_DefaultBuildVariant)' != '.perftrace.'" /> + + <_NuGetsToBuild Include="$(LibrariesShippingPackagesDir)Microsoft.NETCore.App.Runtime.Mono.%(_BuildVariants.Identity).browser-wasm.$(_PackageVersion).nupkg" + Project="$(InstallerProjectRoot)pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.sfxproj" + Dependencies="$(_DefaultRuntimePackNuGetPath)" + BuildArgs="@(_DefaultPropsForNuGetBuild -> '-p:%(Identity)', ' ') /p:MonoWasmBuildVariant=%(_BuildVariants.Identity)" + Descriptor="runtime pack for %(_BuildVariants.Identity)" /> + + + <_NuGetsToBuild Include="$(LibrariesShippingPackagesDir)Microsoft.NETCore.App.Runtime.Mono.browser-wasm.$(_PackageVersion).nupkg" + Project="$(InstallerProjectRoot)pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.sfxproj" + BuildArgs="@(_DefaultPropsForNuGetBuild -> '-p:%(Identity)', ' ')" + Dependencies="$(_DefaultRuntimePackNuGetPath)" + Descriptor="single threaded runtime pack" + Condition="'$(_DefaultBuildVariant)' != '.'" /> + From 32d220ce5402c2ea9f81833873c8b7294d63e853 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Wed, 27 Jul 2022 04:12:07 +0000 Subject: [PATCH 6/6] fix comment --- eng/testing/workloads-testing.targets | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/eng/testing/workloads-testing.targets b/eng/testing/workloads-testing.targets index e795b75feeb2f..9fc7e7a139161 100644 --- a/eng/testing/workloads-testing.targets +++ b/eng/testing/workloads-testing.targets @@ -146,11 +146,8 @@ - -