Skip to content

Implement WebGPU async pipeline creation #31591

Closed

Description

@gterzian

Spec: https://gpuweb.github.io/gpuweb/#async-pipeline-creation
Stubs: #31194

How to do it:

  1. Store the promise on the device(here). Perhaps using a map of compute pipeline id to promise.
  2. Resolve the promise in handle_server_msg

Activity

  1. added
    A-content/script
    A-content/webgpu
    on Mar 8, 2024
  2. gterzian commented on Mar 8, 2024

    @gterzian
    MemberAuthor
  3. sandeepB3 commented on Mar 8, 2024

    @sandeepB3
    Contributor

    Hey @gterzian, can I give this issue a try?

    So elaborating on what you said, we are looking to create a mapping of (id, promise) inside pub struct GPUDevice, then we can use this map in fn CreateComputePipelineAsync to store the promise and pipeline id, once the mapping is done, we can send a async request to the server along with the pipeline id to create the compute pipeline.

    Then when the server responds the fn handle_server_msg comes into play, where we can have a new variant WebGPUOpResult::PipelineCreationResult to handle results related to async pipeline creation, where the mapping and pipeline id is used to retrieve the promise and then it is either resolved or rejected. Is this what is expected?

  4. sandeepB3 commented on Mar 11, 2024

    @sandeepB3
    Contributor

    Hey @sagudev, are you still working on this draft: #31194 ?

  5. sagudev commented on Mar 11, 2024

    @sagudev
    Member

    #31194 is now testing field for #31397, it's actually finished but it also includes CTS refresh and expectation stabilization (which actually works pretty well except for webgpu:shader,execution,expression tests that are still flaky).

    Maybe it would make sense to land it just for partial CTS stabilization @gterzian?

  6. gterzian commented on Mar 11, 2024

    @gterzian
    MemberAuthor

    to land it

    Which PR do you mean? If you mean #31194 yes I think it's a good idea, also because it makes it possible to start working on this issue.

  7. anamansari062 commented on Mar 30, 2024

    @anamansari062

    @gterzian Can I work on this issue?

  8. gterzian commented on Apr 1, 2024

    @gterzian
    MemberAuthor

    @anamansari062 I think this one is doable as a first issue. Does the above description feel like it is giving you enough information? If not, I would look for an issue with a B-newcomer tag.

  9. anamansari062 commented on Apr 1, 2024

    @anamansari062

    @gterzian It is doable. I have one question: what do you mean by store the promise?
    a. Store it in struct GPUDevice
    b. Create a new struct for it

  10. gterzian commented on Apr 2, 2024

    @gterzian
    MemberAuthor

    @anamansari062 (also @sandeepB3 , sorry I missed your earleir message) I had another look and I think this is not a good first issue, because the GPUDevice is not plugged-in yet into the IPC messaging using AsyncWGPUListener, which I thought it was via the handle_server_msg method(but it seems that method is only used to synchronously report errors, for example here).

    Also, doing this would require more than just storing the promise and later resolving it: it would likely also require storing additional info, and also making changes to the backend component at component/webgpu to send back additional info in the response message. What "additional info" means would require some looking into, I would say at least the "pipeline id" to match a given pending promise resolution pipeline to an incoming response to be handled. That additional data would then have to be part of the response, probably via a nested enum at WebGPUOpResult.

    So in other words, this would be quite a little project requiring some research and taking additional decisions based on what one finds.

  11. sagudev commented on Jun 20, 2024

    @sagudev
    Member

    Ah, I think I got it, non async versions just returns pipeline objects (and in parallel runs actual creation in wgpu thread), async versions should just await for the creation to finish and then resolve promise, based on that. There is no need to store promise in device struct as this is abstracted via response_async that we should use. I will probably deal with it with new passes changes.

  12. self-assigned this
    on Jun 23, 2024
  13. moved this from To do to Done in WebGPUon Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-content/scriptA-content/webgpu

Type

No type

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions