1e5c31af7Sopenharmony_ci// Copyright 2023-2024 The Khronos Group Inc.
2e5c31af7Sopenharmony_ci//
3e5c31af7Sopenharmony_ci// SPDX-License-Identifier: CC-BY-4.0
4e5c31af7Sopenharmony_ci
5e5c31af7Sopenharmony_ci[[executiongraphs]]
6e5c31af7Sopenharmony_ci= Execution Graphs
7e5c31af7Sopenharmony_ci
8e5c31af7Sopenharmony_ci_Execution graphs_ provide a way for applications to dispatch multiple
9e5c31af7Sopenharmony_cioperations dynamically from a single initial command on the host.
10e5c31af7Sopenharmony_ciTo achieve this, a new execution graph pipeline is provided, that links
11e5c31af7Sopenharmony_citogether multiple shaders or pipelines which each describe one or more
12e5c31af7Sopenharmony_cioperations that can be dispatched within the execution graph.
13e5c31af7Sopenharmony_ciEach linked pipeline or shader describes an _execution node_ within the
14e5c31af7Sopenharmony_cigraph, which can: be dispatched dynamically from another shader within the
15e5c31af7Sopenharmony_cisame graph.
16e5c31af7Sopenharmony_ciThis allows applications to describe much richer execution topologies at a
17e5c31af7Sopenharmony_cifiner granularity than would typically be possible with API commands alone.
18e5c31af7Sopenharmony_ci
19e5c31af7Sopenharmony_ci
20e5c31af7Sopenharmony_ci== Pipeline Creation
21e5c31af7Sopenharmony_ci
22e5c31af7Sopenharmony_ci[open,refpage='vkCreateExecutionGraphPipelinesAMDX',desc='Creates a new execution graph pipeline object',type='protos']
23e5c31af7Sopenharmony_ci--
24e5c31af7Sopenharmony_ciTo create execution graph pipelines, call:
25e5c31af7Sopenharmony_ci
26e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCreateExecutionGraphPipelinesAMDX.adoc[]
27e5c31af7Sopenharmony_ci
28e5c31af7Sopenharmony_ci  * pname:device is the logical device that creates the execution graph
29e5c31af7Sopenharmony_ci    pipelines.
30e5c31af7Sopenharmony_ci  * pname:pipelineCache is either dlink:VK_NULL_HANDLE, indicating that
31e5c31af7Sopenharmony_ci    pipeline caching is disabled; or the handle of a valid
32e5c31af7Sopenharmony_ci    <<pipelines-cache,pipeline cache>> object, in which case use of that
33e5c31af7Sopenharmony_ci    cache is enabled for the duration of the command.
34e5c31af7Sopenharmony_ci  * pname:createInfoCount is the length of the pname:pCreateInfos and
35e5c31af7Sopenharmony_ci    pname:pPipelines arrays.
36e5c31af7Sopenharmony_ci  * pname:pCreateInfos is a pointer to an array of
37e5c31af7Sopenharmony_ci    slink:VkExecutionGraphPipelineCreateInfoAMDX structures.
38e5c31af7Sopenharmony_ci  * pname:pAllocator controls host memory allocation as described in the
39e5c31af7Sopenharmony_ci    <<memory-allocation, Memory Allocation>> chapter.
40e5c31af7Sopenharmony_ci  * pname:pPipelines is a pointer to an array of slink:VkPipeline handles in
41e5c31af7Sopenharmony_ci    which the resulting execution graph pipeline objects are returned.
42e5c31af7Sopenharmony_ci
43e5c31af7Sopenharmony_ciPipelines are created and returned as described for <<pipelines-multiple,
44e5c31af7Sopenharmony_ciMultiple Pipeline Creation>>.
45e5c31af7Sopenharmony_ci
46e5c31af7Sopenharmony_ci.Valid Usage
47e5c31af7Sopenharmony_ci****
48e5c31af7Sopenharmony_ci  * [[VUID-vkCreateExecutionGraphPipelinesAMDX-shaderEnqueue-09124]]
49e5c31af7Sopenharmony_ci    The <<features-shaderEnqueue,pname:shaderEnqueue feature>> must: be
50e5c31af7Sopenharmony_ci    enabled
51e5c31af7Sopenharmony_ci  * [[VUID-vkCreateExecutionGraphPipelinesAMDX-flags-09125]]
52e5c31af7Sopenharmony_ci    If the pname:flags member of any element of pname:pCreateInfos contains
53e5c31af7Sopenharmony_ci    the ename:VK_PIPELINE_CREATE_DERIVATIVE_BIT flag, and the
54e5c31af7Sopenharmony_ci    pname:basePipelineIndex member of that same element is not `-1`,
55e5c31af7Sopenharmony_ci    pname:basePipelineIndex must: be less than the index into
56e5c31af7Sopenharmony_ci    pname:pCreateInfos that corresponds to that element
57e5c31af7Sopenharmony_ci  * [[VUID-vkCreateExecutionGraphPipelinesAMDX-flags-09126]]
58e5c31af7Sopenharmony_ci    If the pname:flags member of any element of pname:pCreateInfos contains
59e5c31af7Sopenharmony_ci    the ename:VK_PIPELINE_CREATE_DERIVATIVE_BIT flag, the base pipeline
60e5c31af7Sopenharmony_ci    must: have been created with the
61e5c31af7Sopenharmony_ci    ename:VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT flag set
62e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_EXT_pipeline_creation_cache_control[]
63e5c31af7Sopenharmony_ci  * [[VUID-vkCreateExecutionGraphPipelinesAMDX-pipelineCache-09127]]
64e5c31af7Sopenharmony_ci    If pname:pipelineCache was created with
65e5c31af7Sopenharmony_ci    ename:VK_PIPELINE_CACHE_CREATE_EXTERNALLY_SYNCHRONIZED_BIT, host access
66e5c31af7Sopenharmony_ci    to pname:pipelineCache must: be
67e5c31af7Sopenharmony_ci    <<fundamentals-threadingbehavior,externally synchronized>>
68e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3,VK_EXT_pipeline_creation_cache_control[]
69e5c31af7Sopenharmony_ci****
70e5c31af7Sopenharmony_ci
71e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCreateExecutionGraphPipelinesAMDX.adoc[]
72e5c31af7Sopenharmony_ci--
73e5c31af7Sopenharmony_ci
74e5c31af7Sopenharmony_ci[open,refpage='VkExecutionGraphPipelineCreateInfoAMDX',desc='Structure specifying parameters of a newly created execution graph pipeline',type='structs']
75e5c31af7Sopenharmony_ci--
76e5c31af7Sopenharmony_ci:refpage: VkExecutionGraphPipelineCreateInfoAMDX
77e5c31af7Sopenharmony_ci
78e5c31af7Sopenharmony_ciThe sname:VkExecutionGraphPipelineCreateInfoAMDX structure is defined as:
79e5c31af7Sopenharmony_ci
80e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkExecutionGraphPipelineCreateInfoAMDX.adoc[]
81e5c31af7Sopenharmony_ci
82e5c31af7Sopenharmony_ci  * pname:sType is a elink:VkStructureType value identifying this structure.
83e5c31af7Sopenharmony_ci  * pname:pNext is `NULL` or a pointer to a structure extending this
84e5c31af7Sopenharmony_ci    structure.
85e5c31af7Sopenharmony_ci  * pname:flags is a bitmask of elink:VkPipelineCreateFlagBits specifying
86e5c31af7Sopenharmony_ci    how the pipeline will be generated.
87e5c31af7Sopenharmony_ci  * pname:stageCount is the number of entries in the pname:pStages array.
88e5c31af7Sopenharmony_ci  * pname:pStages is a pointer to an array of pname:stageCount
89e5c31af7Sopenharmony_ci    slink:VkPipelineShaderStageCreateInfo structures describing the set of
90e5c31af7Sopenharmony_ci    the shader stages to be included in the execution graph pipeline.
91e5c31af7Sopenharmony_ci  * pname:pLibraryInfo is a pointer to a
92e5c31af7Sopenharmony_ci    slink:VkPipelineLibraryCreateInfoKHR structure defining pipeline
93e5c31af7Sopenharmony_ci    libraries to include.
94e5c31af7Sopenharmony_ci  * pname:layout is the description of binding locations used by both the
95e5c31af7Sopenharmony_ci    pipeline and descriptor sets used with the pipeline.
96e5c31af7Sopenharmony_ci  * pname:basePipelineHandle is a pipeline to derive from
97e5c31af7Sopenharmony_ci  * pname:basePipelineIndex is an index into the pname:pCreateInfos
98e5c31af7Sopenharmony_ci    parameter to use as a pipeline to derive from
99e5c31af7Sopenharmony_ci
100e5c31af7Sopenharmony_ciThe parameters pname:basePipelineHandle and pname:basePipelineIndex are
101e5c31af7Sopenharmony_cidescribed in more detail in <<pipelines-pipeline-derivatives,Pipeline
102e5c31af7Sopenharmony_ciDerivatives>>.
103e5c31af7Sopenharmony_ci
104e5c31af7Sopenharmony_ciEach shader stage provided when creating an execution graph pipeline
105e5c31af7Sopenharmony_ci(including those in libraries) is associated with a name and an index,
106e5c31af7Sopenharmony_cidetermined by the inclusion or omission of a
107e5c31af7Sopenharmony_cislink:VkPipelineShaderStageNodeCreateInfoAMDX structure in its pname:pNext
108e5c31af7Sopenharmony_cichain.
109e5c31af7Sopenharmony_ci
110e5c31af7Sopenharmony_ciIn addition to the shader name and index, an internal "node index" is also
111e5c31af7Sopenharmony_cigenerated for each node, which can be queried with
112e5c31af7Sopenharmony_ciflink:vkGetExecutionGraphPipelineNodeIndexAMDX, and is used exclusively for
113e5c31af7Sopenharmony_ciinitial dispatch of an execution graph.
114e5c31af7Sopenharmony_ci
115e5c31af7Sopenharmony_ci.Valid Usage
116e5c31af7Sopenharmony_ci****
117e5c31af7Sopenharmony_ci:pipelineType: execution graph
118e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/pipeline_create_info_common.adoc[]
119e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/compute_graph_pipeline_create_info_common.adoc[]
120e5c31af7Sopenharmony_ci  * [[VUID-VkExecutionGraphPipelineCreateInfoAMDX-stage-09128]]
121e5c31af7Sopenharmony_ci    The pname:stage member of any element of pname:pStages must: be
122e5c31af7Sopenharmony_ci    ename:VK_SHADER_STAGE_COMPUTE_BIT
123e5c31af7Sopenharmony_ci  * [[VUID-VkExecutionGraphPipelineCreateInfoAMDX-pStages-09129]]
124e5c31af7Sopenharmony_ci    The shader code for the entry point identified by each element of
125e5c31af7Sopenharmony_ci    pname:pStages and the rest of the state identified by this structure
126e5c31af7Sopenharmony_ci    must: adhere to the pipeline linking rules described in the
127e5c31af7Sopenharmony_ci    <<interfaces,Shader Interfaces>> chapter
128e5c31af7Sopenharmony_ci  * [[VUID-VkExecutionGraphPipelineCreateInfoAMDX-layout-09130]]
129e5c31af7Sopenharmony_ci    pname:layout must: be
130e5c31af7Sopenharmony_ci    <<descriptorsets-pipelinelayout-consistency,consistent>> with the layout
131e5c31af7Sopenharmony_ci    of the shaders specified in pname:pStages
132e5c31af7Sopenharmony_ci  * [[VUID-VkExecutionGraphPipelineCreateInfoAMDX-pLibraryInfo-09131]]
133e5c31af7Sopenharmony_ci    If pname:pLibraryInfo is not `NULL`, each element of its
134e5c31af7Sopenharmony_ci    pname:pLibraries member must: have been created with a pname:layout that
135e5c31af7Sopenharmony_ci    is compatible with the pname:layout in this pipeline
136e5c31af7Sopenharmony_ci  * [[VUID-VkExecutionGraphPipelineCreateInfoAMDX-layout-09132]]
137e5c31af7Sopenharmony_ci    The number of resources in pname:layout accessible to each shader stage
138e5c31af7Sopenharmony_ci    that is used by the pipeline must: be less than or equal to
139e5c31af7Sopenharmony_ci    sname:VkPhysicalDeviceLimits::pname:maxPerStageResources
140e5c31af7Sopenharmony_ci  * [[VUID-VkExecutionGraphPipelineCreateInfoAMDX-pLibraryInfo-09133]]
141e5c31af7Sopenharmony_ci    If pname:pLibraryInfo is not `NULL`, each element of
142e5c31af7Sopenharmony_ci    pname:pLibraryInfo->libraries must: be either a compute pipeline or an
143e5c31af7Sopenharmony_ci    execution graph pipeline
144e5c31af7Sopenharmony_ci  * [[VUID-VkExecutionGraphPipelineCreateInfoAMDX-None-09134]]
145e5c31af7Sopenharmony_ci    There must: be no two nodes in the pipeline that share both the same
146e5c31af7Sopenharmony_ci    shader name and index, as specified by
147e5c31af7Sopenharmony_ci    slink:VkPipelineShaderStageNodeCreateInfoAMDX
148e5c31af7Sopenharmony_ci  * [[VUID-VkExecutionGraphPipelineCreateInfoAMDX-None-09135]]
149e5c31af7Sopenharmony_ci    There must: be no two nodes in the pipeline that share the same shader
150e5c31af7Sopenharmony_ci    name and have input payload declarations with different sizes
151e5c31af7Sopenharmony_ci  * [[VUID-VkExecutionGraphPipelineCreateInfoAMDX-None-09136]]
152e5c31af7Sopenharmony_ci    There must: be no two nodes in the pipeline that share the same name but
153e5c31af7Sopenharmony_ci    have different execution models
154e5c31af7Sopenharmony_ci  * [[VUID-VkExecutionGraphPipelineCreateInfoAMDX-CoalescedInputCountAMDX-09137]]
155e5c31af7Sopenharmony_ci    There must: be no two nodes in the pipeline that share the same name
156e5c31af7Sopenharmony_ci    where one includes code:CoalescedInputCountAMDX and the other does not
157e5c31af7Sopenharmony_ci  * [[VUID-VkExecutionGraphPipelineCreateInfoAMDX-StaticNumWorkgroupsAMDX-09138]]
158e5c31af7Sopenharmony_ci    There must: be no two nodes in the pipeline that share the same name
159e5c31af7Sopenharmony_ci    where one includes code:StaticNumWorkgroupsAMDX and the other does not
160e5c31af7Sopenharmony_ci  * [[VUID-VkExecutionGraphPipelineCreateInfoAMDX-PayloadNodeNameAMDX-09139]]
161e5c31af7Sopenharmony_ci    If an output payload declared in any shader in the pipeline has a
162e5c31af7Sopenharmony_ci    code:PayloadNodeNameAMDX decoration with a code:Node code:Name that
163e5c31af7Sopenharmony_ci    matches the shader name of any other node in the graph, the size of the
164e5c31af7Sopenharmony_ci    output payload must: match the size of the input payload in the matching
165e5c31af7Sopenharmony_ci    node
166e5c31af7Sopenharmony_ci****
167e5c31af7Sopenharmony_ci
168e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkExecutionGraphPipelineCreateInfoAMDX.adoc[]
169e5c31af7Sopenharmony_ci--
170e5c31af7Sopenharmony_ci
171e5c31af7Sopenharmony_ci[open,refpage='VK_SHADER_INDEX_UNUSED_AMDX',desc='Sentinel for an unused shader index',type='consts']
172e5c31af7Sopenharmony_ci--
173e5c31af7Sopenharmony_ciename:VK_SHADER_INDEX_UNUSED_AMDX is a special shader index used to indicate
174e5c31af7Sopenharmony_cithat the created node does not override the index.
175e5c31af7Sopenharmony_ciIn this case, the shader index is determined through other means.
176e5c31af7Sopenharmony_ciIt is defined as:
177e5c31af7Sopenharmony_ci
178e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VK_SHADER_INDEX_UNUSED_AMDX.adoc[]
179e5c31af7Sopenharmony_ci--
180e5c31af7Sopenharmony_ci
181e5c31af7Sopenharmony_ci[open,refpage='VkPipelineShaderStageNodeCreateInfoAMDX',desc='Structure specifying the shader name and index with an execution graph',type='structs']
182e5c31af7Sopenharmony_ci--
183e5c31af7Sopenharmony_ci:refpage: VkPipelineShaderStageNodeCreateInfoAMDX
184e5c31af7Sopenharmony_ci
185e5c31af7Sopenharmony_ciThe sname:VkPipelineShaderStageNodeCreateInfoAMDX structure is defined as:
186e5c31af7Sopenharmony_ci
187e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkPipelineShaderStageNodeCreateInfoAMDX.adoc[]
188e5c31af7Sopenharmony_ci
189e5c31af7Sopenharmony_ci  * pname:sType is a elink:VkStructureType value identifying this structure.
190e5c31af7Sopenharmony_ci  * pname:pNext is `NULL` or a pointer to a structure extending this
191e5c31af7Sopenharmony_ci    structure.
192e5c31af7Sopenharmony_ci  * pname:pName is the shader name to use when creating a node in an
193e5c31af7Sopenharmony_ci    execution graph.
194e5c31af7Sopenharmony_ci    If pname:pName is `NULL`, the name of the entry point specified in
195e5c31af7Sopenharmony_ci    SPIR-V is used as the shader name.
196e5c31af7Sopenharmony_ci  * pname:index is the shader index to use when creating a node in an
197e5c31af7Sopenharmony_ci    execution graph.
198e5c31af7Sopenharmony_ci    If pname:index is ename:VK_SHADER_INDEX_UNUSED_AMDX then the original
199e5c31af7Sopenharmony_ci    index is used, either as specified by the code:ShaderIndexAMDX execution
200e5c31af7Sopenharmony_ci    mode, or `0` if that too is not specified.
201e5c31af7Sopenharmony_ci
202e5c31af7Sopenharmony_ciWhen included in the pname:pNext chain of a
203e5c31af7Sopenharmony_cislink:VkPipelineShaderStageCreateInfo structure, this structure specifies
204e5c31af7Sopenharmony_cithe shader name and shader index of a node when creating an execution graph
205e5c31af7Sopenharmony_cipipeline.
206e5c31af7Sopenharmony_ciIf this structure is omitted, the shader name is set to the name of the
207e5c31af7Sopenharmony_cientry point in SPIR-V and the shader index is set to `0`.
208e5c31af7Sopenharmony_ci
209e5c31af7Sopenharmony_ciWhen dispatching a node from another shader, the name is fixed at pipeline
210e5c31af7Sopenharmony_cicreation, but the index can: be set dynamically.
211e5c31af7Sopenharmony_ciBy associating multiple shaders with the same name but different indexes,
212e5c31af7Sopenharmony_ciapplications can dynamically select different nodes to execute.
213e5c31af7Sopenharmony_ciApplications must: ensure each node has a unique name and index.
214e5c31af7Sopenharmony_ci
215e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkPipelineShaderStageNodeCreateInfoAMDX.adoc[]
216e5c31af7Sopenharmony_ci--
217e5c31af7Sopenharmony_ci
218e5c31af7Sopenharmony_ci[open,refpage='vkGetExecutionGraphPipelineNodeIndexAMDX',desc='Query internal id of a node in an execution graph',type='protos']
219e5c31af7Sopenharmony_ci--
220e5c31af7Sopenharmony_ci:refpage: vkGetExecutionGraphPipelineNodeIndexAMDX
221e5c31af7Sopenharmony_ci
222e5c31af7Sopenharmony_ciTo query the internal node index for a particular node in an execution
223e5c31af7Sopenharmony_cigraph, call:
224e5c31af7Sopenharmony_ci
225e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkGetExecutionGraphPipelineNodeIndexAMDX.adoc[]
226e5c31af7Sopenharmony_ci
227e5c31af7Sopenharmony_ci  * pname:device is the that pname:executionGraph was created on.
228e5c31af7Sopenharmony_ci  * pname:executionGraph is the execution graph pipeline to query the
229e5c31af7Sopenharmony_ci    internal node index for.
230e5c31af7Sopenharmony_ci  * pname:pNodeInfo is a pointer to a
231e5c31af7Sopenharmony_ci    slink:VkPipelineShaderStageNodeCreateInfoAMDX structure identifying the
232e5c31af7Sopenharmony_ci    name and index of the node to query.
233e5c31af7Sopenharmony_ci  * pname:pNodeIndex is the returned internal node index of the identified
234e5c31af7Sopenharmony_ci    node.
235e5c31af7Sopenharmony_ci
236e5c31af7Sopenharmony_ciOnce this function returns, the contents of pname:pNodeIndex contain the
237e5c31af7Sopenharmony_ciinternal node index of the identified node.
238e5c31af7Sopenharmony_ci
239e5c31af7Sopenharmony_ci
240e5c31af7Sopenharmony_ci.Valid Usage
241e5c31af7Sopenharmony_ci****
242e5c31af7Sopenharmony_ci  * [[VUID-vkGetExecutionGraphPipelineNodeIndexAMDX-pNodeInfo-09140]]
243e5c31af7Sopenharmony_ci    pname:pNodeInfo->pName must: not be `NULL`
244e5c31af7Sopenharmony_ci  * [[VUID-vkGetExecutionGraphPipelineNodeIndexAMDX-pNodeInfo-09141]]
245e5c31af7Sopenharmony_ci    pname:pNodeInfo->index must: not be ename:VK_SHADER_INDEX_UNUSED_AMDX
246e5c31af7Sopenharmony_ci  * [[VUID-vkGetExecutionGraphPipelineNodeIndexAMDX-executionGraph-09142]]
247e5c31af7Sopenharmony_ci    There must: be a node in pname:executionGraph with a shader name and
248e5c31af7Sopenharmony_ci    index equal to pname:pNodeInfo->pName and pname:pNodeInfo->index
249e5c31af7Sopenharmony_ci****
250e5c31af7Sopenharmony_ci
251e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkGetExecutionGraphPipelineNodeIndexAMDX.adoc[]
252e5c31af7Sopenharmony_ci--
253e5c31af7Sopenharmony_ci
254e5c31af7Sopenharmony_ci
255e5c31af7Sopenharmony_ci== Initializing Scratch Memory
256e5c31af7Sopenharmony_ci
257e5c31af7Sopenharmony_ciImplementations may: need scratch memory to manage dispatch queues or
258e5c31af7Sopenharmony_cisimilar when executing a pipeline graph, and this is explicitly managed by
259e5c31af7Sopenharmony_cithe application.
260e5c31af7Sopenharmony_ci
261e5c31af7Sopenharmony_ci[open,refpage='vkGetExecutionGraphPipelineScratchSizeAMDX',desc='Query scratch space required to dispatch an execution graph',type='protos']
262e5c31af7Sopenharmony_ci--
263e5c31af7Sopenharmony_ci:refpage: vkGetExecutionGraphPipelineScratchSizeAMDX
264e5c31af7Sopenharmony_ci
265e5c31af7Sopenharmony_ciTo query the scratch space required to dispatch an execution graph, call:
266e5c31af7Sopenharmony_ci
267e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkGetExecutionGraphPipelineScratchSizeAMDX.adoc[]
268e5c31af7Sopenharmony_ci
269e5c31af7Sopenharmony_ci  * pname:device is the that pname:executionGraph was created on.
270e5c31af7Sopenharmony_ci  * pname:executionGraph is the execution graph pipeline to query the
271e5c31af7Sopenharmony_ci    scratch space for.
272e5c31af7Sopenharmony_ci  * pname:pSizeInfo is a pointer to a
273e5c31af7Sopenharmony_ci    slink:VkExecutionGraphPipelineScratchSizeAMDX structure that will
274e5c31af7Sopenharmony_ci    contain the required scratch size.
275e5c31af7Sopenharmony_ci
276e5c31af7Sopenharmony_ciAfter this function returns, information about the scratch space required
277e5c31af7Sopenharmony_ciwill be returned in pname:pSizeInfo.
278e5c31af7Sopenharmony_ci
279e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkGetExecutionGraphPipelineScratchSizeAMDX.adoc[]
280e5c31af7Sopenharmony_ci--
281e5c31af7Sopenharmony_ci
282e5c31af7Sopenharmony_ci[open,refpage='VkExecutionGraphPipelineScratchSizeAMDX',desc='Structure describing the scratch space required to dispatch an execution graph',type='structs']
283e5c31af7Sopenharmony_ci--
284e5c31af7Sopenharmony_ci:refpage: VkExecutionGraphPipelineScratchSizeAMDX
285e5c31af7Sopenharmony_ci
286e5c31af7Sopenharmony_ciThe sname:VkExecutionGraphPipelineScratchSizeAMDX structure is defined as:
287e5c31af7Sopenharmony_ci
288e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkExecutionGraphPipelineScratchSizeAMDX.adoc[]
289e5c31af7Sopenharmony_ci
290e5c31af7Sopenharmony_ci  * pname:sType is a elink:VkStructureType value identifying this structure.
291e5c31af7Sopenharmony_ci  * pname:pNext is `NULL` or a pointer to a structure extending this
292e5c31af7Sopenharmony_ci    structure.
293e5c31af7Sopenharmony_ci  * pname:size indicates the scratch space required for dispatch the queried
294e5c31af7Sopenharmony_ci    execution graph.
295e5c31af7Sopenharmony_ci
296e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkExecutionGraphPipelineScratchSizeAMDX.adoc[]
297e5c31af7Sopenharmony_ci--
298e5c31af7Sopenharmony_ci
299e5c31af7Sopenharmony_ci[open,refpage='vkCmdInitializeGraphScratchMemoryAMDX',desc='Initialize scratch memory for an execution graph',type='protos']
300e5c31af7Sopenharmony_ci--
301e5c31af7Sopenharmony_ci:refpage: vkCmdInitializeGraphScratchMemoryAMDX
302e5c31af7Sopenharmony_ci
303e5c31af7Sopenharmony_ciTo initialize scratch memory for a particular execution graph, call:
304e5c31af7Sopenharmony_ci
305e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdInitializeGraphScratchMemoryAMDX.adoc[]
306e5c31af7Sopenharmony_ci
307e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command will be
308e5c31af7Sopenharmony_ci    recorded.
309e5c31af7Sopenharmony_ci  * pname:scratch is a pointer to the scratch memory to be initialized.
310e5c31af7Sopenharmony_ci
311e5c31af7Sopenharmony_ciThis command must: be called before using pname:scratch to dispatch the
312e5c31af7Sopenharmony_cicurrently bound execution graph pipeline.
313e5c31af7Sopenharmony_ci
314e5c31af7Sopenharmony_ciExecution of this command may: modify any memory locations in the range
315e5c31af7Sopenharmony_ci[pname:scratch,pname:scratch + pname:size), where pname:size is the value
316e5c31af7Sopenharmony_cireturned in slink:VkExecutionGraphPipelineScratchSizeAMDX::pname:size by
317e5c31af7Sopenharmony_cislink:VkExecutionGraphPipelineScratchSizeAMDX for the currently bound
318e5c31af7Sopenharmony_ciexecution graph pipeline.
319e5c31af7Sopenharmony_ciAccesses to this memory range are performed in the
320e5c31af7Sopenharmony_ciename:VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT pipeline stage with the
321e5c31af7Sopenharmony_ciename:VK_ACCESS_2_SHADER_STORAGE_READ_BIT and
322e5c31af7Sopenharmony_ciename:VK_ACCESS_2_SHADER_STORAGE_WRITE_BIT access flags.
323e5c31af7Sopenharmony_ci
324e5c31af7Sopenharmony_ciIf any portion of pname:scratch is modified by any command other than
325e5c31af7Sopenharmony_ciflink:vkCmdDispatchGraphAMDX, flink:vkCmdDispatchGraphIndirectAMDX,
326e5c31af7Sopenharmony_ciflink:vkCmdDispatchGraphIndirectCountAMDX, or
327e5c31af7Sopenharmony_cifname:vkCmdInitializeGraphScratchMemoryAMDX with the same execution graph,
328e5c31af7Sopenharmony_ciit must: be reinitialized for the execution graph again before dispatching
329e5c31af7Sopenharmony_ciagainst it.
330e5c31af7Sopenharmony_ci
331e5c31af7Sopenharmony_ci.Valid Usage
332e5c31af7Sopenharmony_ci****
333e5c31af7Sopenharmony_ci  * [[VUID-vkCmdInitializeGraphScratchMemoryAMDX-scratch-09143]]
334e5c31af7Sopenharmony_ci    pname:scratch must: be the device address of an allocated memory range
335e5c31af7Sopenharmony_ci    at least as large as the value of
336e5c31af7Sopenharmony_ci    slink:VkExecutionGraphPipelineScratchSizeAMDX::pname:size returned by
337e5c31af7Sopenharmony_ci    slink:VkExecutionGraphPipelineScratchSizeAMDX for the currently bound
338e5c31af7Sopenharmony_ci    execution graph pipeline.
339e5c31af7Sopenharmony_ci  * [[VUID-vkCmdInitializeGraphScratchMemoryAMDX-scratch-09144]]
340e5c31af7Sopenharmony_ci    pname:scratch must: be a multiple of 64
341e5c31af7Sopenharmony_ci****
342e5c31af7Sopenharmony_ci
343e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdInitializeGraphScratchMemoryAMDX.adoc[]
344e5c31af7Sopenharmony_ci--
345e5c31af7Sopenharmony_ci
346e5c31af7Sopenharmony_ci
347e5c31af7Sopenharmony_ci== Dispatching a Graph
348e5c31af7Sopenharmony_ci
349e5c31af7Sopenharmony_ciInitial dispatch of an execution graph is done from the host in the same way
350e5c31af7Sopenharmony_cias any other command, and can: be used in a similar way to compute dispatch
351e5c31af7Sopenharmony_cicommands, with indirect variants available.
352e5c31af7Sopenharmony_ci
353e5c31af7Sopenharmony_ci[open,refpage='vkCmdDispatchGraphAMDX',desc='Dispatch an execution graph',type='protos']
354e5c31af7Sopenharmony_ci--
355e5c31af7Sopenharmony_ci:refpage: vkCmdDispatchGraphAMDX
356e5c31af7Sopenharmony_ci
357e5c31af7Sopenharmony_ciTo record an execution graph dispatch, call:
358e5c31af7Sopenharmony_ci
359e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdDispatchGraphAMDX.adoc[]
360e5c31af7Sopenharmony_ci
361e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command will be
362e5c31af7Sopenharmony_ci    recorded.
363e5c31af7Sopenharmony_ci  * pname:scratch is a pointer to the scratch memory to be used.
364e5c31af7Sopenharmony_ci  * pname:pCountInfo is a host pointer to a
365e5c31af7Sopenharmony_ci    slink:VkDispatchGraphCountInfoAMDX structure defining the nodes which
366e5c31af7Sopenharmony_ci    will be initially executed.
367e5c31af7Sopenharmony_ci
368e5c31af7Sopenharmony_ciWhen this command is executed, the nodes specified in pname:pCountInfo are
369e5c31af7Sopenharmony_ciexecuted.
370e5c31af7Sopenharmony_ciNodes executed as part of this command are not implicitly synchronized in
371e5c31af7Sopenharmony_ciany way against each other once they are dispatched.
372e5c31af7Sopenharmony_ci
373e5c31af7Sopenharmony_ciFor this command, all device/host pointers in substructures are treated as
374e5c31af7Sopenharmony_cihost pointers and read only during host execution of this command.
375e5c31af7Sopenharmony_ciOnce this command returns, no reference to the original pointers is
376e5c31af7Sopenharmony_ciretained.
377e5c31af7Sopenharmony_ci
378e5c31af7Sopenharmony_ciExecution of this command may: modify any memory locations in the range
379e5c31af7Sopenharmony_ci[pname:scratch,pname:scratch + pname:size), where pname:size is the value
380e5c31af7Sopenharmony_cireturned in slink:VkExecutionGraphPipelineScratchSizeAMDX::pname:size by
381e5c31af7Sopenharmony_cislink:VkExecutionGraphPipelineScratchSizeAMDX for the currently bound
382e5c31af7Sopenharmony_ciexecution graph pipeline Accesses to this memory range are performed in the
383e5c31af7Sopenharmony_ciename:VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT pipeline stage with the
384e5c31af7Sopenharmony_ciename:VK_ACCESS_2_SHADER_STORAGE_READ_BIT and
385e5c31af7Sopenharmony_ciename:VK_ACCESS_2_SHADER_STORAGE_WRITE_BIT access flags.
386e5c31af7Sopenharmony_ci
387e5c31af7Sopenharmony_ci.Valid Usage
388e5c31af7Sopenharmony_ci****
389e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/dispatch_graph_common.adoc[]
390e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDispatchGraphAMDX-pCountInfo-09145]]
391e5c31af7Sopenharmony_ci    pname:pCountInfo->infos must: be a host pointer to a memory allocation
392e5c31af7Sopenharmony_ci    at least as large as the product of pname:count and pname:stride
393e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDispatchGraphAMDX-infos-09146]]
394e5c31af7Sopenharmony_ci    Host memory locations at indexes in the range [pname:infos, pname:infos
395e5c31af7Sopenharmony_ci    + (pname:count*pname:stride)), at a granularity of pname:stride must:
396e5c31af7Sopenharmony_ci    contain valid slink:VkDispatchGraphInfoAMDX structures in the first 24
397e5c31af7Sopenharmony_ci    bytes
398e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDispatchGraphAMDX-pCountInfo-09147]]
399e5c31af7Sopenharmony_ci    For each slink:VkDispatchGraphInfoAMDX structure in
400e5c31af7Sopenharmony_ci    pname:pCountInfo->infos, pname:payloads must: be a host pointer to a
401e5c31af7Sopenharmony_ci    memory allocation at least as large as the product of pname:payloadCount
402e5c31af7Sopenharmony_ci    and pname:payloadStride
403e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDispatchGraphAMDX-pCountInfo-09148]]
404e5c31af7Sopenharmony_ci    For each slink:VkDispatchGraphInfoAMDX structure in
405e5c31af7Sopenharmony_ci    pname:pCountInfo->infos, pname:nodeIndex must: be a valid node index in
406e5c31af7Sopenharmony_ci    the currently bound execution graph pipeline, as returned by
407e5c31af7Sopenharmony_ci    flink:vkGetExecutionGraphPipelineNodeIndexAMDX
408e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDispatchGraphAMDX-pCountInfo-09149]]
409e5c31af7Sopenharmony_ci    For each slink:VkDispatchGraphInfoAMDX structure in
410e5c31af7Sopenharmony_ci    pname:pCountInfo->infos, host memory locations at indexes in the range
411e5c31af7Sopenharmony_ci    [pname:payloads, pname:payloads + (pname:payloadCount *
412e5c31af7Sopenharmony_ci    pname:payloadStride)), at a granularity of pname:payloadStride must:
413e5c31af7Sopenharmony_ci    contain a payload matching the size of the input payload expected by the
414e5c31af7Sopenharmony_ci    node in pname:nodeIndex in the first bytes
415e5c31af7Sopenharmony_ci****
416e5c31af7Sopenharmony_ci
417e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdDispatchGraphAMDX.adoc[]
418e5c31af7Sopenharmony_ci--
419e5c31af7Sopenharmony_ci
420e5c31af7Sopenharmony_ci[open,refpage='vkCmdDispatchGraphIndirectAMDX',desc='Dispatch an execution graph with node and payload parameters read on the device',type='protos']
421e5c31af7Sopenharmony_ci--
422e5c31af7Sopenharmony_ci:refpage: vkCmdDispatchGraphIndirectAMDX
423e5c31af7Sopenharmony_ci
424e5c31af7Sopenharmony_ciTo record an execution graph dispatch with node and payload parameters read
425e5c31af7Sopenharmony_cion device, call:
426e5c31af7Sopenharmony_ci
427e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdDispatchGraphIndirectAMDX.adoc[]
428e5c31af7Sopenharmony_ci
429e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command will be
430e5c31af7Sopenharmony_ci    recorded.
431e5c31af7Sopenharmony_ci  * pname:scratch is a pointer to the scratch memory to be used.
432e5c31af7Sopenharmony_ci  * pname:pCountInfo is a host pointer to a
433e5c31af7Sopenharmony_ci    slink:VkDispatchGraphCountInfoAMDX structure defining the nodes which
434e5c31af7Sopenharmony_ci    will be initially executed.
435e5c31af7Sopenharmony_ci
436e5c31af7Sopenharmony_ciWhen this command is executed, the nodes specified in pname:pCountInfo are
437e5c31af7Sopenharmony_ciexecuted.
438e5c31af7Sopenharmony_ciNodes executed as part of this command are not implicitly synchronized in
439e5c31af7Sopenharmony_ciany way against each other once they are dispatched.
440e5c31af7Sopenharmony_ci
441e5c31af7Sopenharmony_ciFor this command, all device/host pointers in substructures are treated as
442e5c31af7Sopenharmony_cidevice pointers and read during device execution of this command.
443e5c31af7Sopenharmony_ciThe allocation and contents of these pointers only needs to be valid during
444e5c31af7Sopenharmony_cidevice execution.
445e5c31af7Sopenharmony_ciAll of these addresses will be read in the
446e5c31af7Sopenharmony_ciename:VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT pipeline stage with the
447e5c31af7Sopenharmony_ciename:VK_ACCESS_2_SHADER_STORAGE_READ_BIT access flag.
448e5c31af7Sopenharmony_ci
449e5c31af7Sopenharmony_ciExecution of this command may: modify any memory locations in the range
450e5c31af7Sopenharmony_ci[pname:scratch,pname:scratch + pname:size), where pname:size is the value
451e5c31af7Sopenharmony_cireturned in slink:VkExecutionGraphPipelineScratchSizeAMDX::pname:size by
452e5c31af7Sopenharmony_cislink:VkExecutionGraphPipelineScratchSizeAMDX for the currently bound
453e5c31af7Sopenharmony_ciexecution graph pipeline.
454e5c31af7Sopenharmony_ciAccesses to this memory range are performed in the
455e5c31af7Sopenharmony_ciename:VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT pipeline stage with the
456e5c31af7Sopenharmony_ciename:VK_ACCESS_2_SHADER_STORAGE_READ_BIT and
457e5c31af7Sopenharmony_ciename:VK_ACCESS_2_SHADER_STORAGE_WRITE_BIT access flags.
458e5c31af7Sopenharmony_ci
459e5c31af7Sopenharmony_ci.Valid Usage
460e5c31af7Sopenharmony_ci****
461e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/dispatch_graph_common.adoc[]
462e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDispatchGraphIndirectAMDX-pCountInfo-09150]]
463e5c31af7Sopenharmony_ci    pname:pCountInfo->infos must: be a device pointer to a memory allocation
464e5c31af7Sopenharmony_ci    at least as large as the product of pname:count and pname:stride when
465e5c31af7Sopenharmony_ci    this command is executed on the device
466e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDispatchGraphIndirectAMDX-pCountInfo-09151]]
467e5c31af7Sopenharmony_ci    pname:pCountInfo->infos must: be a device address within a
468e5c31af7Sopenharmony_ci    slink:VkBuffer created with the
469e5c31af7Sopenharmony_ci    ename:VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT flag
470e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDispatchGraphIndirectAMDX-pCountInfo-09152]]
471e5c31af7Sopenharmony_ci    pname:pCountInfo->infos must: be a multiple of
472e5c31af7Sopenharmony_ci    <<limits-executionGraphDispatchAddressAlignment,
473e5c31af7Sopenharmony_ci    pname:executionGraphDispatchAddressAlignment>>
474e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDispatchGraphIndirectAMDX-infos-09153]]
475e5c31af7Sopenharmony_ci    Device memory locations at indexes in the range [pname:infos,
476e5c31af7Sopenharmony_ci    pname:infos + (pname:count*pname:stride)), at a granularity of
477e5c31af7Sopenharmony_ci    pname:stride must: contain valid slink:VkDispatchGraphInfoAMDX
478e5c31af7Sopenharmony_ci    structures in the first 24 bytes when this command is executed on the
479e5c31af7Sopenharmony_ci    device
480e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDispatchGraphIndirectAMDX-pCountInfo-09154]]
481e5c31af7Sopenharmony_ci    For each slink:VkDispatchGraphInfoAMDX structure in
482e5c31af7Sopenharmony_ci    pname:pCountInfo->infos, pname:payloads must: be a device pointer to a
483e5c31af7Sopenharmony_ci    memory allocation at least as large as the product of pname:payloadCount
484e5c31af7Sopenharmony_ci    and pname:payloadStride when this command is executed on the device
485e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDispatchGraphIndirectAMDX-pCountInfo-09155]]
486e5c31af7Sopenharmony_ci    For each slink:VkDispatchGraphInfoAMDX structure in
487e5c31af7Sopenharmony_ci    pname:pCountInfo->infos, pname:payloads must: be a device address within
488e5c31af7Sopenharmony_ci    a slink:VkBuffer created with the
489e5c31af7Sopenharmony_ci    ename:VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT flag
490e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDispatchGraphIndirectAMDX-pCountInfo-09156]]
491e5c31af7Sopenharmony_ci    For each slink:VkDispatchGraphInfoAMDX structure in
492e5c31af7Sopenharmony_ci    pname:pCountInfo->infos, pname:payloads must: be a multiple of
493e5c31af7Sopenharmony_ci    <<limits-executionGraphDispatchAddressAlignment,
494e5c31af7Sopenharmony_ci    pname:executionGraphDispatchAddressAlignment>>
495e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDispatchGraphIndirectAMDX-pCountInfo-09157]]
496e5c31af7Sopenharmony_ci    For each slink:VkDispatchGraphInfoAMDX structure in
497e5c31af7Sopenharmony_ci    pname:pCountInfo->infos, pname:nodeIndex must: be a valid node index in
498e5c31af7Sopenharmony_ci    the currently bound execution graph pipeline, as returned by
499e5c31af7Sopenharmony_ci    flink:vkGetExecutionGraphPipelineNodeIndexAMDX when this command is
500e5c31af7Sopenharmony_ci    executed on the device
501e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDispatchGraphIndirectAMDX-pCountInfo-09158]]
502e5c31af7Sopenharmony_ci    For each slink:VkDispatchGraphInfoAMDX structure in
503e5c31af7Sopenharmony_ci    pname:pCountInfo->infos, device memory locations at indexes in the range
504e5c31af7Sopenharmony_ci    [pname:payloads, pname:payloads + (pname:payloadCount *
505e5c31af7Sopenharmony_ci    pname:payloadStride)), at a granularity of pname:payloadStride must:
506e5c31af7Sopenharmony_ci    contain a payload matching the size of the input payload expected by the
507e5c31af7Sopenharmony_ci    node in pname:nodeIndex in the first bytes when this command is executed
508e5c31af7Sopenharmony_ci    on the device
509e5c31af7Sopenharmony_ci****
510e5c31af7Sopenharmony_ci
511e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdDispatchGraphIndirectAMDX.adoc[]
512e5c31af7Sopenharmony_ci--
513e5c31af7Sopenharmony_ci
514e5c31af7Sopenharmony_ci[open,refpage='vkCmdDispatchGraphIndirectCountAMDX',desc='Dispatch an execution graph with all parameters read on the device',type='protos']
515e5c31af7Sopenharmony_ci--
516e5c31af7Sopenharmony_ci:refpage: vkCmdDispatchGraphIndirectCountAMDX
517e5c31af7Sopenharmony_ci
518e5c31af7Sopenharmony_ciTo record an execution graph dispatch with all parameters read on device,
519e5c31af7Sopenharmony_cicall:
520e5c31af7Sopenharmony_ci
521e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdDispatchGraphIndirectCountAMDX.adoc[]
522e5c31af7Sopenharmony_ci
523e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command will be
524e5c31af7Sopenharmony_ci    recorded.
525e5c31af7Sopenharmony_ci  * pname:scratch is a pointer to the scratch memory to be used.
526e5c31af7Sopenharmony_ci  * pname:countInfo is a device address of a
527e5c31af7Sopenharmony_ci    slink:VkDispatchGraphCountInfoAMDX structure defining the nodes which
528e5c31af7Sopenharmony_ci    will be initially executed.
529e5c31af7Sopenharmony_ci
530e5c31af7Sopenharmony_ciWhen this command is executed, the nodes specified in pname:countInfo are
531e5c31af7Sopenharmony_ciexecuted.
532e5c31af7Sopenharmony_ciNodes executed as part of this command are not implicitly synchronized in
533e5c31af7Sopenharmony_ciany way against each other once they are dispatched.
534e5c31af7Sopenharmony_ci
535e5c31af7Sopenharmony_ciFor this command, all pointers in substructures are treated as device
536e5c31af7Sopenharmony_cipointers and read during device execution of this command.
537e5c31af7Sopenharmony_ciThe allocation and contents of these pointers only needs to be valid during
538e5c31af7Sopenharmony_cidevice execution.
539e5c31af7Sopenharmony_ciAll of these addresses will be read in the
540e5c31af7Sopenharmony_ciename:VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT pipeline stage with the
541e5c31af7Sopenharmony_ciename:VK_ACCESS_2_SHADER_STORAGE_READ_BIT access flag.
542e5c31af7Sopenharmony_ci
543e5c31af7Sopenharmony_ciExecution of this command may: modify any memory locations in the range
544e5c31af7Sopenharmony_ci[pname:scratch,pname:scratch + pname:size), where pname:size is the value
545e5c31af7Sopenharmony_cireturned in slink:VkExecutionGraphPipelineScratchSizeAMDX::pname:size by
546e5c31af7Sopenharmony_cislink:VkExecutionGraphPipelineScratchSizeAMDX for the currently bound
547e5c31af7Sopenharmony_ciexecution graph pipeline.
548e5c31af7Sopenharmony_ciAccesses to this memory range are performed in the
549e5c31af7Sopenharmony_ciename:VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT pipeline stage with the
550e5c31af7Sopenharmony_ciename:VK_ACCESS_2_SHADER_STORAGE_READ_BIT and
551e5c31af7Sopenharmony_ciename:VK_ACCESS_2_SHADER_STORAGE_WRITE_BIT access flags.
552e5c31af7Sopenharmony_ci
553e5c31af7Sopenharmony_ci.Valid Usage
554e5c31af7Sopenharmony_ci****
555e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/dispatch_graph_common.adoc[]
556e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDispatchGraphIndirectCountAMDX-countInfo-09159]]
557e5c31af7Sopenharmony_ci    pname:countInfo must: be a device pointer to a memory allocation
558e5c31af7Sopenharmony_ci    containing a valid slink:VkDispatchGraphCountInfoAMDX structure when
559e5c31af7Sopenharmony_ci    this command is executed on the device
560e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDispatchGraphIndirectCountAMDX-countInfo-09160]]
561e5c31af7Sopenharmony_ci    pname:countInfo must: be a device address within a slink:VkBuffer
562e5c31af7Sopenharmony_ci    created with the ename:VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT flag
563e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDispatchGraphIndirectCountAMDX-countInfo-09161]]
564e5c31af7Sopenharmony_ci    pname:countInfo must: be a multiple of
565e5c31af7Sopenharmony_ci    <<limits-executionGraphDispatchAddressAlignment,
566e5c31af7Sopenharmony_ci    pname:executionGraphDispatchAddressAlignment>>
567e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDispatchGraphIndirectCountAMDX-countInfo-09162]]
568e5c31af7Sopenharmony_ci    pname:countInfo->infos must: be a device pointer to a memory allocation
569e5c31af7Sopenharmony_ci    at least as large as the product of pname:count and pname:stride when
570e5c31af7Sopenharmony_ci    this command is executed on the device
571e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDispatchGraphIndirectCountAMDX-countInfo-09163]]
572e5c31af7Sopenharmony_ci    pname:countInfo->infos must: be a device address within a slink:VkBuffer
573e5c31af7Sopenharmony_ci    created with the ename:VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT flag
574e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDispatchGraphIndirectCountAMDX-countInfo-09164]]
575e5c31af7Sopenharmony_ci    pname:countInfo->infos must: be a multiple of
576e5c31af7Sopenharmony_ci    <<limits-executionGraphDispatchAddressAlignment,
577e5c31af7Sopenharmony_ci    pname:executionGraphDispatchAddressAlignment>>
578e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDispatchGraphIndirectCountAMDX-infos-09165]]
579e5c31af7Sopenharmony_ci    Device memory locations at indexes in the range [pname:infos,
580e5c31af7Sopenharmony_ci    pname:infos + (pname:count*pname:stride)), at a granularity of
581e5c31af7Sopenharmony_ci    pname:stride must: contain valid slink:VkDispatchGraphInfoAMDX
582e5c31af7Sopenharmony_ci    structures in the first 24 bytes when this command is executed on the
583e5c31af7Sopenharmony_ci    device
584e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDispatchGraphIndirectCountAMDX-countInfo-09166]]
585e5c31af7Sopenharmony_ci    For each slink:VkDispatchGraphInfoAMDX structure in
586e5c31af7Sopenharmony_ci    pname:countInfo->infos, pname:payloads must: be a device pointer to a
587e5c31af7Sopenharmony_ci    memory allocation at least as large as the product of pname:payloadCount
588e5c31af7Sopenharmony_ci    and pname:payloadStride when this command is executed on the device
589e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDispatchGraphIndirectCountAMDX-countInfo-09167]]
590e5c31af7Sopenharmony_ci    For each slink:VkDispatchGraphInfoAMDX structure in
591e5c31af7Sopenharmony_ci    pname:countInfo->infos, pname:payloads must: be a device address within
592e5c31af7Sopenharmony_ci    a slink:VkBuffer created with the
593e5c31af7Sopenharmony_ci    ename:VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT flag
594e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDispatchGraphIndirectCountAMDX-countInfo-09168]]
595e5c31af7Sopenharmony_ci    For each slink:VkDispatchGraphInfoAMDX structure in
596e5c31af7Sopenharmony_ci    pname:countInfo->infos, pname:payloads must: be a multiple of
597e5c31af7Sopenharmony_ci    <<limits-executionGraphDispatchAddressAlignment,
598e5c31af7Sopenharmony_ci    pname:executionGraphDispatchAddressAlignment>>
599e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDispatchGraphIndirectCountAMDX-countInfo-09169]]
600e5c31af7Sopenharmony_ci    For each slink:VkDispatchGraphInfoAMDX structure in
601e5c31af7Sopenharmony_ci    pname:countInfo->infos, pname:nodeIndex must: be a valid node index in
602e5c31af7Sopenharmony_ci    the currently bound execution graph pipeline, as returned by
603e5c31af7Sopenharmony_ci    flink:vkGetExecutionGraphPipelineNodeIndexAMDX when this command is
604e5c31af7Sopenharmony_ci    executed on the device
605e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDispatchGraphIndirectCountAMDX-countInfo-09170]]
606e5c31af7Sopenharmony_ci    For each slink:VkDispatchGraphInfoAMDX structure in
607e5c31af7Sopenharmony_ci    pname:countInfo->infos, device memory locations at indexes in the range
608e5c31af7Sopenharmony_ci    [pname:payloads, pname:payloads + (pname:payloadCount *
609e5c31af7Sopenharmony_ci    pname:payloadStride)), at a granularity of pname:payloadStride must:
610e5c31af7Sopenharmony_ci    contain a payload matching the size of the input payload expected by the
611e5c31af7Sopenharmony_ci    node in pname:nodeIndex in the first bytes when this command is executed
612e5c31af7Sopenharmony_ci    on the device
613e5c31af7Sopenharmony_ci****
614e5c31af7Sopenharmony_ci
615e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdDispatchGraphIndirectCountAMDX.adoc[]
616e5c31af7Sopenharmony_ci--
617e5c31af7Sopenharmony_ci
618e5c31af7Sopenharmony_ci[open,refpage='VkDeviceOrHostAddressConstAMDX',desc='Union specifying a const device or host address',type='structs']
619e5c31af7Sopenharmony_ci--
620e5c31af7Sopenharmony_ci:refpage: VkDeviceOrHostAddressConstAMDX
621e5c31af7Sopenharmony_ci
622e5c31af7Sopenharmony_ciThe sname:VkDeviceOrHostAddressConstAMDX union is defined as:
623e5c31af7Sopenharmony_ci
624e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkDeviceOrHostAddressConstAMDX.adoc[]
625e5c31af7Sopenharmony_ci
626e5c31af7Sopenharmony_ci  * pname:deviceAddress is a buffer device address as returned by the
627e5c31af7Sopenharmony_ci    flink:vkGetBufferDeviceAddressKHR command.
628e5c31af7Sopenharmony_ci  * pname:hostAddress is a const host memory address.
629e5c31af7Sopenharmony_ci
630e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkDeviceOrHostAddressConstAMDX.adoc[]
631e5c31af7Sopenharmony_ci--
632e5c31af7Sopenharmony_ci
633e5c31af7Sopenharmony_ci[open,refpage='VkDispatchGraphCountInfoAMDX',desc='Structure specifying count parameters for execution graph dispatch',type='structs',xrefs='vkCmdDispatchGraphIndirectCountAMDX']
634e5c31af7Sopenharmony_ci--
635e5c31af7Sopenharmony_ci:refpage: VkDispatchGraphCountInfoAMDX
636e5c31af7Sopenharmony_ci
637e5c31af7Sopenharmony_ciThe sname:VkDispatchGraphCountInfoAMDX structure is defined as:
638e5c31af7Sopenharmony_ci
639e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkDispatchGraphCountInfoAMDX.adoc[]
640e5c31af7Sopenharmony_ci
641e5c31af7Sopenharmony_ci  * pname:count is the number of dispatches to perform.
642e5c31af7Sopenharmony_ci  * pname:infos is the device or host address of a flat array of
643e5c31af7Sopenharmony_ci    slink:VkDispatchGraphInfoAMDX structures
644e5c31af7Sopenharmony_ci  * pname:stride is the byte stride between successive
645e5c31af7Sopenharmony_ci    slink:VkDispatchGraphInfoAMDX structures in pname:infos
646e5c31af7Sopenharmony_ci
647e5c31af7Sopenharmony_ciWhether pname:infos is consumed as a device or host pointer is defined by
648e5c31af7Sopenharmony_cithe command this structure is used in.
649e5c31af7Sopenharmony_ci
650e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkDispatchGraphCountInfoAMDX.adoc[]
651e5c31af7Sopenharmony_ci--
652e5c31af7Sopenharmony_ci
653e5c31af7Sopenharmony_ci[open,refpage='VkDispatchGraphInfoAMDX',desc='Structure specifying node parameters for execution graph dispatch',type='structs',xrefs='VkDispatchGraphCountInfoAMDX']
654e5c31af7Sopenharmony_ci--
655e5c31af7Sopenharmony_ci:refpage: VkDispatchGraphInfoAMDX
656e5c31af7Sopenharmony_ci
657e5c31af7Sopenharmony_ciThe sname:VkDispatchGraphInfoAMDX structure is defined as:
658e5c31af7Sopenharmony_ci
659e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkDispatchGraphInfoAMDX.adoc[]
660e5c31af7Sopenharmony_ci
661e5c31af7Sopenharmony_ci  * pname:nodeIndex is the index of a node in an execution graph to be
662e5c31af7Sopenharmony_ci    dispatched.
663e5c31af7Sopenharmony_ci  * pname:payloadCount is the number of payloads to dispatch for the
664e5c31af7Sopenharmony_ci    specified node.
665e5c31af7Sopenharmony_ci  * pname:payloads is a device or host address pointer to a flat array of
666e5c31af7Sopenharmony_ci    payloads with size equal to the product of pname:payloadCount and
667e5c31af7Sopenharmony_ci    pname:payloadStride
668e5c31af7Sopenharmony_ci  * pname:payloadStride is the byte stride between successive payloads in
669e5c31af7Sopenharmony_ci    pname:payloads
670e5c31af7Sopenharmony_ci
671e5c31af7Sopenharmony_ciWhether pname:payloads is consumed as a device or host pointer is defined by
672e5c31af7Sopenharmony_cithe command this structure is used in.
673e5c31af7Sopenharmony_ci
674e5c31af7Sopenharmony_ci.Valid Usage
675e5c31af7Sopenharmony_ci****
676e5c31af7Sopenharmony_ci  * [[VUID-VkDispatchGraphInfoAMDX-payloadCount-09171]]
677e5c31af7Sopenharmony_ci    pname:payloadCount must: be no greater than
678e5c31af7Sopenharmony_ci    <<limits-maxExecutionGraphShaderPayloadCount,
679e5c31af7Sopenharmony_ci    pname:maxExecutionGraphShaderPayloadCount>>
680e5c31af7Sopenharmony_ci****
681e5c31af7Sopenharmony_ci
682e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkDispatchGraphInfoAMDX.adoc[]
683e5c31af7Sopenharmony_ci--
684e5c31af7Sopenharmony_ci
685e5c31af7Sopenharmony_ci
686e5c31af7Sopenharmony_ci== Shader Enqueue
687e5c31af7Sopenharmony_ci
688e5c31af7Sopenharmony_ciCompute shaders in an execution graph can: use the
689e5c31af7Sopenharmony_cicode:OpInitializeNodePayloadsAMDX to initialize nodes for dispatch.
690e5c31af7Sopenharmony_ciAny node payload initialized in this way will be enqueued for dispatch once
691e5c31af7Sopenharmony_cithe shader is done writing to the payload.
692e5c31af7Sopenharmony_ciAs compilers may: be conservative when making this determination, shaders
693e5c31af7Sopenharmony_cican: further call code:OpFinalizeNodePayloadsAMDX to guarantee that the
694e5c31af7Sopenharmony_cipayload is no longer being written.
695e5c31af7Sopenharmony_ci
696e5c31af7Sopenharmony_ciThe code:Node code:Name operand of the code:PayloadNodeNameAMDX decoration
697e5c31af7Sopenharmony_cion a payload identifies the shader name of the node to be enqueued, and the
698e5c31af7Sopenharmony_cicode:Shader code:Index operand of code:OpInitializeNodePayloadsAMDX
699e5c31af7Sopenharmony_ciidentifies the shader index.
700e5c31af7Sopenharmony_ciA node identified in this way is dispatched as described in the following
701e5c31af7Sopenharmony_cisections.
702e5c31af7Sopenharmony_ci
703e5c31af7Sopenharmony_ci
704e5c31af7Sopenharmony_ci=== Compute Nodes
705e5c31af7Sopenharmony_ci
706e5c31af7Sopenharmony_ciCompute shaders added as nodes to an execution graph are executed
707e5c31af7Sopenharmony_cidifferently based on the presence or absence of the
708e5c31af7Sopenharmony_cicode:StaticNumWorkgroupsAMDX or code:CoalescingAMDX execution modes.
709e5c31af7Sopenharmony_ci
710e5c31af7Sopenharmony_ciDispatching a compute shader node that does not declare either the
711e5c31af7Sopenharmony_cicode:StaticNumWorkgroupsAMDX or code:CoalescingAMDX execution mode will
712e5c31af7Sopenharmony_ciexecute a number of workgroups in each dimension specified by the first 12
713e5c31af7Sopenharmony_cibytes of the payload, interpreted as a slink:VkDispatchIndirectCommand.
714e5c31af7Sopenharmony_ciThe same payload will be broadcast to each workgroup in the same dispatch.
715e5c31af7Sopenharmony_ciAdditional values in the payload are have no effect on execution.
716e5c31af7Sopenharmony_ci
717e5c31af7Sopenharmony_ciDispatching a compute shader node with the code:StaticNumWorkgroupsAMDX
718e5c31af7Sopenharmony_ciexecution mode will execute workgroups in each dimension according to the
719e5c31af7Sopenharmony_cicode:x, code:y, and code:z code:size operands to the
720e5c31af7Sopenharmony_cicode:StaticNumWorkgroupsAMDX execution mode.
721e5c31af7Sopenharmony_ciThe same payload will be broadcast to each workgroup in the same dispatch.
722e5c31af7Sopenharmony_ciAny values in the payload have no effect on execution.
723e5c31af7Sopenharmony_ci
724e5c31af7Sopenharmony_ciDispatching a compute shader node with the code:CoalescingAMDX execution
725e5c31af7Sopenharmony_cimode will enqueue a single invocation for execution.
726e5c31af7Sopenharmony_ciImplementations may: combine multiple such dispatches into the same
727e5c31af7Sopenharmony_ciworkgroup, up to the size of the workgroup.
728e5c31af7Sopenharmony_ciThe number of invocations coalesced into a given workgroup in this way can:
729e5c31af7Sopenharmony_cibe queried via the <<interfaces-builtin-variables-coalescedinputcountamd,
730e5c31af7Sopenharmony_cicode:CoalescedInputCountAMDX>> built-in.
731e5c31af7Sopenharmony_ciAny values in the payload have no effect on execution.
732