Skip to content

Conversation

@radekdoulik
Copy link
Member

@radekdoulik radekdoulik commented Dec 20, 2023

Add System.Threading.WebAssembly.Threading ref assembly to enable more parts of threading API on wasm
Fix System.Linq.Parallel assembly to work as MT on wasm
Increase the initial thread pool size to 7 to let the System.Linq.Parallel tests pass

Fixes #91661

Also fix the csproj condition to detect FeatureWasmThreads
@ghost
Copy link

ghost commented Dec 20, 2023

Tagging subscribers to this area: @dotnet/area-system-linq-parallel
See info in area-owners.md if you want to be subscribed.

Issue Details

Also fix the csproj condition to set the FeatureWasmThreads correctly

Author: radekdoulik
Assignees: -
Labels:

area-System.Linq.Parallel

Milestone: -

@radekdoulik
Copy link
Member Author

This depends on another MT areas to complete, like S.T.Monitor

@radekdoulik
Copy link
Member Author

With the missing pieces in place, we pass the build.

During the test run the previously failing test passes, the next one dead locks. More to fix.

  info: [2023-12-21T16:14:44.974Z] [STRT] System.Linq.Parallel.Tests.PlinqModesTests.WithExecutionMode(labeled: ParallelEnumerable.Range, requestedDop: 4, expectedDop: 4, operation: TakeWhile+Select+ToArray, mode: Default)
  warn: Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread
  info: [2023-12-21T16:14:45.990Z] [PASS] System.Linq.Parallel.Tests.PlinqModesTests.WithExecutionMode(labeled: ParallelEnumerable.Range, requestedDop: 4, expectedDop: 4, operation: TakeWhile+Select+ToArray, mode: Default)
  info: [2023-12-21T16:14:45.991Z] [STRT] System.Linq.Parallel.Tests.PlinqModesTests.WithExecutionMode(labeled: ParallelEnumerable.Range, requestedDop: 4, expectedDop: 4, operation: TakeWhile+Select+foreach, mode: Default)

@ghost
Copy link

ghost commented Dec 24, 2023

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

Issue Details

Also fix the csproj condition to set the FeatureWasmThreads correctly

Author: radekdoulik
Assignees: radekdoulik
Labels:

arch-wasm, area-System.Linq.Parallel

Milestone: -

@radekdoulik radekdoulik changed the title [wasm] Enable more MT PLinq areas [wasm] Enable MT in S.Linq.Parallel Jan 11, 2024
@radekdoulik
Copy link
Member Author

radekdoulik commented Jan 11, 2024

Remaining work in this area, to be added in following PRs

  • throw PNSE in blocking calls on the main thread and on threads with JS interop
  • look at WithExecutionMode, where it is in one case blocking main thread
  info: [2024-01-10T15:52:42.288Z] [PASS] System.Linq.Parallel.Tests.PlinqModesTests.WithExecutionMode(labeled: Partitioner.Create, requestedDop: 1, expectedDop: 1, operation: Where+Select+ElementAt, mode: Default)
  warn: Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread
  info: [2024-01-10T15:52:43.308Z] [PASS] System.Linq.Parallel.Tests.PlinqModesTests.WithExecutionMode(labeled: ParallelEnumerable.Range, requestedDop: 4, expectedDop: 4, operation: TakeWhile+Select+ToArray, mode: Default)

@radekdoulik radekdoulik marked this pull request as ready for review January 11, 2024 12:00
@radekdoulik radekdoulik merged commit 6cd48fb into dotnet:main Jan 11, 2024
tmds pushed a commit to tmds/runtime that referenced this pull request Jan 23, 2024
Add System.Threading.WebAssembly.Threading ref assembly to enable more parts of threading API on wasm
Fix System.Linq.Parallel assembly to work as MT on wasm
Increase the initial thread pool size to 7 to let the System.Linq.Parallel tests pass

Fixes dotnet#91661

* [wasm] Enable more MT PLinq areas

Also fix the csproj condition to detect FeatureWasmThreads

* Add missing pieces

* Add System.Threading.WebAssembly.Threading.csproj

* Fix System.Threading to work with the new wasm MT ref assembly

* Enable the failing test

* Use the new ref assembly in the System.Linq.Parallel

* Remove now obsolete API check supressions

* Increase the thread pool size to make the plinq tests pass

* Add API check suppressions for System.Threading

* Always use the API suppressions for System.Threading

* Remove unwanted attributes from the implementation

* Add suppressions to corelib

* Revert "Remove unwanted attributes from the implementation"

This reverts commit aedafd3.

* Build fixes

* Remove unnecessary suppression

* Remove unwanted source file from the list
@github-actions github-actions bot locked and limited conversation to collaborators Feb 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[MT][browser] WithExecutionMode fails

3 participants