-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Mark PLINQ as enabled in WASM and make browser compat changes #58227
Conversation
Tagging subscribers to this area: @tarekgh, @dotnet/area-system-linq-parallel Issue DetailsThis PR enables PLINQ for wasm and makes adjustments to avoid hitting threading code while in the browser, and ideally will fix #43752
|
Tagging subscribers to 'arch-wasm': @lewing Issue DetailsThis PR enables PLINQ for wasm and makes adjustments to avoid hitting threading code while in the browser, and ideally will fix #43752
|
you'll need to remove the exclusion from src/libraries/tests.proj to get them to run in ci |
for (int i = 0; i < locks.Length; i++) | ||
{ | ||
lock (locks[i]) | ||
if (!OperatingSystem.IsBrowser()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed to actually fix something, or is it here just to silence the analyzer?
I'm not excited at the idea of sprinkling these conditions through the bowels of the PLINQ code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's protecting the synchronization API from being called, since it won't work in the browser, and satisfying the analyzer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are any locks being created in the first place?
The PLINQ code base is insanely complicated. I'm worried that we're sprinkling around these IsBrowser checks, both complicating the code in general and also potentially missing something of relevance to the browser.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you would prefer that I reimplement all the relevant classes, I can do that. There's a lot of threading baked directly into the PLINQ primitives.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stephentoub The code now uses a SinglePartitionMode
helper property that acts as a [SupportedOSPlatformGuard("browser")]
. It results in the same amount of logic branch sprinkling, but it's now more expressive.
Does this address your concerns?
src/libraries/System.Linq.Parallel/src/System/Linq/ParallelEnumerable.cs
Outdated
Show resolved
Hide resolved
…merable.cs Co-authored-by: Jeff Handley <[email protected]>
This PR enables PLINQ for wasm and makes adjustments to avoid hitting threading code while in the browser, and ideally will fix #43752