Skip to content

Commit 765090f

Browse files
authored
[browser][mt] Unify multithreading switches (#97560)
* Unification * Typo: remove quotation. * Simplify more using the fact that `RIDForWorkload` cannot be empty. * Quotation typo * Feedback * Replace `MonoWasmThreads` with `WasmEnableThreads`
1 parent 541857c commit 765090f

File tree

115 files changed

+435
-447
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+435
-447
lines changed

eng/pipelines/extra-platforms/runtime-extra-platforms-wasm.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ jobs:
124124
- browser_wasm
125125
#- browser_wasm_win
126126
nameSuffix: _Threading
127-
extraBuildArgs: /p:MonoWasmBuildVariant=multithread /p:WasmEnableThreads=true /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS)
127+
extraBuildArgs: /p:WasmEnableThreads=true /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS)
128128
isExtraPlatformsBuild: ${{ parameters.isExtraPlatformsBuild }}
129129
isWasmOnlyBuild: ${{ parameters.isWasmOnlyBuild }}
130130
# Always run for runtime-wasm because tests are not run in runtime
@@ -255,7 +255,7 @@ jobs:
255255
- browser_wasm
256256
- browser_wasm_win
257257
nameSuffix: MultiThreaded
258-
extraBuildArgs: /p:MonoWasmBuildVariant=multithread /p:WasmEnableThreads=true /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS)
258+
extraBuildArgs: /p:WasmEnableThreads=true /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS)
259259
condition: ne(variables['wasmMultiThreadedBuildOnlyNeededOnDefaultPipeline'], true)
260260
publishArtifactsForWorkload: true
261261
publishWBT: false
@@ -313,7 +313,7 @@ jobs:
313313
platforms:
314314
- Browser_wasm
315315
- Browser_wasm_win
316-
extraBuildArgs: /p:MonoWasmBuildVariant=multithread /p:WasmEnableThreads=true /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS)
316+
extraBuildArgs: /p:WasmEnableThreads=true /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS)
317317
nameSuffix: DebuggerTests_MultiThreaded
318318
alwaysRun: ${{ parameters.isWasmOnlyBuild }}
319319
isExtraPlatformsBuild: ${{ parameters.isExtraPlatformsBuild }}

eng/pipelines/runtime-official.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ extends:
394394
platforms:
395395
- browser_wasm
396396
jobParameters:
397-
buildArgs: -s mono+libs+host+packs -c $(_BuildConfig) /p:MonoWasmBuildVariant=multithread /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS)
397+
buildArgs: -s mono+libs+host+packs -c $(_BuildConfig) /p:WasmEnableThreads=true /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS)
398398
nameSuffix: Mono_multithread
399399
isOfficialBuild: ${{ variables.isOfficialBuild }}
400400
runtimeVariant: multithread

eng/pipelines/runtime.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ extends:
565565
- browser_wasm_win
566566
condition: or(eq(variables.isRollingBuild, true), eq(variables.wasmSingleThreadedBuildOnlyNeededOnDefaultPipeline, true))
567567
nameSuffix: MultiThreaded
568-
extraBuildArgs: /p:MonoWasmBuildVariant=multithread /p:WasmEnableThreads=true /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS)
568+
extraBuildArgs: /p:WasmEnableThreads=true /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS)
569569
publishArtifactsForWorkload: true
570570
publishWBT: false
571571

@@ -601,7 +601,7 @@ extends:
601601
platforms:
602602
- browser_wasm
603603
nameSuffix: _Threading_Smoke
604-
extraBuildArgs: /p:MonoWasmBuildVariant=multithread /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS)
604+
extraBuildArgs: /p:WasmEnableThreads=true /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS)
605605
shouldRunSmokeOnly: true
606606
alwaysRun: ${{ variables.isRollingBuild }}
607607
scenarios:

eng/testing/tests.browser.targets

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,15 @@
8787
<_AppArgs Condition="'$(IsFunctionalTest)' != 'true' and '$(WasmMainAssemblyFileName)' != ''">--run $(WasmMainAssemblyFileName)</_AppArgs>
8888
<_AppArgs Condition="'$(IsFunctionalTest)' == 'true'">--run $(AssemblyName).dll</_AppArgs>
8989

