fix(core-remote)!: Opt Global out of Send and Sync - #10180
ErichDonGubler wants to merge 4 commits into
Conversation
sagudev
left a comment
There was a problem hiding this comment.
Now that Global is only intended to be consumed by downstreams who will be using from a single thread, we'd like to be conservative with what we promise for it. Opt out of Send and Sync for Global by adding a PhantomData<*const ()> member for it.
I understand why one would want assert_impl_any!(_: Send, Sync) (to ensure we do not break anything if someone relied on it). But I fail to see why anybody would want to conserve !Send and !Sync. Currently it just allows us to make more optimal code, but that does not need to hold true in the future. I do not see any harm if Global would get Send&Sync back "by accident" in the future.
There was a problem hiding this comment.
Are these changes intended to be here?
There was a problem hiding this comment.
Yes, because we should no longer need them. I suppose I should break this out into a separate commit, explaining why it's relevant. Will do that shortly.
There was a problem hiding this comment.
Ah, actually, maybe these hunks should move to #10177?
That would make more sense to me rather than having them here as this PR does nothing wgc/wgpu otherwise.
I agree that the question of whether |
856f975 to
acca0e2
Compare
|
Aha, so this is some kind of future proofing. If in the future it would become Send/Sync again we would also be close to recursion limit again. |
f809654 to
6be84b7
Compare
|
Rebased to resolve conflicts. |
6be84b7 to
4630438
Compare
cwfitzgerald
left a comment
There was a problem hiding this comment.
One note that CI is mad about, but then LGTM.
4630438 to
fa509e0
Compare
Now that we force the compiler to eagerly evaluate `Send + Sync` for types that have had problems with `recursion_limit`s, we should be able to use the compiler's defaults. Remove the attributes raising the default. Co-authored-by: Nazar Mokrynskyi <nazar@mokrynskyi.com>
fa509e0 to
8f774a7
Compare
|
I'm not sure why Miri is failing now. This should only simplify the amount of work the compiler has to do. I wonder what I'm missing…and wish I could prioritize this sort of change this week. 😩 |
|
The compiler still has to try evaluating the auto trait requirement. Does it make any difference if the |
|
The error now is on a different type: This one I think showed up later, not at the same time that we started having problems (could be due to further compiler changes, could be due to our type becoming more complex), and unlike |
Connections
SendandSyncfor other types in Explicitly implementSendandSyncfor allwgpudispatch types. #10177.Description
Now that
Globalis only intended to be consumed by downstreams who will be using from a single thread, we'd like to be conservative with what we promise for it. Opt out ofSendandSyncforGlobalby adding aPhantomData<*const ()>member for it.N.B. that this also includes the replacement of an NBSP, lifted from @nazar-pc's contribution in #9953 (which ended up being retarget to
v30instead oftrunk).Testing
An according
assert_not_impl_any!(…)call has been added towgpu-core-remote.Squash or Rebase? Rebase.
Checklist
WebGPU implementations built withNot at all.wgpumay be affected behaviorally.Validation and feature gates are in place to confine behavioral changes.None needed.TypicalCHANGELOG.mdentries for the user-facing effects of this change are present.wgpudownstreams won't useGlobalany more, so I didn't add an entry.