Open Bug 1878035 Opened 5 months ago Updated 2 months ago

[meta] WebGPU's remoting infrastructure

Categories

(Core :: Graphics: WebGPU, task, P2)

task

Tracking

()

People

(Reporter: nical, Unassigned)

References

Details

(Keywords: meta)

A meta-bug to track the various issues with WebGPU's remoting infrastructure and come up with long and short term plans.

Problems and motivations

IPDL

  • A lot of boilerplate is required when we use IPDL messages for specific commands. typically on the content side we cross the ffi boundary to write data into a byte buffer, then back on the C++ side we send a specific ipdl message, we have to override a C++ method to receive the message on the parent side where we then pass the ffi boundary again and call into wgpu-core.
  • IPDL messages are fairly heavy weight. For performance to scale at some point we'll need to batch commands into fewer IPC messages

Render pass encoding on the content process

  • Currently there is a piece of wgpu-core that runs on the content process to record render passes, and that is replayed on the parent process.
    • It prevents some simplifcations that we want to do in wgpu-core. The main one is that it forces wgpu-core to use IDs internally for the render pass code instead of using arcs (and only using IDs at the API boundary). That prevents us from moving the registries out of wgpu-core.
    • It complicates the recycling of IDs: at the moment one could begin a render pass, drop a texture used in the render pass, create another and finally submit the render pass. The recorded render pass contains IDs and is sent last. If dropping the texture makes the ID reusable right away, we may have allocated a new texture in the same slot by the time the render pass is replayed in the parent process and the dead texture is looked up in the registry. To mitigate that, the ID is not made reusable right away on wgpu-core. It only happens once the internal resource is entirely dropped. That's error prone (https://github.com/gfx-rs/wgpu/pull/5141 is an example of this causing hurdles). In addition gecko currently isn't notified of an ID being reusable so the slots are leaked and the allocations in registries keep growing.

Aspirations

  • No render pass recording is not run in the content process, allowing wgpu-core to remove remaining internal uses of IDs (and use Arcs instead).
  • Less of the DOM glue has to cross multiple language boundaries
  • More of the logic is in rust (especially with respect to serialization of commands).
  • Commands are batched into fewer IPDL messages
Summary: [meta] WebGPU's remoting inrfastructure → [meta] WebGPU's remoting infrastructure
Blocks: webgpu-v1
Priority: -- → P2
You need to log in before you can comment on or make changes to this bug.