GPU Performance API Interface
The GPU Performance API (GPA) interface gives access to GPU performance counters, streaming performance monitors (SPM), and thread traces (SQTT), which help analyze the performance and execution characteristics of applications.
GPU Performance API Objects
Beginning, ending, copying, and resetting a session
Performance counters are sampled between calls to vkCmdBeginGpaSessionAMD and vkCmdEndGpaSessionAMD. As long as they are executed in order, vkCmdBeginGpaSessionAMD and vkCmdEndGpaSessionAMD can span multiple command buffers.
If a session is reused after calling vkCmdEndGpaSessionAMD, the session must first be reset using vkResetGpaSessionAMD.
Executing secondary command buffers multiple times, that themselves record results into sessions, causes their results to be overwritten. To prevent results from being lost due to subsequent executions, the results can be copied into another session.
The source of the copy is the GPA session handle provided when
gpaSession was created.
Resetting a session object has less overhead than destroying and then creating a new one.
Beginning and ending sampling
Once a session has begun, samples can then be captured during the command buffer execution.
Controlling GPU clocks
For performance counters and thread tracing to produce meaningful results, clock control and querying is available.
Session status and results querying
A return value of VK_SUCCESS indicates that the results are available
to be read using vkGetGpaSessionResultsAMD.
If results are not available, VK_NOT_READY is returned.
If pData is NULL, then the number of bytes of data in the results is
returned in pSizeInBytes.
Otherwise, pSizeInBytes must point to a variable set by the
application to the number of elements in the pData array, and on
return the variable is overwritten with the number of bytes written to
pData.
If the value of pSizeInBytes is less than the size required to write
the results VK_INCOMPLETE will be returned instead of
VK_SUCCESS, to indicate that the results were not written.