Skip to content

Commit a46eef2

Browse files
authored
Merge branch 'main' into Availability-dashboard
2 parents 45a282b + fd44171 commit a46eef2

File tree

8 files changed

+3307
-14
lines changed

8 files changed

+3307
-14
lines changed

.github/workflows/CI.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ jobs:
4444
- name: awesome_bot
4545
run: |
4646
gem install awesome_bot
47-
awesome_bot --request-delay 2 -t 20 --allow-redirect --allow-dupe chapters/*.adoc chapters/extensions/*.adoc --white-list https://apps.apple.com/,https://www.youtube.com/,https://khr.io/slack,https://www.khronos.org/opengl/
47+
awesome_bot --request-delay 2 -t 20 --allow-redirect --allow-dupe chapters/*.adoc chapters/extensions/*.adoc --white-list http://schemas.android.com/apk/res/android.xsd,https://apps.apple.com/,https://www.youtube.com/,https://khr.io/slack,https://www.khronos.org/opengl/

README.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ The Vulkan Guide can be built as a single page using `asciidoctor guide.adoc`
6666

6767
== xref:{chapters}deprecated.adoc[Deprecated]
6868

69+
== xref:{chapters}windowing_audio_input.adoc[Windowing, Audio, and Input]
70+
71+
== xref:{chapters}ide.adoc[Development Environments & IDEs]
72+
6973
== xref:{chapters}vulkan_profiles.adoc[Vulkan Profiles]
7074

7175
== xref:{chapters}loader.adoc[Loader]

antora/modules/ROOT/nav.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
** xref:{chapters}portability_initiative.adoc[]
1818
** xref:{chapters}vulkan_cts.adoc[]
1919
** xref:{chapters}development_tools.adoc[]
20+
** xref:{chapters}ide.adoc[]
2021
** xref:{chapters}validation_overview.adoc[]
2122
** xref:{chapters}decoder_ring.adoc[]
2223
* Using Vulkan
@@ -30,6 +31,7 @@
3031
*** xref:{chapters}formats.adoc[]
3132
** xref:{chapters}queues.adoc[]
3233
** xref:{chapters}wsi.adoc[]
34+
** xref:{chapters}windowing_audio_input.adoc[]
3335
** xref:{chapters}pnext_and_stype.adoc[]
3436
** xref:{chapters}synchronization.adoc[]
3537
*** xref:{chapters}extensions/VK_KHR_synchronization2.adoc[]

chapters/buffer_device_address.adoc

Lines changed: 82 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,88 @@ OpStore %ptr %obj Aligned 16
8181

8282
Shading languages will have a default, but can allow you to align it explicitly (ex `buffer_reference_alignment`).
8383

84-
The goal of this alignment is this is a promise for how aligned this specific pointer is. The user is responsible to confirm the address they use is aligned to it.
84+
The goal of this alignment is this is a promise for how aligned this specific pointer is.
85+
The compiler has no idea what the address will be when the shader is compiled.
86+
By providing an alignment it can generate valid code to match the requirement.
87+
The user is responsible to confirm the address they use is aligned to it.
88+
89+
[source,glsl]
90+
----
91+
layout(buffer_reference, buffer_reference_align = 64) buffer MyBDA {
92+
uint data;
93+
};
94+
95+
MyBDA ptr_a; // at 0x1000
96+
MyBDA ptr_b; // at 0x1010
97+
MyBDA ptr_c; // at 0x1040
98+
99+
ptr_a.data = 0; // (Aligned 64) valid!
100+
ptr_b.data = 0; // (Aligned 64) invalid!
101+
ptr_c.data = 0; // (Aligned 64) valid!
102+
----
103+
104+
When deciding on an alignment, the minimum value will always be the size greater than or equal to the largest scalar/component type in the block.
105+
106+
[source,glsl]
107+
----
108+
// alignment must be at least 4
109+
layout(buffer_reference) buffer MyBDA {
110+
vec4 a; // scalar is float
111+
};
112+
113+
// alignment must be at least 1
114+
layout(buffer_reference) buffer MyBDA {
115+
uint8_t a; // scalar is 8-bit int
116+
};
117+
118+
// alignment must be at least 8
119+
layout(buffer_reference) buffer MyBDA {
120+
uint a; // 32-bit
121+
double b; // 64-bit
122+
};
123+
----
124+
125+
=== Alignment Example
126+
127+
To help explain alignment, lets take an example of loading an array of vectors
128+
129+
[source,glsl]
130+
----
131+
layout(buffer_reference, buffer_reference_align = ???) buffer MyBDA {
132+
uvec4 data[];
133+
};
134+
135+
MyBDA ptr; // at 0x1000
136+
ptr.data[i] = uvec4(0);
137+
----
138+
139+
Here we have 2 options, we could set the `Aligned` to be `4` or `16`.
140+
141+
If we set alignment to `16` we are letting the compiler know it can load 16 bytes at a time, so it will hopefully do a vector load/store on the memory.
142+
143+
If we set alignment to `4` the compiler will likely have no way to infer the real alignment and will now do 4 scalar int load/store on the memory.
144+
145+
[NOTE]
146+
====
147+
Some GPUs can do vector load/store even on unaligned addresses.
148+
====
149+
150+
For the next case, if we had `uvec3` instead of `uvec4` such as
151+
152+
[source,glsl]
153+
----
154+
layout(buffer_reference, buffer_reference_align = 4, scalar) buffer MyBDA {
155+
uvec3 data[];
156+
};
157+
158+
data[0]; // 0x1000
159+
data[1]; // 0x100C
160+
data[2]; // 0x1018
161+
data[3]; // 0x1024
162+
----
163+
164+
We know that setting the alignment to `16` would be violated at `data[1]` and therefore we need to use an alignment of `4` in this case.
165+
Luckily shading languages will help do this for you as seen in both link:https://godbolt.org/z/jWGKax1ed[glslang] and link:https://godbolt.org/z/Y7xW3Mfd4[slang] .
85166

86167
=== Nullptr
87168

chapters/development_tools.adoc

Lines changed: 103 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Layers are optional components that augment the Vulkan system. They can intercep
2424
The validation layer included multiple features:
2525
** link:https://vulkan.lunarg.com/doc/sdk/latest/windows/synchronization_usage.html[Synchronization Validation]: Identify resource access conflicts due to missing or incorrect synchronization operations between actions (Draw, Copy, Dispatch, Blit) reading or writing the same regions of memory.
2626
** link:https://vulkan.lunarg.com/doc/sdk/latest/windows/gpu_validation.html[GPU-Assisted Validation]: Instrument shader code to perform run-time checks for error conditions produced during shader execution.
27-
** link:https://vulkan.lunarg.com/doc/sdk/latest/windows/debug_printf.html[Shader printf]: Debug shader code by "`printing`" any values of interest to the debug callback or stdout.
27+
** link:https://vulkan.lunarg.com/doc/sdk/latest/windows/debug_printf.html[Shader printf]: Debug shader code by "`printing`" any values of interest to the debug callback or stdout. Environment variables provide a fast path for enabling this feature without code changes.
2828
** link:https://vulkan.lunarg.com/doc/sdk/latest/windows/best_practices.html[Best Practices Warnings]: Highlights potential performance issues, questionable usage patterns, common mistakes.
2929

3030
=== Vulkan SDK layers
@@ -60,7 +60,7 @@ There are also other publicly available layers that can be used to help in devel
6060
* link:https://developer.qualcomm.com/software/adreno-gpu-sdk/tools[`VK_LAYER_adreno`], the Vulkan Adreno Layer.
6161
Checks Vulkan applications for best practices on Qualcomm Adreno devices.
6262

63-
== Debugging
63+
== Debugging
6464

6565
Debugging something running on a GPU can be incredibly hard, luckily there are tools out there to help.
6666

@@ -78,16 +78,107 @@ The following tools help debug crashes.
7878
* link:https://gpuopen.com/radeon-gpu-detective[AMD GPU detective]
7979
* link:https://developer.nvidia.com/nsight-aftermath[NVIDIA Nsight Aftermath SDK]
8080

81+
=== Shader Debugging
82+
83+
Debugging shaders requires specialized tools and techniques. For comprehensive guidance on shader debugging in Vulkan applications, including:
84+
85+
* Shader debugging tools and their IDE integration
86+
* GPU-Assisted Validation for shader debugging
87+
* Shader printf techniques for both GLSL and HLSL
88+
* IDE-specific shader debugging configurations
89+
* Best practices for shader debugging workflows
90+
91+
See the xref:{chapters}ide.adoc#shader-debugging[Shader Debugging Integration] section in the Development Environments & IDEs chapter.
92+
93+
[[profiling]]
8194
== Profiling
8295

83-
With anything related to a GPU it is best to not assume and profile when possible. Here is a list of known profilers to aid in your development.
96+
With anything related to a GPU it is best to not assume and profile when possible. Profiling tools can help identify performance bottlenecks, analyze GPU workloads, and optimize your Vulkan applications. For IDE-specific profiling integration, see the xref:{chapters}ide.adoc[Development Environments & IDEs] chapter.
8497

85-
* link:https://gpuopen.com/rgp/[AMD Radeon GPU Profiler] - Low-level performance analysis tool for AMD Radeon GPUs.
86-
* link:https://developer.android.com/agi[Android GPU Inspector (AGI)] - Google's profiler for the Android platform with support for Vulkan
87-
* link:https://developer.arm.com/Tools%20and%20Software/Streamline%20Performance%20Analyzer[Arm Streamline Performance Analyzer] - Visualize the performance of mobile games and applications for a broad range of devices, using Arm Mobile Studio.
88-
* link:https://www.intel.com/content/www/us/en/developer/tools/graphics-performance-analyzers/overview.html[Intel(R) GPA] - Intel's Graphics Performance Analyzers that supports capturing and analyzing multi-frame streams of Vulkan apps.
89-
* link:https://developer.nvidia.com/nsight-graphics[NVIDIA Nsight]
90-
* link:https://github.com/GPUOpen-Tools/OCAT[OCAT] - The Open Capture and Analytics Tool (OCAT) provides an FPS overlay and performance measurement for D3D11, D3D12, and Vulkan.
91-
* link:https://developer.imaginationtech.com[PVRTune]
92-
* link:https://developer.qualcomm.com/software/snapdragon-profiler[Qualcomm Snapdragon Profiler] - Profiling tool targeting Adreno GPU.
93-
* link:https://www.vktracer.com[VKtracer] - Cross-vendor and cross-platform profiler.
98+
=== Vendor-Specific Profiling Tools
99+
100+
==== AMD
101+
102+
* link:https://gpuopen.com/rgp/[AMD Radeon GPU Profiler (RGP)] - Low-level performance analysis tool for AMD Radeon GPUs.
103+
** Provides detailed timing information for Vulkan API calls and GPU workloads
104+
** Visualizes the rendering pipeline and identifies bottlenecks
105+
** Supports hardware-based ray tracing analysis
106+
** Integrates with xref:{chapters}ide.adoc#visual-studio[Visual Studio] through the Radeon Developer Panel
107+
108+
==== NVIDIA
109+
110+
* link:https://developer.nvidia.com/nsight-graphics[NVIDIA Nsight Graphics] - Comprehensive graphics debugger and profiler for NVIDIA GPUs.
111+
** Provides frame debugging, GPU trace capture, and performance analysis
112+
** Supports Vulkan API debugging and optimization
113+
** Includes shader profiling and memory analysis
114+
** Integrates with xref:{chapters}ide.adoc#visual-studio[Visual Studio] and can be used standalone
115+
116+
==== ARM
117+
118+
* link:https://developer.arm.com/Tools%20and%20Software/Streamline%20Performance%20Analyzer[Arm Streamline Performance Analyzer] - Performance analysis tool for Arm-based devices.
119+
** Visualizes the performance of mobile games and applications
120+
** Provides CPU, GPU, and system-level performance metrics
121+
** Supports Vulkan workload analysis
122+
** Part of Arm Mobile Studio, which integrates with various IDEs
123+
124+
==== Imagination Technologies
125+
126+
* link:https://developer.imaginationtech.com[PVRTune] - Performance analysis tool for PowerVR GPUs.
127+
** Provides real-time hardware performance metrics
128+
** Supports Vulkan API tracing and analysis
129+
** Helps identify bottlenecks in PowerVR-based devices
130+
** Works with xref:{chapters}ide.adoc#android-studio[Android Studio] for mobile development
131+
132+
==== Qualcomm
133+
134+
* link:https://developer.qualcomm.com/software/snapdragon-profiler[Qualcomm Snapdragon Profiler] - Profiling tool targeting Adreno GPUs.
135+
** Provides detailed GPU metrics for Qualcomm Snapdragon devices
136+
** Supports Vulkan API trace capture and analysis
137+
** Includes shader profiling and optimization suggestions
138+
** Integrates with xref:{chapters}ide.adoc#android-studio[Android Studio] for Android development
139+
140+
=== Platform-Specific Profiling Tools
141+
142+
==== Android
143+
144+
* link:https://developer.android.com/agi[Android GPU Inspector (AGI)] - Google's profiler for the Android platform.
145+
** Provides Vulkan API tracing and GPU performance analysis
146+
** Supports system trace correlation with GPU workloads
147+
** Helps identify rendering bottlenecks on Android devices
148+
** Integrates with xref:{chapters}ide.adoc#android-studio[Android Studio]
149+
150+
=== Cross-Platform Profiling Tools
151+
152+
* link:https://github.com/GPUOpen-Tools/OCAT[OCAT] (Open Capture and Analytics Tool) - FPS overlay and performance measurement tool.
153+
** Provides real-time FPS monitoring and performance metrics
154+
** Supports D3D11, D3D12, and Vulkan
155+
** Generates detailed performance reports
156+
** Works alongside any development environment
157+
158+
* link:https://www.vktracer.com[VKtracer] - Cross-vendor and cross-platform Vulkan profiler.
159+
** Captures and analyzes Vulkan API calls
160+
** Works with all Vulkan-compatible GPUs
161+
** Provides timing information and bottleneck identification
162+
** Compatible with various development environments
163+
164+
* link:https://vulkan.lunarg.com/doc/sdk/latest/windows/capture_tools.html[GFXReconstruct] - Frame capture and replay tool for Vulkan.
165+
** Captures Vulkan API calls for later analysis
166+
** Supports cross-platform capture and replay
167+
** Helps identify performance issues and bugs
168+
** Included in the Vulkan SDK and works with all major IDEs
169+
170+
=== Profiling Best Practices
171+
172+
When profiling Vulkan applications, consider the following best practices:
173+
174+
1. **Start with validation layers**: Before profiling, ensure your application passes validation to avoid measuring performance of incorrect code.
175+
176+
2. **Profile on target hardware**: Performance characteristics can vary significantly between different GPUs and platforms.
177+
178+
3. **Use vendor-specific tools** for the most detailed insights on specific hardware.
179+
180+
4. **Combine CPU and GPU profiling** to identify bottlenecks across the entire rendering pipeline.
181+
182+
5. **Profile regularly** throughout development to catch performance regressions early.
183+
184+
For IDE-specific profiling workflows, refer to the relevant sections in the xref:{chapters}ide.adoc[Development Environments & IDEs] chapter.

0 commit comments

Comments
 (0)