Applications and Limitations of Vulkan-Layer-based Instrumentation
Creators: Cheung, Deric A
Publisher: name: University of Alberta Library
Year: 2024

<p>The field of computer graphics is constantly evolving to meet the demands of modern applications.<br>
One such evolution is the introduction of low-level Application Programming Interfaces (APIs) such as Vulkan to give applications a greater amount of control over the hardware to facilitate efficient CPU-GPU interoperability and fine-grained scheduling and synchronization of work for the GPU.<br>
Despite the low-level nature of Vulkan, there is still a great deal of execution behaviors that are not well understood or are difficult to observe due to black-box hardware and driver implementations.<br>
To better understand these behaviors, the Vulkan layer system has been leveraged to profile and debug Vulkan applications by intercepting and modifying the behavior of Vulkan API function calls.<br>
The Vulkan layer system has been used to develop frameworks like Vulkan Vision, which employs shader instrumentation to capture shader execution traces and analyzes them to reveal shader execution behaviors such as control-flow divergence, Independent Thread Scheduling on NVIDIA GPUs, and execution hotspots.<br>
This thesis further explores the applications and limitations of the Vulkan layer system for analyzing execution behaviors of Vulkan applications to better understand and optimize their performance.</p>

<p>One of the contributions of this thesis is ReRay — an extensible toolchain and workflow for capturing, parsing, analyzing, and manipulating ray-tracing pipeline execution traces to better understand ray-tracing pipeline execution behaviors down to the hardware and driver level.<br>
Building on top of prior work with Vulkan Vision, ReRay provides insights into how ray-tracing pipelines interact with the hardware and driver to facilitate the development of more efficient ray-tracing algorithms and applications.<br>
Black-box hardware and driver execution behaviors impacting ray-tracing performance such as warp execution order, shader execution divergence, and unnecessary intersection tests are revealed with the use of ReRay. </p>

<p>This thesis also explores the use of Vulkan layers to examine the management and usage of shader resources.<br>
Utilizing Vulkan&#39;s resource binding model efficiently can be challenging due to the complexity of managing many pipeline variants expecting varying types and numbers of resources for use by its shaders.<br>
A Vulkan layer is proposed to observe and evaluate the usage of resources in Vulkan applications, with an additional focus on uniform data — data that remains constant for all shader invocations of an executing pipeline.<br>
Uniform data is used for a variety of purposes, such as passing transformation matrices, lighting parameters, and material properties to shaders.<br>
Depending on the size, update frequency, and usage of uniform data, Vulkan features such as push constants, inline uniform blocks, and specialization constants can be used to optimize the management of uniform data to reduce the memory access and GPU state-change overheads associated with managing and using uniform data.</p>

<p>In spite of the power granted to Vulkan layers, the Vulkan API and the Vulkan Vision framework have limitations that prevent Vulkan layers from being used to examine cutting-edge hardware features such as Shader Execution Reordering on Ada Lovelace NVIDIA GPUs.<br>
Inefficiencies also arise when constructing a Vulkan layer to examine shader resource contents without application-specific context or knowledge.<br>
Further limitations in the Vulkan API prevent practical automatic optimization of shader-resource usage on behalf of an application by a application-agnostic Vulkan layer.<br>
A discussion of advancements in the Vulkan API, hardware features, and the design of graphics renderers in game engines also highlights the changing landscape of shader resource management in Vulkan applications.<br>
These changes make some aspects of shader resource management and uniform data optimizations less relevant to modern Vulkan applications.</p>