Skip to content

Commit d1a02f2

Browse files
Style change: Scope the links for MLContext internal slots (#556)
Bikeshed is already inferring the correct links, but map the scope of the slots explicit for consistency.
1 parent 92042fa commit d1a02f2

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

index.bs

+9-9
Original file line numberDiff line numberDiff line change
@@ -829,14 +829,14 @@ Its <a>default allowlist</a> is <code>'self'</code>.
829829
<div class=algorithm-steps>
830830
1. Let |context| be a new {{MLContext}} object.
831831
1. If |options| is a {{GPUDevice}} object,
832-
1. Set |context|.{{[[contextType]]}} to "[=context type/webgpu=]".
833-
1. Set |context|.{{[[deviceType]]}} to {{MLDeviceType/"gpu"}}.
834-
1. Set |context|.{{[[powerPreference]]}} to {{MLPowerPreference/"default"}}.
832+
1. Set |context|.{{MLContext/[[contextType]]}} to "[=context type/webgpu=]".
833+
1. Set |context|.{{MLContext/[[deviceType]]}} to {{MLDeviceType/"gpu"}}.
834+
1. Set |context|.{{MLContext/[[powerPreference]]}} to {{MLPowerPreference/"default"}}.
835835
1. Otherwise,
836-
1. Set |context|.{{[[contextType]]}} to "[=context type/default=]".
837-
1. If |options|["{{deviceType}}"] [=map/exists=], then set |context|.{{[[deviceType]]}} to |options|["{{deviceType}}"]. Otherwise, set |context|.{{[[deviceType]]}} to {{MLDeviceType/"cpu"}}.
838-
1. If |options|["{{powerPreference}}"] [=map/exists=], then set |context|.{{[[powerPreference]]}} to |options|["{{powerPreference}}"]. Otherwise, set |context|.{{[[powerPreference]]}} to {{MLPowerPreference/"default"}}.
839-
1. If the user agent cannot support |context|.{{[[contextType]]}}, |context|.{{[[deviceType]]}} and |context|.{{[[powerPreference]]}}, return failure.
836+
1. Set |context|.{{MLContext/[[contextType]]}} to "[=context type/default=]".
837+
1. If |options|["{{deviceType}}"] [=map/exists=], then set |context|.{{MLContext/[[deviceType]]}} to |options|["{{deviceType}}"]. Otherwise, set |context|.{{MLContext/[[deviceType]]}} to {{MLDeviceType/"cpu"}}.
838+
1. If |options|["{{powerPreference}}"] [=map/exists=], then set |context|.{{MLContext/[[powerPreference]]}} to |options|["{{powerPreference}}"]. Otherwise, set |context|.{{MLContext/[[powerPreference]]}} to {{MLPowerPreference/"default"}}.
839+
1. If the user agent cannot support |context|.{{MLContext/[[contextType]]}}, |context|.{{MLContext/[[deviceType]]}} and |context|.{{MLContext/[[powerPreference]]}}, return failure.
840840
1. Return |context|.
841841
</div>
842842
</details>
@@ -1128,7 +1128,7 @@ interface MLContext {};
11281128
</div>
11291129

11301130
<div class="note">
1131-
When the {{[[contextType]]}} is set to [=context type/default=] with the {{MLContextOptions}}.{{deviceType}} set to {{MLDeviceType/"gpu"}}, the user agent is responsible for creating an internal GPU device that operates within the context and is capable of ML workload submission on behalf of the calling application. In this setting however, only {{ArrayBufferView}} inputs and outputs are allowed in and out of the graph execution since the application has no way to know what type of internal GPU device is being created on their behalf. In this case, the user agent is responsible for automatic uploads and downloads of the inputs and outputs to and from the GPU memory using this said internal device.
1131+
When the {{MLContext/[[contextType]]}} is set to [=context type/default=] with the {{MLContextOptions}}.{{deviceType}} set to {{MLDeviceType/"gpu"}}, the user agent is responsible for creating an internal GPU device that operates within the context and is capable of ML workload submission on behalf of the calling application. In this setting however, only {{ArrayBufferView}} inputs and outputs are allowed in and out of the graph execution since the application has no way to know what type of internal GPU device is being created on their behalf. In this case, the user agent is responsible for automatic uploads and downloads of the inputs and outputs to and from the GPU memory using this said internal device.
11321132
</div>
11331133

11341134
### Synchronous Execution ### {#api-mlcontext-sync-execution}
@@ -1433,7 +1433,7 @@ interface MLGraphBuilder {
14331433
</script>
14341434

14351435
<div class="note">
1436-
Both {{MLGraphBuilder}}.{{MLGraphBuilder/build()}} and {{MLGraphBuilder}}.{{MLGraphBuilder/buildSync()}} methods compile the graph builder state up to the specified output operands into a compiled graph according to the type of {{MLContext}} that creates it. Since this operation can be costly in some machine configurations, the calling thread of the {{MLGraphBuilder}}.{{MLGraphBuilder/buildSync()}} method must only be a worker thread to avoid potential disruption of the user experience. When the {{[[contextType]]}} of the {{MLContext}} is set to "[=context type/default=]", the compiled graph is initialized right before the {{MLGraph}} is returned. This graph initialization stage is important for optimal performance of the subsequent graph executions. See [[#api-mlcommandencoder-graph-initialization]] for more detail.
1436+
Both {{MLGraphBuilder}}.{{MLGraphBuilder/build()}} and {{MLGraphBuilder}}.{{MLGraphBuilder/buildSync()}} methods compile the graph builder state up to the specified output operands into a compiled graph according to the type of {{MLContext}} that creates it. Since this operation can be costly in some machine configurations, the calling thread of the {{MLGraphBuilder}}.{{MLGraphBuilder/buildSync()}} method must only be a worker thread to avoid potential disruption of the user experience. When the {{MLContext/[[contextType]]}} of the {{MLContext}} is set to "[=context type/default=]", the compiled graph is initialized right before the {{MLGraph}} is returned. This graph initialization stage is important for optimal performance of the subsequent graph executions. See [[#api-mlcommandencoder-graph-initialization]] for more detail.
14371437
</div>
14381438

14391439
{{MLBufferResourceView}} has the following members:

0 commit comments

Comments
 (0)