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

MLGraphBuilder.constant() should take an AllowSharedBufferSource #788

Open
a-sully opened this issue Nov 15, 2024 · 1 comment · May be fixed by #790
Open

MLGraphBuilder.constant() should take an AllowSharedBufferSource #788

a-sully opened this issue Nov 15, 2024 · 1 comment · May be fixed by #790

Comments

@a-sully
Copy link
Contributor

a-sully commented Nov 15, 2024

Currently, constant() takes an ArrayBufferView (https://www.w3.org/TR/webnn/#ref-for-dom-mlgraphbuilder-constant)

AllowSharedBufferSource is specified here as the following:

typedef (ArrayBuffer or SharedArrayBuffer or [AllowShared] ArrayBufferView) AllowSharedBufferSource;

Since this buffer data is always immediately copied (https://www.w3.org/TR/webnn/#dom-mlgraphbuilder-constant) I see no reason why we shouldn't allow passing an ArrayBuffer, SharedArrayBuffer or shared ArrayBufferView to this method, as well.

@huningxin
Copy link
Contributor

Yes, it should support SharedArrayBuffer.

The current restriction prevents a multi-threaded build of Wasm framework, e.g. ONNXRuntime Web, from passing memory views (emscripten::typed_memory_view) to MLGraphBuilder.constant(), that is unfortunate.

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 a pull request may close this issue.

2 participants