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

[WebNN EP] Avoid reinit JSEP #19755

Closed
wants to merge 1 commit into from
Closed

Conversation

zesongw
Copy link
Contributor

@zesongw zesongw commented Mar 4, 2024

Description

  • Change the condition to initialize JSEP.
  • Add support check for WebNN EP.

Motivation and Context

If the user creates both WebNN EP and WebGPU EP in the same scope, JSEP will be initialized twice and cause error of redefinition.

@zesongw
Copy link
Contributor Author

zesongw commented Mar 4, 2024

@fs-eire, @guschmue, PTAL, thanks!

@Honry
Copy link
Contributor

Honry commented Mar 4, 2024

Cc/ @gyagp

// perform WebGPU availability check
if (typeof navigator === 'undefined' || !navigator.gpu) {
throw new Error('WebGPU is not supported in current environment');
}
if (epName === 'webnn' && (typeof navigator === 'undefined' || !(navigator as any).ml)) {
Copy link
Contributor

@gyagp gyagp Mar 4, 2024

Choose a reason for hiding this comment

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

If epName is webnn, I'd hope all the logic related to WebGPU can be skipped. @fs-eire is working on #19735, which might be a total solution for this.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree. I checked his PR which doesn't touch the initialization of JSEP. @fs-eire, will you handle it as well? You know we are not familiar with JSEP, the logic related to WebGPU is combined quite closely with JSEP, it's complicated for us to separate them.

Copy link
Contributor

Choose a reason for hiding this comment

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

Will think about this.

Copy link
Contributor

Choose a reason for hiding this comment

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

Added support for WebNN in #19735

Copy link
Contributor

Choose a reason for hiding this comment

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

Cool! Thanks much @fs-eire. @zesongw, let's close this PR.

@zesongw zesongw closed this Mar 6, 2024
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.

None yet

4 participants