From 91942dd1e12a6591f4d1a65c4bc4a0ff51e2ecbd Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Thu, 2 Nov 2023 17:49:45 +0100 Subject: [PATCH 1/7] wip --- .../src/System.Linq.Parallel.csproj | 7 ++- .../src/System/Linq/ParallelEnumerable.cs | 4 ++ .../System.Threading.Tasks.Parallel.csproj | 6 ++- .../src/System/Threading/Tasks/Parallel.cs | 4 ++ .../System/Threading/Tasks/TaskReplicator.cs | 2 + .../tests/ParallelForEachAsyncTests.cs | 44 ------------------- .../tests/ParallelForTests.cs | 13 ------ .../tests/ParallelLoopResultTests.cs | 1 - .../tests/RangePartitioner1Chunk.cs | 2 - .../tests/RangePartitionerTests.cs | 1 - 10 files changed, 21 insertions(+), 63 deletions(-) diff --git a/src/libraries/System.Linq.Parallel/src/System.Linq.Parallel.csproj b/src/libraries/System.Linq.Parallel/src/System.Linq.Parallel.csproj index dc8a4cd971b57e..af337bc39dd611 100644 --- a/src/libraries/System.Linq.Parallel/src/System.Linq.Parallel.csproj +++ b/src/libraries/System.Linq.Parallel/src/System.Linq.Parallel.csproj @@ -5,7 +5,12 @@ true false - + + $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) + true + $(DefineConstants);FEATURE_WASM_THREADS + + diff --git a/src/libraries/System.Linq.Parallel/src/System/Linq/ParallelEnumerable.cs b/src/libraries/System.Linq.Parallel/src/System/Linq/ParallelEnumerable.cs index 1da235729da749..0552ded75cb5f2 100644 --- a/src/libraries/System.Linq.Parallel/src/System/Linq/ParallelEnumerable.cs +++ b/src/libraries/System.Linq.Parallel/src/System/Linq/ParallelEnumerable.cs @@ -64,8 +64,12 @@ public static class ParallelEnumerable // When running in single partition mode, PLINQ operations will occur on a single partition and will not // be executed in parallel, but will retain PLINQ semantics (exceptions wrapped as aggregates, etc). +#if !FEATURE_WASM_THREADS [System.Runtime.Versioning.SupportedOSPlatformGuard("browser")] internal static bool SinglePartitionMode => OperatingSystem.IsBrowser(); +#else + internal static bool SinglePartitionMode => false; +#endif //----------------------------------------------------------------------------------- // Converts any IEnumerable into something that can be the target of parallel diff --git a/src/libraries/System.Threading.Tasks.Parallel/src/System.Threading.Tasks.Parallel.csproj b/src/libraries/System.Threading.Tasks.Parallel/src/System.Threading.Tasks.Parallel.csproj index 7272b6a3d1b009..8d96b68a876420 100644 --- a/src/libraries/System.Threading.Tasks.Parallel/src/System.Threading.Tasks.Parallel.csproj +++ b/src/libraries/System.Threading.Tasks.Parallel/src/System.Threading.Tasks.Parallel.csproj @@ -5,7 +5,11 @@ true false - + + $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) + true + $(DefineConstants);FEATURE_WASM_THREADS + diff --git a/src/libraries/System.Threading.Tasks.Parallel/src/System/Threading/Tasks/Parallel.cs b/src/libraries/System.Threading.Tasks.Parallel/src/System/Threading/Tasks/Parallel.cs index 1ada79b833a11a..c08d76b8927c25 100644 --- a/src/libraries/System.Threading.Tasks.Parallel/src/System/Threading/Tasks/Parallel.cs +++ b/src/libraries/System.Threading.Tasks.Parallel/src/System/Threading/Tasks/Parallel.cs @@ -238,8 +238,12 @@ public static void Invoke(ParallelOptions parallelOptions, params Action[] actio { // If we've gotten this far, it's time to process the actions. +#if !FEATURE_WASM_THREADS // Web browsers need special treatment that is implemented in TaskReplicator if (OperatingSystem.IsBrowser() || +#else + if ( +#endif // This is more efficient for a large number of actions, or for enforcing MaxDegreeOfParallelism: (actionsCopy.Length > SMALL_ACTIONCOUNT_LIMIT) || (parallelOptions.MaxDegreeOfParallelism != -1 && parallelOptions.MaxDegreeOfParallelism < actionsCopy.Length) diff --git a/src/libraries/System.Threading.Tasks.Parallel/src/System/Threading/Tasks/TaskReplicator.cs b/src/libraries/System.Threading.Tasks.Parallel/src/System/Threading/Tasks/TaskReplicator.cs index 28287184542b39..eb09ba672f4239 100644 --- a/src/libraries/System.Threading.Tasks.Parallel/src/System/Threading/Tasks/TaskReplicator.cs +++ b/src/libraries/System.Threading.Tasks.Parallel/src/System/Threading/Tasks/TaskReplicator.cs @@ -131,6 +131,7 @@ public static void Run(ReplicatableUserAction action, ParallelOp { // Browser hosts do not support synchronous Wait so we want to run the // replicated task directly instead of going through Task infrastructure +#if !FEATURE_WASM_THREADS if (OperatingSystem.IsBrowser()) { // Since we are running on a single thread, we don't want the action to time out @@ -142,6 +143,7 @@ public static void Run(ReplicatableUserAction action, ParallelOp throw new Exception("Replicated tasks cannot yield in this single-threaded browser environment"); } else +#endif { int maxConcurrencyLevel = (options.EffectiveMaxConcurrencyLevel > 0) ? options.EffectiveMaxConcurrencyLevel : int.MaxValue; diff --git a/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelForEachAsyncTests.cs b/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelForEachAsyncTests.cs index fbcbdc87f1931c..77c16ddd72c928 100644 --- a/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelForEachAsyncTests.cs +++ b/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelForEachAsyncTests.cs @@ -293,7 +293,6 @@ static IEnumerable IterateUntilSet(StrongBox box) } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public async Task Dop_NegativeTaskSchedulerLimitTreatedAsDefault_Async() { static async IAsyncEnumerable IterateUntilSet(StrongBox box) @@ -328,7 +327,6 @@ static async IAsyncEnumerable IterateUntilSet(StrongBox box) } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public async Task RunsAsynchronously_For() { var cts = new CancellationTokenSource(); @@ -342,7 +340,6 @@ public async Task RunsAsynchronously_For() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public async Task RunsAsynchronously_EvenForEntirelySynchronousWork_Sync() { static IEnumerable Iterate() @@ -361,7 +358,6 @@ static IEnumerable Iterate() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public async Task RunsAsynchronously_EvenForEntirelySynchronousWork_Async() { #pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously @@ -382,7 +378,6 @@ static async IAsyncEnumerable IterateAsync() } [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] [InlineData(-1)] [InlineData(1)] [InlineData(2)] @@ -422,7 +417,6 @@ static async IAsyncEnumerable IterateUntilSetAsync(StrongBox box) } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public void EmptyRange_For() { int counter = 0; @@ -437,7 +431,6 @@ public void EmptyRange_For() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public async Task EmptySource_Sync() { int counter = 0; @@ -451,7 +444,6 @@ await Parallel.ForEachAsync(Enumerable.Range(0, 0), (item, cancellationToken) => } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public async Task EmptySource_Async() { int counter = 0; @@ -465,7 +457,6 @@ await Parallel.ForEachAsync(EnumerableRangeAsync(0, 0), (item, cancellationToken } [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] [InlineData(false)] [InlineData(true)] public async Task AllItemsEnumeratedOnce_For(bool yield) @@ -511,7 +502,6 @@ await Parallel.ForAsync(T.CreateTruncating(Start), T.CreateTruncating(Start + Co } [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] [InlineData(false)] [InlineData(true)] public async Task AllItemsEnumeratedOnce_Sync(bool yield) @@ -542,7 +532,6 @@ await Parallel.ForEachAsync(Enumerable.Range(Start, Count), async (item, cancell } [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] [InlineData(false)] [InlineData(true)] public async Task AllItemsEnumeratedOnce_Async(bool yield) @@ -573,7 +562,6 @@ await Parallel.ForEachAsync(EnumerableRangeAsync(Start, Count, yield), async (it } [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] [InlineData(false)] [InlineData(true)] public async Task TaskScheduler_AllCodeExecutedOnCorrectScheduler_For(bool defaultScheduler) @@ -602,7 +590,6 @@ public async Task TaskScheduler_AllCodeExecutedOnCorrectScheduler_For(bool defau } [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] [InlineData(false)] [InlineData(true)] public async Task TaskScheduler_AllCodeExecutedOnCorrectScheduler_Sync(bool defaultScheduler) @@ -641,7 +628,6 @@ IEnumerable Iterate() } [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] [InlineData(false)] [InlineData(true)] public async Task TaskScheduler_AllCodeExecutedOnCorrectScheduler_Async(bool defaultScheduler) @@ -681,7 +667,6 @@ async IAsyncEnumerable Iterate() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public async Task Cancellation_CancelsIterationAndReturnsCanceledTask_For() { using var cts = new CancellationTokenSource(10); @@ -714,7 +699,6 @@ static async IAsyncEnumerable Infinite() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public async Task Cancellation_CancelsIterationAndReturnsCanceledTask_Async() { static async IAsyncEnumerable InfiniteAsync() @@ -736,7 +720,6 @@ static async IAsyncEnumerable InfiniteAsync() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public async Task Cancellation_CorrectTokenPassedToAsyncEnumerator() { static async IAsyncEnumerable YieldTokenAsync([EnumeratorCancellation] CancellationToken cancellationToken) @@ -753,7 +736,6 @@ await Parallel.ForEachAsync(YieldTokenAsync(default), (item, cancellationToken) } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public async Task Cancellation_SameTokenPassedToEveryInvocation_For() { var cq = new ConcurrentQueue(); @@ -769,7 +751,6 @@ await Parallel.ForAsync(1, 101, async (item, cancellationToken) => } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public async Task Cancellation_SameTokenPassedToEveryInvocation_Sync() { var cq = new ConcurrentQueue(); @@ -785,7 +766,6 @@ await Parallel.ForEachAsync(Enumerable.Range(1, 100), async (item, cancellationT } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public async Task Cancellation_SameTokenPassedToEveryInvocation_Async() { var cq = new ConcurrentQueue(); @@ -801,7 +781,6 @@ await Parallel.ForEachAsync(EnumerableRangeAsync(1, 100), async (item, cancellat } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public async Task Cancellation_HasPriorityOverExceptions_For() { var tcs = new TaskCompletionSource(); @@ -828,7 +807,6 @@ public async Task Cancellation_HasPriorityOverExceptions_For() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public async Task Cancellation_HasPriorityOverExceptions_Sync() { static IEnumerable Iterate() @@ -861,7 +839,6 @@ static IEnumerable Iterate() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public async Task Cancellation_HasPriorityOverExceptions_Async() { static async IAsyncEnumerable Iterate() @@ -898,7 +875,6 @@ static async IAsyncEnumerable Iterate() } [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] [InlineData(false)] [InlineData(true)] public async Task Cancellation_FaultsForOceForNonCancellation_For(bool internalToken) @@ -915,7 +891,6 @@ public async Task Cancellation_FaultsForOceForNonCancellation_For(bool internalT } [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] [InlineData(false)] [InlineData(true)] public async Task Cancellation_FaultsForOceForNonCancellation(bool internalToken) @@ -942,7 +917,6 @@ static async IAsyncEnumerable Iterate() } [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] [InlineData(0, 4)] [InlineData(1, 4)] [InlineData(2, 4)] @@ -975,7 +949,6 @@ public async Task Cancellation_InternalCancellationExceptionsArentFilteredOut_Fo } [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] [InlineData(0, 4)] [InlineData(1, 4)] [InlineData(2, 4)] @@ -1008,7 +981,6 @@ public async Task Cancellation_InternalCancellationExceptionsArentFilteredOut(in } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public void Exception_FromGetEnumerator_Sync() { Task t = Parallel.ForEachAsync((IEnumerable)new ThrowsFromGetEnumerator(), (item, cancellationToken) => default); @@ -1018,7 +990,6 @@ public void Exception_FromGetEnumerator_Sync() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public void Exception_FromGetEnumerator_Async() { Task t = Parallel.ForEachAsync((IAsyncEnumerable)new ThrowsFromGetEnumerator(), (item, cancellationToken) => default); @@ -1028,7 +999,6 @@ public void Exception_FromGetEnumerator_Async() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public void Exception_NullFromGetEnumerator_Sync() { Task t = Parallel.ForEachAsync((IEnumerable)new ReturnsNullFromGetEnumerator(), (item, cancellationToken) => default); @@ -1038,7 +1008,6 @@ public void Exception_NullFromGetEnumerator_Sync() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public void Exception_NullFromGetEnumerator_Async() { Task t = Parallel.ForEachAsync((IAsyncEnumerable)new ReturnsNullFromGetEnumerator(), (item, cancellationToken) => default); @@ -1048,7 +1017,6 @@ public void Exception_NullFromGetEnumerator_Async() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public async Task Exception_FromMoveNext_Sync() { static IEnumerable Iterate() @@ -1069,7 +1037,6 @@ static IEnumerable Iterate() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public async Task Exception_FromMoveNext_Async() { static async IAsyncEnumerable Iterate() @@ -1091,7 +1058,6 @@ static async IAsyncEnumerable Iterate() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public async Task Exception_FromLoopBody_For() { var barrier = new Barrier(2); @@ -1113,7 +1079,6 @@ public async Task Exception_FromLoopBody_For() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public async Task Exception_FromLoopBody_Sync() { static IEnumerable Iterate() @@ -1141,7 +1106,6 @@ static IEnumerable Iterate() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public async Task Exception_FromLoopBody_Async() { static async IAsyncEnumerable Iterate() @@ -1183,7 +1147,6 @@ static async IAsyncEnumerable Iterate() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public async Task Exception_FromDispose_Sync() { Task t = Parallel.ForEachAsync((IEnumerable)new ThrowsExceptionFromDispose(), (item, cancellationToken) => default); @@ -1192,7 +1155,6 @@ public async Task Exception_FromDispose_Sync() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public async Task Exception_FromDispose_Async() { Task t = Parallel.ForEachAsync((IAsyncEnumerable)new ThrowsExceptionFromDispose(), (item, cancellationToken) => default); @@ -1201,7 +1163,6 @@ public async Task Exception_FromDispose_Async() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public async Task Exception_FromDisposeAndCancellationCallback_Sync() { Task t = Parallel.ForEachAsync((IEnumerable)new ThrowsExceptionFromDisposeAndCancellationCallback(), (item, cancellationToken) => default); @@ -1211,7 +1172,6 @@ public async Task Exception_FromDisposeAndCancellationCallback_Sync() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public async Task Exception_FromDisposeAndCancellationCallback_Async() { Task t = Parallel.ForEachAsync((IAsyncEnumerable)new ThrowsExceptionFromDisposeAndCancellationCallback(), (item, cancellationToken) => default); @@ -1221,7 +1181,6 @@ public async Task Exception_FromDisposeAndCancellationCallback_Async() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public async Task Exception_ImplicitlyCancelsOtherWorkers_For() { await Assert.ThrowsAsync(() => Parallel.ForAsync(0, long.MaxValue, async (item, cancellationToken) => @@ -1250,7 +1209,6 @@ await Assert.ThrowsAsync(() => Parallel.ForAsync(0, long.MaxValue, as } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public async Task Exception_ImplicitlyCancelsOtherWorkers_Sync() { static IEnumerable Iterate() @@ -1356,7 +1314,6 @@ static async IAsyncEnumerable Iterate(Task signal) } [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] [InlineData(false)] [InlineData(true)] public async Task ExecutionContext_FlowsToWorkerBodies_For(bool defaultScheduler) @@ -1375,7 +1332,6 @@ await Parallel.ForAsync(0, 100, async (item, cancellationToken) => } [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] [InlineData(false)] [InlineData(true)] public async Task ExecutionContext_FlowsToWorkerBodies_Sync(bool defaultScheduler) diff --git a/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelForTests.cs b/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelForTests.cs index 39f1e2bb49822d..7ae7693fb20310 100644 --- a/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelForTests.cs +++ b/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelForTests.cs @@ -289,7 +289,6 @@ public static void RunSimpleParallelDoTest(int increms) [InlineData(1024)] [InlineData(1024 * 1024)] [InlineData(1024 * 1024 * 16)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public static void RunSimpleParallelForIncrementTest(int increms) { // Just increments a shared counter in a loop. @@ -320,7 +319,6 @@ public static void RunSimpleParallelForIncrementTest(int increms) } [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] [InlineData(-1)] [InlineData(0)] [InlineData(1)] @@ -454,7 +452,6 @@ public static void SequentialFor64ParityTest(long inclusiveFrom, long exclusiveT } [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] [InlineData(0)] [InlineData(1)] [InlineData(1024)] @@ -484,7 +481,6 @@ public static void RunSimpleParallelForeachAddTest_Enumerable(int count) } [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] [InlineData(0)] [InlineData(1)] [InlineData(1024)] @@ -515,7 +511,6 @@ public static void RunSimpleParallelForeachAddTest_List(int count) } [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] [InlineData(0)] [InlineData(1)] [InlineData(1024)] @@ -546,7 +541,6 @@ public static void RunSimpleParallelForeachAddTest_Array(int count) } [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] [InlineData(0)] [InlineData(1)] [InlineData(1024)] @@ -578,7 +572,6 @@ public static void RunSimpleParallelForAverageAggregation(int count) } [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] [InlineData(0)] [InlineData(1)] [InlineData(1024)] @@ -718,7 +711,6 @@ public static void TestParallelForDOP() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public static void TestParallelForPaths() { int loopsize = 1000; @@ -880,7 +872,6 @@ public static void TestParallelForPaths() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public static void TestParallelForPaths_Exceptions() { int loopsize = 1000; @@ -1120,7 +1111,6 @@ public static void TestInvokeDOPAndCancel() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public static void RunParallelLoopCancellationTests() { int counter = 0; // Counts the actual number of iterations @@ -1255,7 +1245,6 @@ private static void VerifyCancelTestState( } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public static void CancelForIntTest() { for (int i = 0; i < 100; ++i) @@ -1290,7 +1279,6 @@ public static void CancelForIntTest() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public static void CancelForLongTest() { for (int i = 0; i < 100; ++i) @@ -1332,7 +1320,6 @@ public static IEnumerable CancelForEachTest_MemberData() } [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91538", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] [MemberData(nameof(CancelForEachTest_MemberData))] public static void CancelForEachTest(IEnumerable enumerable) { diff --git a/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelLoopResultTests.cs b/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelLoopResultTests.cs index 9006ee9469fc6e..430eabdfa01bb7 100644 --- a/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelLoopResultTests.cs +++ b/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelLoopResultTests.cs @@ -373,7 +373,6 @@ private static void OrderablePartitionerForEachPLRTest( // Perform tests on various combinations of Stop()/Break() [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91579", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public static void SimultaneousStopBreakTests() { // diff --git a/src/libraries/System.Threading.Tasks.Parallel/tests/RangePartitioner1Chunk.cs b/src/libraries/System.Threading.Tasks.Parallel/tests/RangePartitioner1Chunk.cs index 02695b75242409..b7eece1c2de61d 100644 --- a/src/libraries/System.Threading.Tasks.Parallel/tests/RangePartitioner1Chunk.cs +++ b/src/libraries/System.Threading.Tasks.Parallel/tests/RangePartitioner1Chunk.cs @@ -101,7 +101,6 @@ static void oneMoveNext(int length, bool isOrderable) /// /// [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91541", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public static void IterationsWithDependency() { static void iterationsWithDependency(int length, int dependencyIndex) @@ -167,7 +166,6 @@ public static void PFEDisposeEnum() /// Exception is expected and the enumerators are disposed /// [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91581", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public static void ExceptionOnMoveNext() { static void exceptionOnMoveNext(int length, int indexToThrow, bool isOrderable) diff --git a/src/libraries/System.Threading.Tasks.Parallel/tests/RangePartitionerTests.cs b/src/libraries/System.Threading.Tasks.Parallel/tests/RangePartitionerTests.cs index 3302c9b3b73831..87e427d0837ece 100644 --- a/src/libraries/System.Threading.Tasks.Parallel/tests/RangePartitionerTests.cs +++ b/src/libraries/System.Threading.Tasks.Parallel/tests/RangePartitionerTests.cs @@ -10,7 +10,6 @@ namespace System.Threading.Tasks.Tests public static class RangePartitionerTests { [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/91541", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public static void RunPartitionerStaticTest_SingleChunking() { CountdownEvent cde = new CountdownEvent(2); From 250d9860059cd0d30bc90cc3045c4826c5557a2b Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Fri, 3 Nov 2023 13:08:26 +0100 Subject: [PATCH 2/7] keep ActiveIssue https://github.com/dotnet/runtime/issues/91579 --- .../tests/ParallelLoopResultTests.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelLoopResultTests.cs b/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelLoopResultTests.cs index 430eabdfa01bb7..9006ee9469fc6e 100644 --- a/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelLoopResultTests.cs +++ b/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelLoopResultTests.cs @@ -373,6 +373,7 @@ private static void OrderablePartitionerForEachPLRTest( // Perform tests on various combinations of Stop()/Break() [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/91579", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public static void SimultaneousStopBreakTests() { // From 701dc8eb67cb61e515e83f67f021dad6f240852b Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Fri, 3 Nov 2023 16:43:30 +0100 Subject: [PATCH 3/7] more --- .../tests/RangePartitioner1Chunk.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/System.Threading.Tasks.Parallel/tests/RangePartitioner1Chunk.cs b/src/libraries/System.Threading.Tasks.Parallel/tests/RangePartitioner1Chunk.cs index b7eece1c2de61d..68cad75b28cef6 100644 --- a/src/libraries/System.Threading.Tasks.Parallel/tests/RangePartitioner1Chunk.cs +++ b/src/libraries/System.Threading.Tasks.Parallel/tests/RangePartitioner1Chunk.cs @@ -166,6 +166,7 @@ public static void PFEDisposeEnum() /// Exception is expected and the enumerators are disposed /// [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/91581", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public static void ExceptionOnMoveNext() { static void exceptionOnMoveNext(int length, int indexToThrow, bool isOrderable) From 8e582c7465c5e231ebc6e2580b97d3168d3ee95d Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Mon, 6 Nov 2023 09:57:05 +0100 Subject: [PATCH 4/7] more --- .../tests/System.Threading.Tasks.Parallel.Tests.csproj | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libraries/System.Threading.Tasks.Parallel/tests/System.Threading.Tasks.Parallel.Tests.csproj b/src/libraries/System.Threading.Tasks.Parallel/tests/System.Threading.Tasks.Parallel.Tests.csproj index 4be608cc6847ac..7a599ea739d7cb 100644 --- a/src/libraries/System.Threading.Tasks.Parallel/tests/System.Threading.Tasks.Parallel.Tests.csproj +++ b/src/libraries/System.Threading.Tasks.Parallel/tests/System.Threading.Tasks.Parallel.Tests.csproj @@ -6,6 +6,9 @@ + + --setenv=XHARNESS_LOG_TEST_START=true --no-memory-snapshot + From 0293b6c929ff660402a2c63019dd42d391095430 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Mon, 6 Nov 2023 12:17:10 +0100 Subject: [PATCH 5/7] more --- .../tests/RangePartitioner1Chunk.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/System.Threading.Tasks.Parallel/tests/RangePartitioner1Chunk.cs b/src/libraries/System.Threading.Tasks.Parallel/tests/RangePartitioner1Chunk.cs index 68cad75b28cef6..02695b75242409 100644 --- a/src/libraries/System.Threading.Tasks.Parallel/tests/RangePartitioner1Chunk.cs +++ b/src/libraries/System.Threading.Tasks.Parallel/tests/RangePartitioner1Chunk.cs @@ -101,6 +101,7 @@ static void oneMoveNext(int length, bool isOrderable) /// /// [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/91541", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public static void IterationsWithDependency() { static void iterationsWithDependency(int length, int dependencyIndex) From 1579352fd24c3822a41cbf52734b24a2ea1f333f Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Mon, 6 Nov 2023 14:30:01 +0100 Subject: [PATCH 6/7] more --- .../tests/RangePartitionerTests.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/System.Threading.Tasks.Parallel/tests/RangePartitionerTests.cs b/src/libraries/System.Threading.Tasks.Parallel/tests/RangePartitionerTests.cs index 87e427d0837ece..3302c9b3b73831 100644 --- a/src/libraries/System.Threading.Tasks.Parallel/tests/RangePartitionerTests.cs +++ b/src/libraries/System.Threading.Tasks.Parallel/tests/RangePartitionerTests.cs @@ -10,6 +10,7 @@ namespace System.Threading.Tasks.Tests public static class RangePartitionerTests { [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/91541", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))] public static void RunPartitionerStaticTest_SingleChunking() { CountdownEvent cde = new CountdownEvent(2); From 16c95bc58b3fbf2defd27e2d9432f36b60375b42 Mon Sep 17 00:00:00 2001 From: Pavel Savara Date: Mon, 6 Nov 2023 20:22:25 +0100 Subject: [PATCH 7/7] feedback --- .../tests/System.Threading.Tasks.Parallel.Tests.csproj | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/libraries/System.Threading.Tasks.Parallel/tests/System.Threading.Tasks.Parallel.Tests.csproj b/src/libraries/System.Threading.Tasks.Parallel/tests/System.Threading.Tasks.Parallel.Tests.csproj index 7a599ea739d7cb..4be608cc6847ac 100644 --- a/src/libraries/System.Threading.Tasks.Parallel/tests/System.Threading.Tasks.Parallel.Tests.csproj +++ b/src/libraries/System.Threading.Tasks.Parallel/tests/System.Threading.Tasks.Parallel.Tests.csproj @@ -6,9 +6,6 @@ - - --setenv=XHARNESS_LOG_TEST_START=true --no-memory-snapshot -