tracy icon indicating copy to clipboard operation
tracy copied to clipboard

VkCtx::Calibrate can be stuck in an infinite loop, freezing our render thread

Open VincentHypx opened this issue 1 year ago • 2 comments

After roughly 3 minutes of running the profiler on a laptop using the vulkan backend, the calibration values returned by m_vkGetCalibratedTimestampsEXT are never below the expected deviation, therefore it stays stuck in this loop.

Our project is very demanding, my current guess is that the video card changes behaviour because of the workload Either it's struggling with our render demands or it enters a different energy mode, who knows. Either way, it ends up delivering less accurate calibration results.

Would it be possible to add a retry approach, so attempt to pass the desired deviation threshold and if it fails after say 8 retries, it would chose the result that had the least amount of deviation?

Of course, if you have a better solution, it would be more than welcome.

Here's the while loop in question https://github.com/wolfpld/tracy/blob/e26c34346bed7667118ff6dce6b1aa118701efa3/public/tracy/TracyVulkan.hpp#L357C1-L363C42

VincentHypx avatar Aug 28 '24 14:08 VincentHypx

I'm also experiencing this issue, to a lesser extent. Sometimes, the Calibrate call will take a very long time (e.g. 16ms), with hundreds of vkGetCalibratedTimestampsEXT calls being emitted.

maxime-modulopi avatar May 28 '25 09:05 maxime-modulopi

I've had success working around this issue by collecting in a separate thread, but I'm not 100% sure this is thread-safe on the Tracy size

maxime-modulopi avatar Aug 22 '25 12:08 maxime-modulopi