You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: index.bs
+7-6Lines changed: 7 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -520,15 +520,16 @@ is completely executed, the result is available in the bound output buffers.
520
520
521
521
## Context and Device Association ## {#programming-model-context-device-association}
522
522
523
-
An {{MLContext}} interface represents a state of neural network execution. An important function of this state is manage resources used in the compilation
524
-
and execution of the neural network graph. An implementation in a user agent may implement this state in terms of CPU resources when an {{MLContext}} is created
525
-
without an explicit association with a hardware device (aka. a *"default context"*). However, when an {{MLContext}} is created from a specific {{GPUDevice}} that
526
-
is also used by the application of WebGPU (aka. a *"GPU context"*), any GPU resource created from the same {{GPUDevice}} such as the {{GPUBuffer}} or {{GPUTexture}}
527
-
is considered a native resource that can also be used as a graph constant, input, or output operand.
523
+
An {{MLContext}} interface represents a state of a neural network execution. An important function of this state is to manage resources used in the compilation
524
+
and execution of the neural network graph. An implementation in a user agent may implement this state in terms of CPU resources and execution when an {{MLContext}}
525
+
is created without an explicit association with a hardware device (aka. a *"default context"*). However, when an {{MLContext}} is created from a WebGPU {{GPUDevice}}
526
+
(aka. a *"GPU context"*), the implementation uses the specified GPU device as a resource domain for the subsequent compilation and execution of the graph.
527
+
Any GPU resource such as the {{GPUBuffer}} or {{GPUTexture}} created from the same {{GPUDevice}} is therefore considered a resource of native resource type that
528
+
can be used to store a graph constant, input, or output operand.
528
529
529
530
In a situation when a GPU context executes a graph with a constant or an input or output allocated in the system memory as in an {{ArrayBufferView}}, the content
530
531
is automatically uploaded from the system memory to the GPU memory, and downloaded back to the system memory of an {{ArrayBufferView}} output buffer at the end of
531
-
the graph execution. This automatic data upload and download cycles will only occur whenever the executing GPU context determines that the data must be copied out of or back
532
+
the graph execution. These automatic data upload and download cycles will only occur whenever the executing GPU context determines that the data must be copied out of or back
532
533
into the system memory as part of the execution. Additionally, the eventual result of the execution must also be in a known layout format. While the internal execution
533
534
technique may be optimized for native memory access pattern in an intermediate result within the graph, the output of the last operation of the graph must convert
534
535
the content back to a known layout format at the end of the graph in order to maintain interoperability as expected by the caller.
0 commit comments