Skip to content

Low Vulkan <-> OpenGL interop performance #76

@MennoVink

Description

@MennoVink

Vulkan

  • VK_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME
  • VK_KHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME
  • VK_KHR_EXTERNAL_FENCE_WIN32_EXTENSION_NAME

OpenGL

  • GL_EXT_memory_object
  • GL_EXT_memory_object_win32
  • GL_EXT_semaphore
  • GL_EXT_semaphore_win32

As far as i'm aware this is all that i need to achieve high performance Vulkan to and from OpenGL interoperability. I'm using memory sharing to keep texture data on the GPU and i'm using semaphores so that (in theory) i can keep the pipeline fed without any cpu/gpu sync. My implementation works great on hardware/drivers from a different vendor, but on AMD hardware i'm getting suboptimal performance.

Manual instrumentation shows large amounts of time being spent somewhere inside glSignalSemaphoreEXT. I'm not sure how reliable sampling is without the driver's symbols, but fwiw it shows that the time ends up being spent in GetSettingsBlobsAll. Obviously the driver is a black box to me, but my hunch is that cross-api semaphores aren't really implemented and it does a queue flush, resulting in sync and idle time.
Realistically speaking i need the performance issue solved, and if it's indeed a driver issue i need automated QC in this area on the driver to prevent future interop issues as outlined under the link provided below.
If you nee a repro i can probably cook something up, just assessing if there's any interest in this area before i do that though.

Hardware
RX 7900 XT
driver 25.9.1

Use Case
I'm working on a professional media server controlling audio, video and lights. Our target audience are artists performing anywhere in that space, for example local bars, clubs, theatres, television shows and large outdoor festivals. As for the video side of things you can think of the software as a compositor. Users play/generate video content, apply effects to it and mix it together before projecting it on to the stage.
Great performers provide unique experiences to visitors of any of these venues. This is why our application supports plugins. Plugins are critical to get some stages going, and for historic reasons but also future simplicity, they're implemented using OpenGL.
This is why i'm creating this issue. For us interop is not just an intermediate stage we have to pass through while porting the rest of the application. It's an actual feature we need for years to come and then some more years after that.

Insufficient Workarounds

  • We are replacing 80% of plugins by a custom programming environment, the rest is too unique/custom to support in any non-plugin matter.
  • Plugins could in theory become vulkan, but vulkan is already hard for professional programmers. Our plugin developers are mostly artists picking up programming just to get something done. Vulkan is too much to ask, nor would we trust them to not make us lose the device.
  • There's a good writeup about Zink here https://developer.x-plane.com/2023/02/addressing-plugin-flickering/. I've tried that same path but zink shows too many anomalies to be usable.

Metadata

Metadata

Assignees

Labels

OpenGLThis is an issue with OpenGL driver

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions