Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

WebNN/WebGPU zero-copy device selection

Open
#941 3 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
15/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
javascript

Research direction

The change belongs in the WebNN specification source, which is written in Bikeshed, and the payload names no specific file or section. Read the existing text on createContext() and exportToGPU() and the MLContextOptions definition, then decide on the proposed interopDevice hint with the maintainers named in the thread. Done means the spec defines how the device choice is made, which needs a spec-level decision rather than a small edit.

Written by the indexing model from the issue text.

Description

webgpu interop

WebNN and WebGPU select devices independently, so zero-copy interop is not guaranteed. Web developers need a reliable way to determine whether a WebNN context and GPUDevice are compatible for zero-copy.

The WebNN spec does not define how createContext() and exportToGPU() interact with device selection when both a GPUDevice and MLContextOptions (such as powerPreference) are provided.

For example, if an app passes a WebGPU GPUDevice to createContext(), zero-copy is only possible if WebNN selects that same device or a compatible one (for example, an NPU or integrated GPU sharing the same memory). Otherwise, exportToGPU() may require a copy or fail because the selected devices are incompatible.

One possible solution would be to add an { interopDevice: gpuDevice } option to createContext() as a hint for interop compatibility. If provided, WebNN would preferentially select a compatible device, allowing exportToGPU() to remain zero-copy when possible.

@reillyeon @RafaelCintron @huningxin @anssiko

Dominant language
Bikeshed
Stars
566
Forks
72
Avg merge
6d 5h
Merged PRs (30d)
1

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from webmachinelearning/webnn

All issues in webmachinelearning/webnn

Similar issues

More Machine Learning issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.