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

[WIP] WebGPU EP [skip ci] #21904

Draft
wants to merge 94 commits into
base: main
Choose a base branch
from
Draft

[WIP] WebGPU EP [skip ci] #21904

wants to merge 94 commits into from

Conversation

fs-eire
Copy link
Contributor

@fs-eire fs-eire commented Aug 28, 2024

Description

For code review purpose only. Offer a place for discussion.

see also:

prerequisite:

related changes:

TODO items

  • Validation Switch (allows to change the behavior of whether perform specific validation checks)
  • pushErrorScope/popErrorScope
  • Graph Capture
  • Profiling supported by WebGPU Query Buffer
  • WebGPU resources tracking (mainly for buffers)
  • Global hanlders( unhandled exceptions and device lost )

*
* \since Version 1.20.
*/
ORT_API2_STATUS(SessionOptionsAppendExecutionProvider_WGPU,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the generic SessionOptionsAppendExecutionProvider is preferred over adding EP specific functions

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have any suggestions if I want to use the generic SessionOptionsAppendExecutionProvider with passing pointer (void*)?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A void* is just a number for the address so could you pass the address of the OrtWGPUProviderOptions instance?

Not quite as pure but the advantage of that is you don't need to expose a new function via all the ORT language bindings (which would be C#, Objective-C and Java for mobile).

But that said, why do the various handles have to be created outside of the EP and passed in vs the EP being passed the info to create them. I would think that would be easier to use from other languages,otherwise you're going to have to document how to create OrtWGPUProviderOptions in all those languages.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A void* is just a number for the address so could you pass the address of the OrtWGPUProviderOptions instance?

It's the same question. "How to pass a pointer to SessionOptionsAppendExecutionProvider" still need to answered.

Not quite as pure but the advantage of that is you don't need to expose a new function via all the ORT language bindings (which would be C#, Objective-C and Java for mobile).

But that said, why do the various handles have to be created outside of the EP and passed in vs the EP being passed the info to create them. I would think that would be easier to use from other languages,otherwise you're going to have to document how to create OrtWGPUProviderOptions in all those languages.

From my understanding, there is not going to be use case of passing any pointers through language bindings. The only use case (MSEdge) with passing pointers is to static link ORT and use C-API, which requires at least to pass the pointer of dawn_proc_table. So, I am totally fine with using SessionOptionsAppendExecutionProvider everywhere else with string-to-string kvp except a minimal change in C-API to enable the scenario above.

BTW, there is a seperate PR for the API change only -> #21838. Further discussion can be done there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants