Skip to content

MLTensor explainer: replace "import buffer" with "export tensor"#844

Merged
huningxin merged 2 commits intowebmachinelearning:mainfrom
bbernhar:webgpu_export
May 9, 2025
Merged

MLTensor explainer: replace "import buffer" with "export tensor"#844
huningxin merged 2 commits intowebmachinelearning:mainfrom
bbernhar:webgpu_export

Conversation

@bbernhar
Copy link
Copy Markdown
Contributor

Proposes an IDL change to reflect our current implementation for WebGPU interop. Specifically, it moves the responsibility of producing a interop GPUBuffer into WebNN.

Before

dictionary GPUImportedTensorDescriptor : GPUObjectDescriptorBase {
  required MLTensor source;
};

partial interface GPUDevice {
  Promise<GPUBuffer> importExternalBuffer(GPUImportedTensorDescriptor descriptor);
}

After

partial interface MLContext {
  Promise<GPUBuffer> exportToWebGPU(MLTensor source);
}

This change achieves the following:

  • Eliminates the need to modify (or extend) the WebGPU spec for an experimental WebNN feature.
  • Gives WebNN WG flexibility to iterate/extend the interop API along with the WebNN IDL (ex. new sources).

@bbernhar
Copy link
Copy Markdown
Contributor Author

@reillyeon @huningxin @RafaelCintron will follow up with the IDL changes but I figured we start with updating the explainer

If no blocking concerns ==👍

Comment thread mltensor-explainer.md Outdated
@bbernhar
Copy link
Copy Markdown
Contributor Author

@huningxin Feel free to merge - will follow-up with IDL changes.

@huningxin huningxin merged commit 9c6bb5b into webmachinelearning:main May 9, 2025
2 checks passed
Copy link
Copy Markdown
Collaborator

@fdwr fdwr left a comment

Choose a reason for hiding this comment

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

👍

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