90-
<_XUnitBackgroundExec Condition="'$(_XUnitBackgroundExec)' == '' and '$(MonoWasmBuildVariant)' == 'multithread'">true</_XUnitBackgroundExec>
90+
<_XUnitBackgroundExec Condition="'$(_XUnitBackgroundExec)' == '' and '$(WasmEnableThreads)' == 'true'">true</_XUnitBackgroundExec>
9191
<WasmTestAppArgs Condition="'$(_XUnitBackgroundExec)' == 'true'">$(WasmTestAppArgs) -backgroundExec</WasmTestAppArgs>
9292
<_AppArgs Condition="'$(WasmTestAppArgs)' != ''">$(_AppArgs) $(WasmTestAppArgs)</_AppArgs>
9393

9494
<WasmXHarnessMonoArgs Condition="'$(XunitShowProgress)' == 'true'">$(WasmXHarnessMonoArgs) --setenv=XHARNESS_LOG_TEST_START=1</WasmXHarnessMonoArgs>
9595
<!-- snapshots are not yet supported with threads -->
96-
<WasmXHarnessMonoArgs Condition="'$(MonoWasmBuildVariant)' == 'multithread'">$(WasmXHarnessMonoArgs) --no-memory-snapshot</WasmXHarnessMonoArgs>
96+
<WasmXHarnessMonoArgs Condition="'$(WasmEnableThreads)' == 'true'">$(WasmXHarnessMonoArgs) --no-memory-snapshot</WasmXHarnessMonoArgs>
9797
<!-- help unit test with PlatformDetection.IsThreadingSupported via IsBrowserThreadingSupported env variable -->
98-
<WasmXHarnessMonoArgs Condition="'$(MonoWasmBuildVariant)' == 'multithread'">$(WasmXHarnessMonoArgs) --setenv=IsBrowserThreadingSupported=true</WasmXHarnessMonoArgs>
98+
<WasmXHarnessMonoArgs Condition="'$(WasmEnableThreads)' == 'true'">$(WasmXHarnessMonoArgs) --setenv=IsBrowserThreadingSupported=true</WasmXHarnessMonoArgs>
9999
</PropertyGroup>
100100

101101
<PropertyGroup Condition="'$(RunScriptCommand)' == ''">
@@ -104,7 +104,7 @@
104104

105105
<_XHarnessArgs Condition="'$(IsFunctionalTest)' == 'true'" >$(_XHarnessArgs) --expected-exit-code=$(ExpectedExitCode)</_XHarnessArgs>
106106
<_XHarnessArgs Condition="'$(WasmXHarnessArgs)' != ''" >$(_XHarnessArgs) $(WasmXHarnessArgs)</_XHarnessArgs>
107-
<_XHarnessArgs Condition="'$(MonoWasmBuildVariant)' == 'multithread' and '$(_XHarnessArs.Contains(&quot;--web-server-use-cop&quot;)' != 'true'">$(_XHarnessArgs) --web-server-use-cop</_XHarnessArgs>
107+
<_XHarnessArgs Condition="'$(WasmEnableThreads)' == 'true' and '$(_XHarnessArs.Contains(&quot;--web-server-use-cop&quot;)' != 'true'">$(_XHarnessArgs) --web-server-use-cop</_XHarnessArgs>
108108
<_XHarnessArgs >$(_XHarnessArgs) -s dotnet.native.js.symbols</_XHarnessArgs>
109109
<_XHarnessArgs Condition="'$(_UseWasmSymbolicator)' == 'true'" >$(_XHarnessArgs) --symbol-patterns wasm-symbol-patterns.txt</_XHarnessArgs>
110110
<_XHarnessArgs Condition="'$(_UseWasmSymbolicator)' == 'true'" >$(_XHarnessArgs) --symbolicator WasmSymbolicator.dll,Microsoft.WebAssembly.Internal.SymbolicatorWrapperForXHarness</_XHarnessArgs>

