Skip to content
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

Merged
merged 5 commits into from
Nov 22, 2021

Conversation

kg
Copy link
Member

@kg kg commented Aug 27, 2021

This PR enables PLINQ for wasm and makes adjustments to avoid hitting threading code while in the browser, and ideally will fix #43752

@ghost
Copy link

ghost commented Aug 27, 2021

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

Issue Details

This PR enables PLINQ for wasm and makes adjustments to avoid hitting threading code while in the browser, and ideally will fix #43752

Author: kg
Assignees: -
Labels:

area-System.Linq.Parallel

Milestone: -

@kg kg added the arch-wasm WebAssembly architecture label Aug 27, 2021
@ghost
Copy link

ghost commented Aug 27, 2021

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

Issue Details

This PR enables PLINQ for wasm and makes adjustments to avoid hitting threading code while in the browser, and ideally will fix #43752

Author: kg
Assignees: -
Labels:

arch-wasm, area-System.Linq.Parallel

Milestone: -

@lewing
Copy link
Member

lewing commented Aug 27, 2021

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()) {
Copy link
Member

@stephentoub stephentoub Aug 27, 2021

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.

Copy link
Member Author

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

Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

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?

@kg kg marked this pull request as ready for review August 27, 2021 22:37
@kg kg added the NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) label Aug 27, 2021
@jeffhandley jeffhandley removed the NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) label Oct 10, 2021
…merable.cs

Co-authored-by: Jeff Handley <jeffhandley@users.noreply.github.com>
@marek-safar marek-safar changed the title [draft fix for 43752] Mark PLINQ as enabled in WASM and make browser compat changes Mark PLINQ as enabled in WASM and make browser compat changes Nov 22, 2021
@marek-safar marek-safar merged commit 8daae66 into dotnet:main Nov 22, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Dec 22, 2021
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.

System.Linq.Parallel OrderedPipeliningMergeEnumerator.MoveNext is using API unsupported on browser
5 participants