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

Expose WebNN API to shared workers and service workers #823

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ API {#api}

## The navigator.ml interface ## {#api-navigator-ml}

An {{ML}} object is available in the {{Window}} and {{DedicatedWorkerGlobalScope}} contexts through the {{Navigator}}
An {{ML}} object is available in the {{Window}} and {{WorkerGlobalScope}} contexts through the {{Navigator}}
and {{WorkerNavigator}} interfaces respectively and is exposed via `navigator.ml`.

<script type=idl>
Expand All @@ -780,7 +780,7 @@ dictionary MLContextOptions {
MLPowerPreference powerPreference = "default";
};

[SecureContext, Exposed=(Window, DedicatedWorker)]
[SecureContext, Exposed=(Window, Worker)]
interface ML {
Promise<MLContext> createContext(optional MLContextOptions options = {});
Promise<MLContext> createContext(GPUDevice gpuDevice);
Expand Down Expand Up @@ -865,7 +865,7 @@ dictionary MLContextLostInfo {
DOMString message;
};

[SecureContext, Exposed=(Window, DedicatedWorker)]
[SecureContext, Exposed=(Window, Worker)]
interface MLContext {
undefined dispatch(MLGraph graph, MLNamedTensors inputs, MLNamedTensors outputs);

Expand Down Expand Up @@ -1284,7 +1284,7 @@ A {{MLContext}} <dfn for=MLContext lt="is lost|is not lost">is lost</dfn> if its
The {{MLGraph}} interface represents a compiled computational graph. A compiled graph once constructed is immutable and cannot be subsequently changed.

<script type=idl>
[SecureContext, Exposed=(Window, DedicatedWorker)]
[SecureContext, Exposed=(Window, Worker)]
interface MLGraph {
undefined destroy();
};
Expand Down Expand Up @@ -1418,7 +1418,7 @@ An {{MLOperand}} represents an intermediary graph being constructed as a result
For instance, an {{MLOperand}} can represent a constant feeding to an operation or the result from combining multiple constants together into an operation. See also [[#programming-model]].

<script type=idl>
[SecureContext, Exposed=(Window, DedicatedWorker)]
[SecureContext, Exposed=(Window, Worker)]
interface MLOperand {
readonly attribute MLOperandDataType dataType;
readonly attribute FrozenArray<unsigned long> shape;
Expand Down Expand Up @@ -1542,7 +1542,7 @@ The {{MLTensor}} interface represents a tensor which may be used as an input or
The [=implementation-defined=] requirements of how an {{MLTensor}} is allocated may include constraints such as that the memory is allocated with a particular byte alignment or in a particular memory pool.

<script type=idl>
[SecureContext, Exposed=(Window, DedicatedWorker)]
[SecureContext, Exposed=(Window, Worker)]
interface MLTensor {
readonly attribute MLOperandDataType dataType;
readonly attribute FrozenArray<unsigned long> shape;
Expand Down Expand Up @@ -1629,7 +1629,7 @@ The {{MLGraphBuilder}} interface defines a set of operations as identified by th
<script type=idl>
typedef record<USVString, MLOperand> MLNamedOperands;

[SecureContext, Exposed=(Window, DedicatedWorker)]
[SecureContext, Exposed=(Window, Worker)]
interface MLGraphBuilder {
// Construct the graph builder from the context.
constructor(MLContext context);
Expand Down