wolfpld / tracy

Frame profiler

Home Page:https://tracy.nereid.pl/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Application hangs when connecting to profiler, only when GPU events have been submitted

heyallnorahere opened this issue · comments

commented

I am writing a graphics framework in C#, using these Tracy bindings, linked in the Tracy README. When my application (the neural net project entitled MachineLearning) connects to the profiler, and GPU zones have been submitted, the client application mysteriously freezes.

Steps to reproduce:

  • Run on Ubuntu 22.04.3 LTS
  • Clone this repository at commit 3833acd
  • Build the project on the Debug configuration
  • Run dotnet Playground/MachineLearning/bin/Debug/net7.0/MachineLearning.dll
  • Hit "Start" on the Training window
  • Connect to the Tracy GUI (using v0.10)

The application should freeze in Core/CodePlayground.Graphics/Vulkan/VulkanProfiler.cs on line 90. (Function TracyEmitGpuZoneBeginSerial)

commented

Reproduced on Windows 11 - though this doesn't hang on the D3D11 example program. Weird.

commented

Not an issue with the Vulkan context implementation - I just tested the Vulkan backend with a C++ project, and I 1:1 translated the Vulkan context code into my C# codebase. Will continue testing.

commented

I have verified that replacing the Tracy build used by my C# project via P/Invoke does not fix the issue. I believe this is a problem with the C API. (commit be697f9 on code-playground)

commented

In fact, debugging native code shows that this is an access violation in tracy::Profiler::SendString calling strlen on an unallocated string. I have verified that I do not pass such a pointer to Tracy (logging all memory allocated by my profiler interface and cross-referencing with pointers provided by the debugger). I do not have insight into how the Tracy client library operates, and so I'm not sure where such a pointer would be passed.

What is the call stack leading to SendString?

commented

On the "Tracy Profiler" thread:
image

There are certain requirements for the lifetime of data passed to the profiler (detailed in the manual). Your description suggests that the bindings you are using do not meet these requirements. I would suggest creating an issue in that repository, as this does not seem to be a Tracy issue.

commented

Got it. Thanks.

commented

Problem solved. This was an issue with me calling ___tracy_emit_gpu_zone_begin_serial instead of ___tracy_emit_gpu_zone_begin_alloc_serial. My bad.