cancel
Showing results for 
Search instead for 
Did you mean: 

OpenGL & Vulkan

JorgeInsua
Journeyman III

Vulkan Timestamp of two different Command Buffers

Hello, 

 

I want to submit two command buffers in one vkQueueSubmit() call, and then using vulkan timestamps in both command buffers to measure how much time their are executing at the same time on the GPU, that is, to measure the overlapping time between them by using the vulkan timestamps.

Do both Command Buffers share the same clock when they execute in the same queue? And when they execute in the same family queue but in a different queue?

The GPU i´m using it´s the AMD Radeon E9171. 

Thank you in advance!

0 Likes
4 Replies
dipak
Big Boss

Hi @JorgeInsua ,

Thanks for your query. I will forward the query to the Vulkan team.

Thanks.

0 Likes

Hey JorgeInsua,

For command buffer ordering see this:
https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#synchronization-implicit
"The order in which command buffers are specified in the pCommandBuffers member of VkSubmitInfo or VkSubmitInfo2 from lowest index to highest."

The vulkan spec guarantees a certain order the command buffer will be started when submitted to the same queue (not when the submission will be finished). For the family queues, it depends on which type of queue it is, usually graphics would have only a single hardware queue, other queues depends on GPU. At lower levels it depends on the GPU scheduler and the amount of items in the queue. Command buffers submitted to different queues, even the same family have no guarantees to be synchronized, however depending on type there could be some sort of start ordering. They wouldn't share the same clock.

Separate command buffer submissions have no guarantees of synchronization, usually semaphores are used to achieve synchronization between submissions.

This is a good resource to understand more about timestamps:
https://nikitablack.github.io/post/how_to_use_vulkan_timestamp_queries/

Thanks,

Owen

0 Likes

Hello Owen Zhang,

thank you for your reply.

In the case I submit both command buffers in the same submit, they are dispatched in the same order they are in the pCommandBuffers member of VkSubmitInfo, but they can be executed out of order in the GPU?

Another question, vkCmdWriteTimestamp calls in two different CommandBuffers force synchronization between both commandBuffers? or the synchronization scopes of the vkCmdWriteTimestamp calls only affect the command buffer where their are called?

 

thank you!!

0 Likes

In the case I submit both command buffers in the same submit, they are dispatched in the same order they are in the pCommandBuffers member of VkSubmitInfo, but they can be executed out of order in the GPU?

In general that's correct, but the driver can chain together command buffers in the backend so no guarantees are made of completion, only dispatch.

Another question, vkCmdWriteTimestamp calls in two different CommandBuffers force synchronization between both commandBuffers? or the synchronization scopes of the vkCmdWriteTimestamp calls only affect the command buffer where their are called?

The latter in general but you should look at VkPipelineStageFlagBits during vkCmdWriteTimestamp for batch submits.

0 Likes