Skip to content

Commit

Permalink
Merge pull request #259 from webmachinelearning/privacy-considerations
Browse files Browse the repository at this point in the history
SHA: c7c0b85
Reason: push, by @anssiko

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
anssiko and github-actions[bot] committed Apr 21, 2022
1 parent 3451f75 commit 0b49b37
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<link href="https://www.w3.org/2008/site/images/favicon.ico" rel="icon">
<meta content="Bikeshed version fb1e763a4, updated Tue Mar 1 13:13:50 2022 -0800" name="generator">
<link href="https://www.w3.org/TR/webnn/" rel="canonical">
<meta content="5b6913bc1c2f8fca7771aca912d198c7c166b5b8" name="document-revision">
<meta content="c7c0b852e0c058f73c60c5adad9b94ef01480643" name="document-revision">
<style>
/* Make <dl> blocks more distinct from their surroundings. */
main dl:not(.switch) {
Expand Down Expand Up @@ -732,7 +732,7 @@
<div class="head">
<p data-fill-with="logo"><a class="logo" href="https://www.w3.org/"> <img alt="W3C" height="48" src="https://www.w3.org/StyleSheets/TR/2021/logos/W3C" width="72"> </a> </p>
<h1 class="p-name no-ref" id="title">Web Neural Network API</h1>
<p id="w3c-state"><a href="https://www.w3.org/standards/types#ED">Editor’s Draft</a>, <time class="dt-updated" datetime="2022-03-24">24 March 2022</time></p>
<p id="w3c-state"><a href="https://www.w3.org/standards/types#ED">Editor’s Draft</a>, <time class="dt-updated" datetime="2022-04-21">21 April 2022</time></p>
<details open>
<summary>More details about this document</summary>
<div data-fill-with="spec-metadata">
Expand Down Expand Up @@ -1086,7 +1086,8 @@ <h2 class="heading settled" data-level="4" id="privacy"><span class="secno">4. <
<p>This API exposes the minimum amount of information necessary to address the identified <a href="#usecases">§ 2 Use cases</a> for the best performance and reliability of results.</p>
<p>No information from the underlying platform is exposed directly. An execution time analysis may reveal indirectly the performance of the underlying platform’s neural network hardware acceleration capabilities relative to another underlying platform.</p>
<p class="note" role="note"><span>Note:</span> The group is <a href="https://github.com/webmachinelearning/webnn/issues/85">soliciting further input</a> on the proposed execution time analysis fingerprinting vector and will augment this section with more information and mitigations to inform the implementers of this API.</p>
<p>Implementers of this API are expected to be familiar with the <a href="https://gpuweb.github.io/gpuweb/#security-privacy">WebGPU Privacy Considerations</a>.</p>
<p>Unlike APIs like WebGL, and WebGPU; this API does not intrinsically support custom shader authoring; and as a result is not prone to timing attacks that rely on shader caches, or other persistent data. The API builds upon pre-existing shaders and lower level primitives of the browser or the underlying OS. Web developers who interface with <code class="idl"><a data-link-type="idl" href="https://gpuweb.github.io/gpuweb/#gpu-device" id="ref-for-gpu-device①">GPUDevice</a></code> are expected to be aware of <a href="https://gpuweb.github.io/gpuweb/#privacy-user-agent-state">WebGPU compilation cache considerations</a>.</p>
<p>In general, implementers of this API are expected to be familiar with the <a href="https://gpuweb.github.io/gpuweb/#privacy-considerations">WebGPU Privacy Considerations</a>.</p>
<h2 class="heading settled" data-level="5" id="ethics"><span class="secno">5. </span><span class="content">Ethical Considerations</span><a class="self-link" href="#ethics"></a></h2>
<p>The Working Group has started documenting ethical issues associated with using Machine Learning on the Web, to help identify what mitigations its normative specifications should take into account. This work currently happens in a dedicated <a href="https://github.com/webmachinelearning/ethical-webmachinelearning">GitHub repository</a>.</p>
<h2 class="heading settled" data-level="6" id="programming-model"><span class="secno">6. </span><span class="content">Programming Model</span><a class="self-link" href="#programming-model"></a></h2>
Expand Down Expand Up @@ -1128,7 +1129,7 @@ <h3 class="heading settled" data-level="6.1" id="programming-model-overview"><sp
the entire data is shared, while in the case of slice, a part of the input data is shared.)
The implementation may use views, as above, for intermediate values.</p>
<h3 class="heading settled" data-level="6.2" id="programming-model-device-selection"><span class="secno">6.2. </span><span class="content">Device Selection</span><a class="self-link" href="#programming-model-device-selection"></a></h3>
<p>An <code class="idl"><a data-link-type="idl" href="#mlcontext" id="ref-for-mlcontext①">MLContext</a></code> interface represents a global state of neural network execution. One of the important context states is the underlying execution device that manages the resources and facilitates the compilation and the eventual execution of the neural network graph. An <code class="idl"><a data-link-type="idl" href="#mlcontext" id="ref-for-mlcontext②">MLContext</a></code> could be created from a specific GPU device such as <code class="idl"><a data-link-type="idl" href="https://gpuweb.github.io/gpuweb/#gpu-device" id="ref-for-gpu-device①">GPUDevice</a></code> or <code class="idl"><a data-link-type="idl" href="https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14" id="ref-for-5.14①">WebGLRenderingContext</a></code> that is already in use by the application, in which case the corresponding <code class="idl"><a data-link-type="idl" href="https://gpuweb.github.io/gpuweb/#buffer-interface" id="ref-for-buffer-interface">GPUBuffer</a></code> or <code class="idl"><a data-link-type="idl" href="https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.4" id="ref-for-5.4">WebGLBuffer</a></code> resources used as graph constants, as well as the <code class="idl"><a data-link-type="idl" href="https://gpuweb.github.io/gpuweb/#texture-interface" id="ref-for-texture-interface">GPUTexture</a></code> and <code class="idl"><a data-link-type="idl" href="https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.9" id="ref-for-5.9">WebGLTexture</a></code> as graph inputs must also be created from the same device. In a multi-adapter configuration, the device used for <code class="idl"><a data-link-type="idl" href="#mlcontext" id="ref-for-mlcontext③">MLContext</a></code> must be created from the same adapter as the device used to allocate the resources referenced in the graph.</p>
<p>An <code class="idl"><a data-link-type="idl" href="#mlcontext" id="ref-for-mlcontext①">MLContext</a></code> interface represents a global state of neural network execution. One of the important context states is the underlying execution device that manages the resources and facilitates the compilation and the eventual execution of the neural network graph. An <code class="idl"><a data-link-type="idl" href="#mlcontext" id="ref-for-mlcontext②">MLContext</a></code> could be created from a specific GPU device such as <code class="idl"><a data-link-type="idl" href="https://gpuweb.github.io/gpuweb/#gpu-device" id="ref-for-gpu-device②">GPUDevice</a></code> or <code class="idl"><a data-link-type="idl" href="https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14" id="ref-for-5.14①">WebGLRenderingContext</a></code> that is already in use by the application, in which case the corresponding <code class="idl"><a data-link-type="idl" href="https://gpuweb.github.io/gpuweb/#buffer-interface" id="ref-for-buffer-interface">GPUBuffer</a></code> or <code class="idl"><a data-link-type="idl" href="https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.4" id="ref-for-5.4">WebGLBuffer</a></code> resources used as graph constants, as well as the <code class="idl"><a data-link-type="idl" href="https://gpuweb.github.io/gpuweb/#texture-interface" id="ref-for-texture-interface">GPUTexture</a></code> and <code class="idl"><a data-link-type="idl" href="https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.9" id="ref-for-5.9">WebGLTexture</a></code> as graph inputs must also be created from the same device. In a multi-adapter configuration, the device used for <code class="idl"><a data-link-type="idl" href="#mlcontext" id="ref-for-mlcontext③">MLContext</a></code> must be created from the same adapter as the device used to allocate the resources referenced in the graph.</p>
<p>In a situation when a GPU context executes a graph with a constant or an input in the system memory as an <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#ArrayBufferView" id="ref-for-ArrayBufferView">ArrayBufferView</a></code>, the input content is automatically uploaded from the system memory to the GPU memory, and downloaded back to the system memory of an <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#ArrayBufferView" id="ref-for-ArrayBufferView①">ArrayBufferView</a></code> output buffer at the end of the graph execution. This data upload and download cycles will only occur whenever the execution device requires the data to be copied out of and back into the system memory, such as in the case of the GPU. It doesn’t occur when the device is a CPU device. Additionally, the result of the graph execution is in a known layout format. While the execution may be optimized for a native memory access pattern in an intermediate result within the graph, the output of the last operation of the graph must convert the content back to a known layout format at the end of the graph in order to maintain the expected behavior from the caller’s perspective.</p>
<p>When an <code class="idl"><a data-link-type="idl" href="#mlcontext" id="ref-for-mlcontext④">MLContext</a></code> is created with <code class="idl"><a data-link-type="idl" href="#dictdef-mlcontextoptions" id="ref-for-dictdef-mlcontextoptions">MLContextOptions</a></code>, the user agent selects and creates the underlying execution device by taking into account the application’s <a data-link-type="dfn" href="#power-preference" id="ref-for-power-preference">power preference</a> and <a data-link-type="dfn" href="#device-preference" id="ref-for-device-preference">device preference</a> specified in the <code class="idl"><a data-link-type="idl" href="#enumdef-mlpowerpreference" id="ref-for-enumdef-mlpowerpreference">MLPowerPreference</a></code> and <code class="idl"><a data-link-type="idl" href="#enumdef-mldevicepreference" id="ref-for-enumdef-mldevicepreference">MLDevicePreference</a></code> options.</p>
<p>The following table summarizes the types of resource supported by the device selected.</p>
Expand Down Expand Up @@ -1210,7 +1211,7 @@ <h3 class="heading settled" data-level="7.2" id="api-ml"><span class="secno">7.2
<c- b>interface</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="ml"><code><c- g>ML</c-></code></dfn> {
<a data-link-type="idl-name" href="#mlcontext" id="ref-for-mlcontext⑤"><c- n>MLContext</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="ML" data-dfn-type="method" data-export data-lt="createContext(options)|createContext()" id="dom-ml-createcontext"><code><c- g>createContext</c-></code></dfn>(<c- b>optional</c-> <a data-link-type="idl-name" href="#dictdef-mlcontextoptions" id="ref-for-dictdef-mlcontextoptions①"><c- n>MLContextOptions</c-></a> <dfn class="idl-code" data-dfn-for="ML/createContext(options), ML/createContext()" data-dfn-type="argument" data-export id="dom-ml-createcontext-options-options"><code><c- g>options</c-></code><a class="self-link" href="#dom-ml-createcontext-options-options"></a></dfn> = {});
<a data-link-type="idl-name" href="#mlcontext" id="ref-for-mlcontext⑥"><c- n>MLContext</c-></a> <dfn class="idl-code" data-dfn-for="ML" data-dfn-type="method" data-export data-lt="createContext(glContext)" id="dom-ml-createcontext-glcontext"><code><c- g>createContext</c-></code><a class="self-link" href="#dom-ml-createcontext-glcontext"></a></dfn>(<a data-link-type="idl-name" href="https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14" id="ref-for-5.14②"><c- n>WebGLRenderingContext</c-></a> <dfn class="idl-code" data-dfn-for="ML/createContext(glContext)" data-dfn-type="argument" data-export id="dom-ml-createcontext-glcontext-glcontext"><code><c- g>glContext</c-></code><a class="self-link" href="#dom-ml-createcontext-glcontext-glcontext"></a></dfn>);
<a data-link-type="idl-name" href="#mlcontext" id="ref-for-mlcontext⑦"><c- n>MLContext</c-></a> <dfn class="idl-code" data-dfn-for="ML" data-dfn-type="method" data-export data-lt="createContext(gpuDevice)" id="dom-ml-createcontext-gpudevice"><code><c- g>createContext</c-></code><a class="self-link" href="#dom-ml-createcontext-gpudevice"></a></dfn>(<a data-link-type="idl-name" href="https://gpuweb.github.io/gpuweb/#gpu-device" id="ref-for-gpu-device"><c- n>GPUDevice</c-></a> <dfn class="idl-code" data-dfn-for="ML/createContext(gpuDevice)" data-dfn-type="argument" data-export id="dom-ml-createcontext-gpudevice-gpudevice"><code><c- g>gpuDevice</c-></code><a class="self-link" href="#dom-ml-createcontext-gpudevice-gpudevice"></a></dfn>);
<a data-link-type="idl-name" href="#mlcontext" id="ref-for-mlcontext⑦"><c- n>MLContext</c-></a> <dfn class="idl-code" data-dfn-for="ML" data-dfn-type="method" data-export data-lt="createContext(gpuDevice)" id="dom-ml-createcontext-gpudevice"><code><c- g>createContext</c-></code><a class="self-link" href="#dom-ml-createcontext-gpudevice"></a></dfn>(<a data-link-type="idl-name" href="https://gpuweb.github.io/gpuweb/#gpu-device" id="ref-for-gpu-device"><c- n>GPUDevice</c-></a> <dfn class="idl-code" data-dfn-for="ML/createContext(gpuDevice)" data-dfn-type="argument" data-export id="dom-ml-createcontext-gpudevice-gpudevice"><code><c- g>gpuDevice</c-></code><a class="self-link" href="#dom-ml-createcontext-gpudevice-gpudevice"></a></dfn>);
};
</pre>
<p>The <code class="idl"><a data-link-type="idl" href="#dom-ml-createcontext" id="ref-for-dom-ml-createcontext">createContext()</a></code> method steps are:</p>
Expand All @@ -1230,7 +1231,7 @@ <h3 class="heading settled" data-level="7.2" id="api-ml"><span class="secno">7.2
<dd>Set <var>context</var>.<code class="idl"><a data-link-type="idl" href="#dom-mlcontext-contexttype-slot" id="ref-for-dom-mlcontext-contexttype-slot①">[[contextType]]</a></code> to <a data-link-type="dfn" href="#webgl-context" id="ref-for-webgl-context">webgl</a>.
<dd>Set <var>context</var>.<code class="idl"><a data-link-type="idl" href="#dom-mlcontext-devicepreference-slot" id="ref-for-dom-mlcontext-devicepreference-slot①">[[devicePreference]]</a></code> to "<a data-link-type="dfn" href="#device-preference-gpu" id="ref-for-device-preference-gpu">gpu</a>".
<dd>Set <var>context</var>.<code class="idl"><a data-link-type="idl" href="#dom-mlcontext-powerpreference-slot" id="ref-for-dom-mlcontext-powerpreference-slot①">[[powerPreference]]</a></code> to "<a data-link-type="dfn" href="#power-preference-default" id="ref-for-power-preference-default">default</a>".
<dt><code class="idl"><a data-link-type="idl" href="https://gpuweb.github.io/gpuweb/#gpu-device" id="ref-for-gpu-device">GPUDevice</a></code>
<dt><code class="idl"><a data-link-type="idl" href="https://gpuweb.github.io/gpuweb/#gpu-device" id="ref-for-gpu-device">GPUDevice</a></code>
<dd>Set <var>context</var>.<code class="idl"><a data-link-type="idl" href="#dom-mlcontext-contexttype-slot" id="ref-for-dom-mlcontext-contexttype-slot②">[[contextType]]</a></code> to <a data-link-type="dfn" href="#webgpu-context" id="ref-for-webgpu-context">webgpu</a>.
<dd>Set <var>context</var>.<code class="idl"><a data-link-type="idl" href="#dom-mlcontext-devicepreference-slot" id="ref-for-dom-mlcontext-devicepreference-slot②">[[devicePreference]]</a></code> to "<a data-link-type="dfn" href="#device-preference-gpu" id="ref-for-device-preference-gpu①">gpu</a>".
<dd>Set <var>context</var>.<code class="idl"><a data-link-type="idl" href="#dom-mlcontext-powerpreference-slot" id="ref-for-dom-mlcontext-powerpreference-slot②">[[powerPreference]]</a></code> to "<a data-link-type="dfn" href="#power-preference-default" id="ref-for-power-preference-default①">default</a>".
Expand Down Expand Up @@ -3221,7 +3222,7 @@ <h3 class="heading settled" data-level="7.8" id="api-mlgraph"><span class="secno
<li data-md>
<p>Return <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#idl-undefined" id="ref-for-idl-undefined②">undefined</a></code>.</p>
</ol>
<p class="issue" id="issue-e40c670b"><a class="self-link" href="#issue-e40c670b"></a> Describe the algorithm steps for <var>this</var>.<code class="idl"><a data-link-type="idl" href="#dom-mlgraph-context-slot" id="ref-for-dom-mlgraph-context-slot">[[context]]</a></code> created from <code class="idl"><a data-link-type="idl" href="https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14" id="ref-for-5.14④">WebGLRenderingContext</a></code> and <code class="idl"><a data-link-type="idl" href="https://gpuweb.github.io/gpuweb/#gpu-device" id="ref-for-gpu-device">GPUDevice</a></code>.</p>
<p class="issue" id="issue-e40c670b"><a class="self-link" href="#issue-e40c670b"></a> Describe the algorithm steps for <var>this</var>.<code class="idl"><a data-link-type="idl" href="#dom-mlgraph-context-slot" id="ref-for-dom-mlgraph-context-slot">[[context]]</a></code> created from <code class="idl"><a data-link-type="idl" href="https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14" id="ref-for-5.14④">WebGLRenderingContext</a></code> and <code class="idl"><a data-link-type="idl" href="https://gpuweb.github.io/gpuweb/#gpu-device" id="ref-for-gpu-device">GPUDevice</a></code>.</p>
</div>
</dl>
<h4 class="heading settled" data-level="7.8.1" id="compilation-examples"><span class="secno">7.8.1. </span><span class="content">Examples</span><a class="self-link" href="#compilation-examples"></a></h4>
Expand Down Expand Up @@ -3405,6 +3406,7 @@ <h2 class="heading settled" data-level="10" id="acknowledgements"><span class="s
<p>Thanks to W3C Privacy Interest Group for privacy and security review and feedback.</p>
<p>Thanks to Alex Gough and the Chrome Security team for security review and questions.</p>
<p>Thanks to Michal Karzynski for sharing practical guidelines and learnings from ONNX.</p>
<p>Thanks to Kaustubha Govind and Chrome privacy reviewers for feedback and privacy considerations.</p>
</main>
<div data-fill-with="conformance">
<h2 class="no-ref no-num heading settled" id="w3c-conformance"><span class="content">Conformance</span><a class="self-link" href="#w3c-conformance"></a></h2>
Expand Down Expand Up @@ -3950,9 +3952,10 @@ <h3 class="no-num no-ref heading settled" id="index-defined-here"><span class="c
<a href="https://gpuweb.github.io/gpuweb/#gpu-device">https://gpuweb.github.io/gpuweb/#gpu-device</a><b>Referenced in:</b>
<ul>
<li><a href="#ref-for-gpu-device">3. Security Considerations</a>
<li><a href="#ref-for-gpu-device①">6.2. Device Selection</a>
<li><a href="#ref-for-gpu-device②">7.2. ML</a> <a href="#ref-for-gpu-device③">(2)</a>
<li><a href="#ref-for-gpu-device④">7.8. MLGraph</a>
<li><a href="#ref-for-gpu-device①">4. Privacy Considerations</a>
<li><a href="#ref-for-gpu-device②">6.2. Device Selection</a>
<li><a href="#ref-for-gpu-device③">7.2. ML</a> <a href="#ref-for-gpu-device④">(2)</a>
<li><a href="#ref-for-gpu-device⑤">7.8. MLGraph</a>
</ul>
</aside>
<aside class="dfn-panel" data-for="term-for-texture-interface">
Expand Down

0 comments on commit 0b49b37

Please sign in to comment.