8000 Add RenderDoc API calls to profile Vulkan backend (non-presenting) · Issue #20558 · iree-org/iree · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add RenderDoc API calls to profile Vulkan backend (non-presenting) #20558

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
giacs-epic opened this issue Apr 16, 2025 · 3 comments
Closed

Add RenderDoc API calls to profile Vulkan backend (non-presenting) #20558

giacs-epic opened this issue Apr 16, 2025 · 3 comments
Labels
enhancement ➕ New feature or request hal/vulkan Runtime Vulkan GPU HAL backend

Comments

@giacs-epic
Copy link
Contributor

Request description

RenderDoc can only capture headless (non-presenting) via the in-application API.
Add calls to StartFrameCapture() and EndFrameCapture() in iree-run-module and iree-benchmark-module.

What component(s) does this issue relate to?

Runtime

Additional context

No response

@giacs-epic giacs-epic added the enhancement ➕ New feature or request label Apr 16, 2025
@kuhar kuhar added the hal/vulkan Runtime Vulkan GPU HAL backend label Apr 16, 2025
@kuhar
Copy link
Member
kuhar commented Apr 16, 2025

As an alternative, how hard would it be to present some (empty) frames (to a null/virtual surface)? I think this would potentially help with more profilers than just renderdoc.

@ScottTodd
Copy link
Member

We should already be using the renderdoc API, since #10893. That code is quite old though, so it may need some debugging/updating.

@benvanik
Copy link
Collaborator
benvanik commented Apr 28, 2025

Yeah, the API as implemented in #10893 is the right way to go. It worked as of last summer. See https://iree.dev/developers/performance/profiling-gpu-vulkan/#renderdoc.

@kuhar I have a branch floating around that did that but it's an opt-in at cmake configure time because of how heavy-weight it is (pulls in WSI goo and requires platform-specific tricks, and the tools I was testing with did not pick up null/virtual surfaces so I had to create offscreen windows and other things that only work in certain contexts). You can check it out at main...benvanik:iree:users/benvanik/vk-present - it wasn't reliable enough to use, though, as the tools I tried it with (that don't have an API or capture without the need for frame swaps) were also bad enough to do things like always ignore the first N frames, only capture when the user hits a hotkey, or only capture when the application has focus (which with an offscreen window doesn't happen).

I also had a branch for RGP that used their API: main...users/benvanik/rgp that was significantly more reliable than the offscreen window trick but their "API" is a trashfire that was unreliable enough to not be useful. It raced itself and you'd have to do 10+ capture requests and hope at least one of them captured. RenderDoc does this itself internally because it's so broken: https://github.com/baldurk/renderdoc/blob/788a0ca98fac37c35a66be5fcb9ccc9197df7f34/renderdoc/replay/replay_controller.cpp#L1755
(note that renderdoc can do this loop because it can restart its state by reloading the entire replay and reinitializing everything - we can't generally as we have stateful programs that we would have to reload, reinitialize, and potentially replay a great many steps such as when profiling step 590 of a transformer - or build a whole capture tool to save off buffer state to disk so we could replay - neat, but yuck :).

Sucks, but tools that hook into the process and don't provide an API to trigger a capture reliably aren't really worth supporting outside of hacks - they break too often and are too difficult to test ;(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ➕ New feature or request hal/vulkan Runtime Vulkan GPU HAL backend
Projects
None yet
Development

No branches or pull requests

4 participants
0