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

Enable WebNN GPU backend #181

Merged
merged 1 commit into from
Sep 25, 2023
Merged

Conversation

Honry
Copy link
Collaborator

@Honry Honry commented Sep 21, 2023

No description provided.

@Honry
Copy link
Collaborator Author

Honry commented Sep 21, 2023

@huningxin, @BruceDai, PTAL, thanks!

cc/ @mingmingtasd

Copy link
Contributor

@BruceDai BruceDai left a comment

Choose a reason for hiding this comment

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

Thanks @Honry for this enabling, LGTM.

@@ -310,7 +310,7 @@ async function main() {
// UI shows model loading progress
await ui.showProgressComponent('current', 'pending', 'pending');
console.log('- Loading weights... ');
const contextOptions = {deviceType};
const contextOptions = {'devicePreference': deviceType};
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, since there's a Chromium issue - Cannot test Web Neural Network API (WebNN) by specified device type , here should use devicePreference option which is align with MLContextOptions of Model Loader API Spec to test GPU device.

@huningxin
Copy link
Contributor

@Honry , thanks for the PR! May I know what is the UX if user click "WebNN GPU" but browser doesn't support that?

@Honry
Copy link
Collaborator Author

Honry commented Sep 22, 2023

Only "Not implemented" error, which is the error message of graph build fail threw by Chromium. This could be improved. :)

image

@huningxin
Copy link
Contributor

Only "Not implemented" error, which is the error message of graph build fail threw by Chromium. This could be improved. :)

That's fine at the current stage. Please a Chromium implementation (CL-4814277) is moving the backend creation during context creation. It would allow the sample to detect the unsupported error before downloading the model.

@ibelem
Copy link
Contributor

ibelem commented Sep 25, 2023

LGTM, thanks @Honry !

@Honry
Copy link
Collaborator Author

Honry commented Sep 25, 2023

Thanks all, merging.

@Honry Honry merged commit c8a751c into webmachinelearning:master Sep 25, 2023
3 checks passed
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.

4 participants