tracy icon indicating copy to clipboard operation
tracy copied to clipboard

Vulkan GPU instrumentation could be unreliable because VkCtx::NextQueryId() is not thread safe

Open egorodet opened this issue 11 months ago • 1 comments

VkCtx::NextQueryId() from TracyVulkan.hpp is not thread safe (it updates non-atomic members without critical section), while this function is called from VkCtxScope constructors and destructor, which can be used from multiple threads where command buffers are recorded. So query ids may become unrealizable and lead to undefined behavior in scenarios with multi-threaded command buffers recording.

I found that D3D12QueueCtx::NextQueryId() function from TracyD3D12.hpp is implemented in thread safe way using std::atomic for m_queryCounter. So this issue is not applicable for DirectX 12.

egorodet avatar Jul 19 '23 15:07 egorodet