-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Remove Locking From Hot Paths #2710
Description
Is your feature request related to a problem? Please describe.
This formalizes #2272 into a issue.
Our current system takes global locks per resource. This means that if one method needs mutable access to a particular type, it needs to lock all resources of that type as mutable. Because every method needs read or write access to some resource, it's very easy to write multithreaded code that is essentially serialized.
The worst case of this is renderpass encoding. In an ideal world, this would be fully parallelizable, but currently, because of us needing a write lock, is serial.
This is one of the ways that wgpu has major disadvantages over the underlying api.
Describe the solution you'd like
We should switch to a wait free datastructure on the hot path with per-object locking or more fine grained locking.
Describe alternatives you've considered
The arcinization was another alternative, but we have shifted away from that style;