eng/testing/workloads-browser.targets

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,14 @@
4747
<Target Name="_GetRuntimePackNuGetsToBuild" Condition="'$(WasmSkipMissingRuntimePackBuild)' != 'true'" Returns="@(_NuGetsToBuild)">
4848
<Error Condition="'$(RIDForWorkload)' == ''" Text="$(RIDForWorkload) is unset" />
4949
<PropertyGroup>
50-
<_DefaultBuildVariant Condition="'$(MonoWasmBuildVariant)' == 'multithread'">.multithread.</_DefaultBuildVariant>
51-
<_DefaultBuildVariant Condition="'$(_DefaultBuildVariant)' == ''">.</_DefaultBuildVariant>
52-
53-
<_DefaultRuntimePackNuGetPath>$(LibrariesShippingPackagesDir)Microsoft.NETCore.App.Runtime.Mono$(_DefaultBuildVariant)$(RIDForWorkload).$(PackageVersionForWorkloadManifests).nupkg</_DefaultRuntimePackNuGetPath>
50+
<_BuildVariant Condition="'$(WasmEnableThreads)' == 'true'">multithread</_BuildVariant>
51+
<_Descriptor Condition="'$(WasmEnableThreads)' == 'true'">runtime pack for $(_BuildVariant)</_Descriptor>
52+
<_Descriptor Condition="'$(WasmEnableThreads)' != 'true'">single threaded runtime pack</_Descriptor>
53+
<_DefaultRuntimePackNuGetPath>$([System.String]::Join('.',
54+
$(LibrariesShippingPackagesDir)Microsoft.NETCore.App.Runtime.Mono,
55+
$(_BuildVariant),
56+
$(RIDForWorkload).$(PackageVersionForWorkloadManifests).nupkg))
57+
</_DefaultRuntimePackNuGetPath>
5458
</PropertyGroup>
5559

5660
<ItemGroup>
@@ -63,22 +67,11 @@
6367
Text="Expected to find either one or two in $(LibrariesShippingPackagesDir): @(_RuntimePackNugetAvailable->'%(FileName)%(Extension)')" />
6468

6569
<ItemGroup>
66-
<_BuildVariants Include="multithread" Condition="'$(_DefaultBuildVariant)' != '.multithread.'" />
67-
68-
<_NuGetsToBuild Include="$(LibrariesShippingPackagesDir)Microsoft.NETCore.App.Runtime.Mono.%(_BuildVariants.Identity).$(RIDForWorkload).$(PackageVersionForWorkloadManifests).nupkg"
69-
Project="$(InstallerProjectRoot)pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.sfxproj"
70-
Dependencies="$(_DefaultRuntimePackNuGetPath)"
71-
Properties="@(_DefaultPropsForNuGetBuild, ';');MonoWasmBuildVariant=%(_BuildVariants.Identity)"
72-
Descriptor="runtime pack for %(_BuildVariants.Identity)"
73-
Condition="'%(_BuildVariants.Identity)' != ''"/>
74-
75-
<!-- add for non-threaded runtime also -->
76-
<_NuGetsToBuild Include="$(LibrariesShippingPackagesDir)Microsoft.NETCore.App.Runtime.Mono.$(RIDForWorkload).$(PackageVersionForWorkloadManifests).nupkg"
70+
<_NuGetsToBuild Include="$(_DefaultRuntimePackNuGetPath)"
7771
Project="$(InstallerProjectRoot)pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.sfxproj"
78-
Properties="@(_DefaultPropsForNuGetBuild, ';');MonoWasmBuildVariant="
7972
Dependencies="$(_DefaultRuntimePackNuGetPath)"
80-
Descriptor="single threaded runtime pack"
81-
Condition="'$(_DefaultBuildVariant)' != '.'" />
73+
Properties="@(_DefaultPropsForNuGetBuild, ';');WasmEnableThreads=$(WasmEnableThreads)"
74+
Descriptor="$(_Descriptor)"/>
8275
</ItemGroup>
8376

8477
<Message

src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
<PropertyGroup Condition="'$(MonoAOTEnableLLVM)' == 'true' and '$(RuntimeFlavor)' == 'Mono' and '$(TargetsMobile)' != 'true'">
3333
<RuntimeSpecificFrameworkSuffix>Mono.LLVM.AOT</RuntimeSpecificFrameworkSuffix>
3434
</PropertyGroup>
35-
<PropertyGroup Condition="'$(MonoWasmBuildVariant)' != ''">
36-
<RuntimeSpecificFrameworkSuffix>Mono.$(MonoWasmBuildVariant)</RuntimeSpecificFrameworkSuffix>
35+
<PropertyGroup Condition="'$(WasmEnableThreads)' == 'true'">
36+
<RuntimeSpecificFrameworkSuffix>Mono.multithread</RuntimeSpecificFrameworkSuffix>
3737
</PropertyGroup>
3838
<PropertyGroup Condition="'$(RuntimeSpecificFrameworkSuffix)' != ''">
3939
<OverridePackageId>$(SharedFrameworkName).Runtime.$(RuntimeSpecificFrameworkSuffix).$(RuntimeIdentifier)</OverridePackageId>

src/libraries/Common/src/Interop/Browser/Interop.Runtime.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ internal static unsafe partial class Runtime
2727
public static extern void DeregisterGCRoot(nint handle);
2828
#endif
2929

