You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: chapters/buffer_device_address.adoc
+82-1Lines changed: 82 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -81,7 +81,88 @@ OpStore %ptr %obj Aligned 16
81
81
82
82
Shading languages will have a default, but can allow you to align it explicitly (ex `buffer_reference_alignment`).
83
83
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.
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
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] .
@@ -24,7 +24,7 @@ Layers are optional components that augment the Vulkan system. They can intercep
24
24
The validation layer included multiple features:
25
25
** 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.
26
26
** 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.
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]]
81
94
== Profiling
82
95
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.
* 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.
* 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.
0 commit comments