tracy
tracy copied to clipboard
Vulkan GPU instrumentation could be unreliable because VkCtx::NextQueryId() is not thread safe
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.