blob: c7b98f5227fe29b74a0499d12c2f91e4f2dbca65 [file] [view] [edit]
# GPU Dump
As more extensions move towards the GPU, the objective is to ensure tools like [GPU-Assisted Validation](./gpu_validation.md) are utilized.
In reality, every tool occupies a specific spot on the debugging spectrum. A tool designed to simply "print out" GPU information was missing, so `GPU Dump` was added.
The goal is to provide a tool similar to API Dump, but with several key differences:
- **State Tracking:** It provides all addresses and GPU information that VVL maintains from its state tracking.
- **Conciseness:** While API Dump is verbose, this tool only prints the commands relevant to the user.
- **Data Capture:** It captures the data of the `VkBuffer` at the moment the command buffer is recorded.
The options for all extensions are available in **VkConfig** (and are also available as a preset).
# Goals
It is perfectly valid to update the memory after recording a command buffer, which means GPU Dump will never be 100% accurate. Getting that information requires the more expensive GPU-AV.
The goal of GPU Dump was to provide a fast/lite tool that can still provide a lot of **useful** information.
It can be viewed as a glorified `printf` aimed at extensions, such as `VK_EXT_descriptor_heap`, where there is a lot of information to keep track of.
# Use GPU Dump as supplemental validation
GPU Dump will **never** give an error, but it will give both `warning` and `info` level messages.
By turning off `info`, but leaving on `warning`, you can use GPU Dump to provide warnings when it notices, at command buffer recording time, that a potential issue will occur.
## Wanting all the information
If both `warning` and `info` level messages are on, all the info will be printed.
# Supported extensions
- `VK_EXT_descriptor_heap`
- `VK_LAYER_GPU_DUMP_DESCRIPTORS`/`gpu_dump_descriptors`
- `VK_EXT_descriptor_buffer`
- `VK_LAYER_GPU_DUMP_DESCRIPTORS`/`gpu_dump_descriptors`
- `VK_KHR_copy_memory_indirect`
- `VK_LAYER_GPU_DUMP_COPY_MEMORY_INDIRECT`/`gpu_dump_copy_memory_indirect`
- `VK_EXT_device_generated_commands`
- `VK_LAYER_GPU_DUMP_DEVICE_GENERATED_COMMANDS`/`gpu_dump_device_generated_commands`
# Options
There is currently a `VK_LAYER_GPU_DUMP_TO_STDOUT` option to allow printing directly to `stdout` in case you don't want to use the debug callback.
We are very happy to hear about additional options people feel would be helpful!
# Example
Using the "GPU Dump Descriptor" [setting](./settings.md):
```bash
export VK_LAYER_GPU_DUMP_DESCRIPTORS=1
# optional
export VK_LAYER_GPU_DUMP_TO_STDOUT=1
```
In this example, the compute shader will look like this:
```glsl
layout (set = 0, binding = 0) buffer SSBO_0 {
uint data;
} ssbo[8];
```
When performing a dispatch with `VK_EXT_descriptor_heap`, you will see output such as:
```
Validation Warning: [ GPU-DUMP ] | MessageID = 0xe5c5edc1
vkCmdDispatch(): [Dump Descriptor] (VkCommandBuffer 0x5ae561283160, VkPipeline 0x1e000000001e)
- vkCmdBindResourceHeapEXT last bound the resource heap to [0x300000000, 0x300000100) (no reserved range)
- VkBuffer 0x30000000003, size: 256 bytes, range: [0x300000000, 0x300000100)
- Last bound pipeline: VkPipeline 0x1e000000001e (VK_PIPELINE_BIND_POINT_COMPUTE)
- Shader descriptors:
[VK_SHADER_STAGE_COMPUTE_BIT] VkShaderModule 0x1c000000001c
- SPIR-V Set 0:
- SPIR-V Binding 0 ["ssbo"]
- specified in pMappings[0] - VK_DESCRIPTOR_MAPPING_SOURCE_HEAP_WITH_CONSTANT_OFFSET_EXT
- heapOffset: 0x0, heapArrayStride: 64
- Resource heap address: 0x300000000 + (descriptor_index * 64)
The final descriptor index at [7] will access [0x3000001c0, 0x300000200)
- Descriptor size: 64 (VK_DESCRIPTOR_TYPE_STORAGE_BUFFER)
- [WARNING] OUT OF BOUNDS - descriptor has an array length of [8] but any element starting at index [4] will be out of bounds of the heap and any access to those indexes will be invalid
```
GPU Dump prints the mapping of where the heap will be read from, but it also issues a `warning`:
> [WARNING] OUT OF BOUNDS - descriptor has an array length of [8] but any element starting at index [4] will be out of bounds of the heap and any access to those indexes will be invalid
This helps catch errors where, if the user accesses `ssbo[4]`, it will actually be out of bounds of the bound descriptor heap memory.
This time, if we update it to be a runtime descriptor array, such as
```
layout (set = 0, binding = 0) buffer SSBO_0 {
uint data;
} ssbo[];
```
GPU Dump will print the first index of your runtime descriptor array that is no longer inside the heap.
```
Validation Information: [ GPU-DUMP ] | MessageID = 0xe5c5edc1
vkCmdDispatch(): [Dump Descriptor] (VkCommandBuffer 0x5ae561283160, VkPipeline 0xc000000000c)
- vkCmdBindResourceHeapEXT last bound the resource heap to [0x300000000, 0x300000100) (no reserved range)
- VkBuffer 0x30000000003, size: 256 bytes, range: [0x300000000, 0x300000100)
- Last bound pipeline: VkPipeline 0xc000000000c (VK_PIPELINE_BIND_POINT_COMPUTE)
- Shader descriptors:
[VK_SHADER_STAGE_COMPUTE_BIT] VkShaderModule 0xa000000000a
- SPIR-V Set 0:
- SPIR-V Binding 0 ["ssbo"]
- specified in pMappings[0] - VK_DESCRIPTOR_MAPPING_SOURCE_HEAP_WITH_CONSTANT_OFFSET_EXT
- heapOffset: 0x0, heapArrayStride: 64
- Resource heap address: 0x300000000 + (descriptor_index * 64)
The descriptor runtime array will be out of bounds of the heap starting at index [4]
- Descriptor size: 64 (VK_DESCRIPTOR_TYPE_STORAGE_BUFFER)
```