# vkCmdInitializeGraphScratchMemoryAMDX(3) Manual Page

## Name

vkCmdInitializeGraphScratchMemoryAMDX - Initialize scratch memory for an execution graph

Loading… please wait.

## C Specification

To initialize scratch memory for a particular execution graph, call:

    // Provided by VK_AMDX_shader_enqueue
    void vkCmdInitializeGraphScratchMemoryAMDX(
        VkCommandBuffer                             commandBuffer,
        VkPipeline                                  executionGraph,
        VkDeviceAddress                             scratch,
        VkDeviceSize                                scratchSize);

## Parameters

- `commandBuffer` is the command buffer into which the command will be recorded.

- `executionGraph` is the execution graph pipeline to initialize the scratch memory for.

- `scratch` is the address of scratch memory to be initialized.

- `scratchSize` is a range in bytes of scratch memory to be initialized.

## Description

This command must be called before using `scratch` to dispatch the bound execution graph pipeline.

Execution of this command may modify any memory locations in the range [`scratch`,`scratch` + `scratchSize`). Accesses to this memory range are performed in the `VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT` pipeline stage with the `VK_ACCESS_2_SHADER_STORAGE_READ_BIT` and `VK_ACCESS_2_SHADER_STORAGE_WRITE_BIT` access flags.

If any portion of `scratch` is modified by any command other than vkCmdDispatchGraphAMDX, vkCmdDispatchGraphIndirectAMDX, vkCmdDispatchGraphIndirectCountAMDX, or vkCmdInitializeGraphScratchMemoryAMDX with the same execution graph, it must be reinitialized for the execution graph again before dispatching against it.

Valid Usage

- VUID-vkCmdInitializeGraphScratchMemoryAMDX-scratch-10185
  `scratch` must be the device address of an allocated memory range at least as large as `scratchSize`

- VUID-vkCmdInitializeGraphScratchMemoryAMDX-scratchSize-10186
  `scratchSize` must be greater than or equal to VkExecutionGraphPipelineScratchSizeAMDX::`minSize` returned by vkGetExecutionGraphPipelineScratchSizeAMDX for the bound execution graph pipeline

- VUID-vkCmdInitializeGraphScratchMemoryAMDX-scratch-09144
  `scratch` must be a multiple of 64

Valid Usage (Implicit)

- VUID-vkCmdInitializeGraphScratchMemoryAMDX-commandBuffer-parameter
  `commandBuffer` must be a valid VkCommandBuffer handle

- VUID-vkCmdInitializeGraphScratchMemoryAMDX-executionGraph-parameter
  `executionGraph` must be a valid VkPipeline handle

- VUID-vkCmdInitializeGraphScratchMemoryAMDX-commandBuffer-recording
  `commandBuffer` must be in the recording state

- VUID-vkCmdInitializeGraphScratchMemoryAMDX-commandBuffer-cmdpool
  The `VkCommandPool` that `commandBuffer` was allocated from must support graphics, or compute operations

- VUID-vkCmdInitializeGraphScratchMemoryAMDX-videocoding
  This command must only be called outside of a video coding scope

- VUID-vkCmdInitializeGraphScratchMemoryAMDX-bufferlevel
  `commandBuffer` must be a primary `VkCommandBuffer`

- VUID-vkCmdInitializeGraphScratchMemoryAMDX-commonparent
  Both of `commandBuffer`, and `executionGraph` must have been created, allocated, or retrieved from the same VkDevice

Host Synchronization

- Host access to the `VkCommandPool` that `commandBuffer` was allocated from must be externally synchronized

Command Properties

Command Buffer Levels | Render Pass Scope | Video Coding Scope | Supported Queue Types | Command Type
--- | --- | --- | --- | ---
Primary | Both | Outside | Graphics Compute | Action

## See Also

VK_AMDX_shader_enqueue, VkCommandBuffer, VkDeviceAddress, VkDeviceSize, VkPipeline

## Document Notes

For more information, see the Vulkan Specification

This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly.

## Copyright

Copyright 2014-2025 The Khronos Group Inc.

SPDX-License-Identifier: CC-BY-4.0