30-
#if FEATURE_WASM_THREADS
30+
#if FEATURE_WASM_MANAGED_THREADS
3131
[MethodImpl(MethodImplOptions.InternalCall)]
3232
public static extern void InstallWebWorkerInterop(nint proxyContextGCHandle);
3333
[MethodImpl(MethodImplOptions.InternalCall)]

src/libraries/System.Diagnostics.Tracing/src/System.Diagnostics.Tracing.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<UseCompilerGeneratedDocXmlFile>false</UseCompilerGeneratedDocXmlFile>
77
</PropertyGroup>
88

9-
<PropertyGroup Condition="'$(MonoWasmBuildVariant)' == 'multithread'">
9+
<PropertyGroup Condition="'$(WasmEnableThreads)' == 'true'">
1010
<!-- when wasm threading is enabled the implementation in CoreLib won't have the UnsupportedOSAttribute for browser,
1111
but this contract still does since we only expose the wasm threading through System.Diagnostics.Tracing.WebAssembly.PerfTracing
1212
so we need to baseline the ApiCompat errors related to that -->

src/libraries/System.Linq.Parallel/src/System.Linq.Parallel.csproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework Condition="'$(MonoWasmBuildVariant)' != 'multithread'">$(NetCoreAppCurrent)</TargetFramework>
5-
<TargetFrameworks Condition="'$(MonoWasmBuildVariant)' == 'multithread'">$(NetCoreAppCurrent);$(NetCoreAppCurrent)-browser</TargetFrameworks>
4+
<TargetFramework Condition="'$(WasmEnableThreads)' != 'true'">$(NetCoreAppCurrent)</TargetFramework>
5+
<TargetFrameworks Condition="'$(WasmEnableThreads)' == 'true'">$(NetCoreAppCurrent);$(NetCoreAppCurrent)-browser</TargetFrameworks>
66
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
77
<UseCompilerGeneratedDocXmlFile>false</UseCompilerGeneratedDocXmlFile>
88
</PropertyGroup>
99
<PropertyGroup>
1010
<TargetPlatformIdentifier>$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)'))</TargetPlatformIdentifier>
11-
<FeatureWasmThreads Condition="'$(TargetPlatformIdentifier)' == 'browser' and '$(MonoWasmBuildVariant)' == 'multithread'">true</FeatureWasmThreads>
12-
<DefineConstants Condition="'$(FeatureWasmThreads)' == 'true'" >$(DefineConstants);FEATURE_WASM_THREADS</DefineConstants>
11+
<FeatureWasmManagedThreads Condition="'$(TargetPlatformIdentifier)' == 'browser' and '$(WasmEnableThreads)' == 'true'">true</FeatureWasmManagedThreads>
12+
<DefineConstants Condition="'$(FeatureWasmManagedThreads)' == 'true'" >$(DefineConstants);FEATURE_WASM_MANAGED_THREADS</DefineConstants>
1313
</PropertyGroup>
1414
<!-- Compiled Source Files -->
1515
<ItemGroup>
@@ -158,8 +158,8 @@
158158
<Reference Include="System.Diagnostics.Tracing" />
159159
<Reference Include="System.Linq" />
160160
<Reference Include="System.Runtime" />
161-
<Reference Include="System.Threading" Condition="'$(MonoWasmBuildVariant)' != 'multithread'" />
162-
<ProjectReference Include="$(LibrariesProjectRoot)System.Threading.WebAssembly.Threading\ref\System.Threading.WebAssembly.Threading.csproj" Condition="'$(MonoWasmBuildVariant)' == 'multithread'" />
161+
<Reference Include="System.Threading" Condition="'$(WasmEnableThreads)' != 'true'" />
162+
<ProjectReference Include="$(LibrariesProjectRoot)System.Threading.WebAssembly.Threading\ref\System.Threading.WebAssembly.Threading.csproj" Condition="'$(WasmEnableThreads)' == 'true'" />
163163
</ItemGroup>
164164

165165
</Project>

src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/Channels/AsynchronousChannel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace System.Linq.Parallel
1717
/// This is a bounded channel meant for single-producer/single-consumer scenarios.
1818
/// </summary>
1919
/// <typeparam name="T">Specifies the type of data in the channel.</typeparam>
20-
#if !FEATURE_WASM_THREADS
20+
#if !FEATURE_WASM_MANAGED_THREADS
2121
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
2222
#endif
2323
internal sealed class AsynchronousChannel<T> : IDisposable

0 commit comments

Comments
 (0)