Skip to content

Commit

Permalink
Merge pull request #781 from webmachinelearning/compute-deprecation-w…
Browse files Browse the repository at this point in the history
…arning

SHA: 11f85ff
Reason: push, by huningxin

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
huningxin and github-actions[bot] committed Nov 8, 2024
1 parent 1c94e49 commit 62f7146
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<link href="https://www.w3.org/StyleSheets/TR/2021/W3C-ED" rel="stylesheet">
<meta content="Bikeshed version 742f3d674, updated Mon Nov 4 14:56:54 2024 -0800" name="generator">
<link href="https://www.w3.org/TR/webnn/" rel="canonical">
<meta content="63e73b3efe12e4d6cf856e3e7d755e01aa92973d" name="revision">
<meta content="11f85ffee11c9c1adc9605b869b26b28ef3aae49" name="revision">
<meta content="dark light" name="color-scheme">
<link href="https://www.w3.org/StyleSheets/TR/2021/dark.css" media="(prefers-color-scheme: dark)" rel="stylesheet" type="text/css">
<style>
Expand Down Expand Up @@ -1852,7 +1852,8 @@ <h4 class="heading settled" data-level="7.3.1" id="mlnamedarraybufferviews-trans
</ol>
</details>
<h4 class="heading settled" data-level="7.3.2" id="api-mlcontext-compute"><span class="secno">7.3.2. </span><span class="content"><code class="idl"><a data-link-type="idl" href="#dom-mlcontext-compute" id="ref-for-dom-mlcontext-compute⑤">compute()</a></code></span><a class="self-link" href="#api-mlcontext-compute"></a></h4>
Asynchronously carries out the computational workload of a compiled graph <code class="idl"><a data-link-type="idl" href="#mlgraph" id="ref-for-mlgraph⑨">MLGraph</a></code> on a separate timeline, either on a worker thread for the CPU execution, or on a GPU/NPU timeline for submitting a workload onto the command queue. The asynchronous nature of this call avoids blocking the calling thread while the computation for result is ongoing. This method of execution requires an <code class="idl"><a data-link-type="idl" href="#mlcontext" id="ref-for-mlcontext①⑨">MLContext</a></code> created with <code class="idl"><a data-link-type="idl" href="#dictdef-mlcontextoptions" id="ref-for-dictdef-mlcontextoptions⑨">MLContextOptions</a></code>. Otherwise, it <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-throw" id="ref-for-dfn-throw">throws</a> an "<code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#operationerror" id="ref-for-operationerror②">OperationError</a></code>" <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#idl-DOMException" id="ref-for-idl-DOMException⑥">DOMException</a></code>.
<p class="issue" id="issue-f267aeab"><a class="self-link" href="#issue-f267aeab"></a> <code class="idl"><a data-link-type="idl" href="#dom-mlcontext-compute" id="ref-for-dom-mlcontext-compute⑥">compute()</a></code> will be deprecated and removed in favor of <code><a href="https://github.com/webmachinelearning/webnn/blob/main/mltensor-explainer.md#compute-vs-dispatch">dispatch()</a></code>.</p>
<p>Asynchronously carries out the computational workload of a compiled graph <code class="idl"><a data-link-type="idl" href="#mlgraph" id="ref-for-mlgraph⑨">MLGraph</a></code> on a separate timeline, either on a worker thread for the CPU execution, or on a GPU/NPU timeline for submitting a workload onto the command queue. The asynchronous nature of this call avoids blocking the calling thread while the computation for result is ongoing. This method of execution requires an <code class="idl"><a data-link-type="idl" href="#mlcontext" id="ref-for-mlcontext①⑨">MLContext</a></code> created with <code class="idl"><a data-link-type="idl" href="#dictdef-mlcontextoptions" id="ref-for-dictdef-mlcontextoptions⑨">MLContextOptions</a></code>. Otherwise, it <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-throw" id="ref-for-dfn-throw">throws</a> an "<code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#operationerror" id="ref-for-operationerror②">OperationError</a></code>" <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#idl-DOMException" id="ref-for-idl-DOMException⑥">DOMException</a></code>.</p>
<div class="note" role="note"> In accordance with the <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#arraybufferview-write" id="ref-for-arraybufferview-write">Web IDL warning</a>, to prevent the calling thread from modifying the input and output resources while the computation is ongoing, this method <a data-link-type="dfn" href="#mlnamedarraybufferviews-transfer" id="ref-for-mlnamedarraybufferviews-transfer">transfers</a> the input and output <code class="idl"><a data-link-type="idl" href="#typedefdef-mlnamedarraybufferviews" id="ref-for-typedefdef-mlnamedarraybufferviews①③">MLNamedArrayBufferViews</a></code> to new views that share the same backing memory allocations. The transferred views are returned to the caller via the promise fulfillment with the computation result written into the backing memory of the output views. </div>
<div>
<strong>Arguments:</strong>
Expand All @@ -1866,7 +1867,7 @@ <h4 class="heading settled" data-level="7.3.2" id="api-mlcontext-compute"><span
</ul>
<p><strong>Returns:</strong> <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#idl-promise" id="ref-for-idl-promise④">Promise</a></code>&lt;<code class="idl"><a data-link-type="idl" href="#dictdef-mlcomputeresult" id="ref-for-dictdef-mlcomputeresult①">MLComputeResult</a></code>>.</p>
</div>
<p class="note" role="note"><span class="marker">Note:</span> Invocations of <code class="idl"><a data-link-type="idl" href="#dom-mlcontext-compute" id="ref-for-dom-mlcontext-compute⑥">compute()</a></code> will fail if any of the <code class="idl"><a data-link-type="idl" href="#dom-mlcontext-compute-graph-inputs-outputs-graph" id="ref-for-dom-mlcontext-compute-graph-inputs-outputs-graph①">graph</a></code>'s inputs are not provided as <code class="idl"><a data-link-type="idl" href="#dom-mlcontext-compute-graph-inputs-outputs-inputs" id="ref-for-dom-mlcontext-compute-graph-inputs-outputs-inputs①">inputs</a></code>, or if any requested <code class="idl"><a data-link-type="idl" href="#dom-mlcontext-compute-graph-inputs-outputs-outputs" id="ref-for-dom-mlcontext-compute-graph-inputs-outputs-outputs①">outputs</a></code> do not match the <code class="idl"><a data-link-type="idl" href="#dom-mlcontext-compute-graph-inputs-outputs-graph" id="ref-for-dom-mlcontext-compute-graph-inputs-outputs-graph②">graph</a></code>'s outputs.</p>
<p class="note" role="note"><span class="marker">Note:</span> Invocations of <code class="idl"><a data-link-type="idl" href="#dom-mlcontext-compute" id="ref-for-dom-mlcontext-compute⑦">compute()</a></code> will fail if any of the <code class="idl"><a data-link-type="idl" href="#dom-mlcontext-compute-graph-inputs-outputs-graph" id="ref-for-dom-mlcontext-compute-graph-inputs-outputs-graph①">graph</a></code>'s inputs are not provided as <code class="idl"><a data-link-type="idl" href="#dom-mlcontext-compute-graph-inputs-outputs-inputs" id="ref-for-dom-mlcontext-compute-graph-inputs-outputs-inputs①">inputs</a></code>, or if any requested <code class="idl"><a data-link-type="idl" href="#dom-mlcontext-compute-graph-inputs-outputs-outputs" id="ref-for-dom-mlcontext-compute-graph-inputs-outputs-outputs①">outputs</a></code> do not match the <code class="idl"><a data-link-type="idl" href="#dom-mlcontext-compute-graph-inputs-outputs-graph" id="ref-for-dom-mlcontext-compute-graph-inputs-outputs-graph②">graph</a></code>'s outputs.</p>
<details class="algorithm" data-algorithm="compute(graph, inputs, outputs)" data-algorithm-for="MLContext" open>
<summary> The <dfn class="dfn-paneled idl-code" data-dfn-for="MLContext" data-dfn-type="method" data-export id="dom-mlcontext-compute"><code>compute(<var>graph</var>, <var>inputs</var>, <var>outputs</var>)</code></dfn> method steps are: </summary>
<ol>
Expand Down Expand Up @@ -11380,6 +11381,7 @@ <h2 class="no-num no-ref heading settled" id="issues-index"><span class="content
<div class="issue"> Hinting partially mitigates the concern. Investigate additional mitigations. <a class="issue-return" href="#issue-2dcd6d4c" title="Jump to section">↵</a></div>
<div class="issue"> <code class="idl"><a data-link-type="idl" href="#dictdef-mlcontextoptions">MLContextOptions</a></code> is under active development, and the design is expected to change, informed by further implementation experience and new use cases from the wider web community. <a href="https://github.com/webmachinelearning/webnn/issues/623">[Issue #623]</a> <a class="issue-return" href="#issue-bc8cc5bc" title="Jump to section">↵</a></div>
<div class="issue"> <code class="idl"><a data-link-type="idl" href="#dictdef-mlcontextoptions">MLContextOptions</a></code> is under active development, and the design is expected to change, informed by further implementation experience and new use cases from the wider web community. The Working Group is considering additional API controls to allow the definition of a fallback device, multiple devices in a preferred order, or an exclusion of a specific device. Other considerations under discussion include error handling, ultimate fallback, and quantized operators. Feedback is welcome on any of these design considerations from web developers, library authors, OS and hardware vendors, and other stakeholders via GitHub: <a href="https://github.com/webmachinelearning/webnn/issues/623">[Issue #623]</a> <a class="issue-return" href="#issue-a5abcae7" title="Jump to section">↵</a></div>
<div class="issue"> <code class="idl"><a data-link-type="idl" href="#dom-mlcontext-compute">compute()</a></code> will be deprecated and removed in favor of <code><a href="https://github.com/webmachinelearning/webnn/blob/main/mltensor-explainer.md#compute-vs-dispatch">dispatch()</a></code>. <a class="issue-return" href="#issue-f267aeab" title="Jump to section">↵</a></div>
<div class="issue"> Should 0-size dimensions be supported? <a href="https://github.com/webmachinelearning/webnn/issues/391">[Issue #391]</a> <a class="issue-return" href="#issue-f000a729" title="Jump to section">↵</a></div>
<div class="issue"> The maximum number of operand dimensions is not defined, but native ML APIs usually have a maximum supported size. <a href="https://github.com/webmachinelearning/webnn/issues/456">[Issue #456]</a> <a class="issue-return" href="#issue-8054fa8e" title="Jump to section">↵</a></div>
<div class="issue"> Support for unions of <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#idl-bigint">bigint</a></code> and <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-numeric-type">numeric types</a> is new in <a data-link-type="biblio" href="#biblio-webidl" title="Web IDL Standard">[WEBIDL]</a>, and implementation support is also limited. Prototype implementations are encouraged to provide feedback for this approach. <a href="https://github.com/whatwg/webidl/issues/1388">[Issue #whatwg/webidl#1388]</a> <a class="issue-return" href="#issue-63bb2306" title="Jump to section">↵</a></div>
Expand Down Expand Up @@ -11761,7 +11763,7 @@ <h2 class="no-num no-ref heading settled" id="issues-index"><span class="content
"dom-mlcomputeresult-outputs": {"dfnID":"dom-mlcomputeresult-outputs","dfnText":"outputs","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-mlcomputeresult-outputs"}],"title":"7.3. MLContext interface"},{"refs":[{"id":"ref-for-dom-mlcomputeresult-outputs\u2460"}],"title":"7.3.2. compute()"}],"url":"#dom-mlcomputeresult-outputs"},
"dom-mlconcatsupportlimits-inputs": {"dfnID":"dom-mlconcatsupportlimits-inputs","dfnText":"inputs","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-mlconcatsupportlimits-inputs"}],"title":"7.7.9. concat"}],"url":"#dom-mlconcatsupportlimits-inputs"},
"dom-mlconcatsupportlimits-output": {"dfnID":"dom-mlconcatsupportlimits-output","dfnText":"output","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-mlconcatsupportlimits-output"}],"title":"7.7.9. concat"}],"url":"#dom-mlconcatsupportlimits-output"},
"dom-mlcontext-compute": {"dfnID":"dom-mlcontext-compute","dfnText":"compute(graph, inputs, outputs)","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-mlcontext-compute"},{"id":"ref-for-dom-mlcontext-compute\u2460"}],"title":"3. Security Considerations"},{"refs":[{"id":"ref-for-dom-mlcontext-compute\u2461"},{"id":"ref-for-dom-mlcontext-compute\u2462"}],"title":"6.1. Overview"},{"refs":[{"id":"ref-for-dom-mlcontext-compute\u2463"}],"title":"7.3. MLContext interface"},{"refs":[{"id":"ref-for-dom-mlcontext-compute\u2464"},{"id":"ref-for-dom-mlcontext-compute\u2465"}],"title":"7.3.2. compute()"}],"url":"#dom-mlcontext-compute"},
"dom-mlcontext-compute": {"dfnID":"dom-mlcontext-compute","dfnText":"compute(graph, inputs, outputs)","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-mlcontext-compute"},{"id":"ref-for-dom-mlcontext-compute\u2460"}],"title":"3. Security Considerations"},{"refs":[{"id":"ref-for-dom-mlcontext-compute\u2461"},{"id":"ref-for-dom-mlcontext-compute\u2462"}],"title":"6.1. Overview"},{"refs":[{"id":"ref-for-dom-mlcontext-compute\u2463"}],"title":"7.3. MLContext interface"},{"refs":[{"id":"ref-for-dom-mlcontext-compute\u2464"},{"id":"ref-for-dom-mlcontext-compute\u2465"},{"id":"ref-for-dom-mlcontext-compute\u2466"}],"title":"7.3.2. compute()"}],"url":"#dom-mlcontext-compute"},
"dom-mlcontext-compute-graph-inputs-outputs-graph": {"dfnID":"dom-mlcontext-compute-graph-inputs-outputs-graph","dfnText":"graph","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-mlcontext-compute-graph-inputs-outputs-graph"}],"title":"7.3. MLContext interface"},{"refs":[{"id":"ref-for-dom-mlcontext-compute-graph-inputs-outputs-graph\u2460"},{"id":"ref-for-dom-mlcontext-compute-graph-inputs-outputs-graph\u2461"}],"title":"7.3.2. compute()"}],"url":"#dom-mlcontext-compute-graph-inputs-outputs-graph"},
"dom-mlcontext-compute-graph-inputs-outputs-inputs": {"dfnID":"dom-mlcontext-compute-graph-inputs-outputs-inputs","dfnText":"inputs","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-mlcontext-compute-graph-inputs-outputs-inputs"}],"title":"7.3. MLContext interface"},{"refs":[{"id":"ref-for-dom-mlcontext-compute-graph-inputs-outputs-inputs\u2460"}],"title":"7.3.2. compute()"}],"url":"#dom-mlcontext-compute-graph-inputs-outputs-inputs"},
"dom-mlcontext-compute-graph-inputs-outputs-outputs": {"dfnID":"dom-mlcontext-compute-graph-inputs-outputs-outputs","dfnText":"outputs","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-mlcontext-compute-graph-inputs-outputs-outputs"}],"title":"7.3. MLContext interface"},{"refs":[{"id":"ref-for-dom-mlcontext-compute-graph-inputs-outputs-outputs\u2460"}],"title":"7.3.2. compute()"}],"url":"#dom-mlcontext-compute-graph-inputs-outputs-outputs"},
Expand Down

0 comments on commit 62f7146

Please sign in to comment.