r/vulkan • • 3d ago

Explicit Queue Ownership Transfer

Windows 11, RTX 5060 (617.14), Vulkan SDK 1.4.335.0

Layers in effect = VK_LAYER_KHRONOS_synchronization2, VK_LAYER_KHRONOS_validation,

VK_LAYER_LUNARG_monitor

Application shares a storage image, created as VK_SHARING_MODE_EXCLUSIVE, between Graphics and Compute pipelines using queues from their respective Queue Families.

Graphics Queue Family (index = 0) is different than Compute Queue Family(index = 2).

I am NOT using a vkCmdPipelineBarrier() with VkImageMemoryBarrier (or VkMemoryBarrier) in between compute and graphics pipeline commands which is not the correct way, but I am not getting any validation messages for this critical omission.

Vulkan Configurator screenshot
0 Upvotes

7 comments sorted by

2

u/Jojonobody2 2d ago

Do you have validation for synchronization enabled, I'm fairly sure it's not on by default?

-2

u/Tensorizer 2d ago

Layers in effect = VK_LAYER_KHRONOS_synchronization2, VK_LAYER_KHRONOS_validation,

VK_LAYER_LUNARG_monitor

3

u/bonkt 2d ago

VK_LAYER_KHRONOS_synchronization2 is not validation. that is used to emulate its functionality on HW/drivers that dont natively support it. You have to ensure inside the VK_LAYER_KHRONOS_validation that the synchronization validation is turned on.

0

u/Cyphall 2d ago

Don't enable validation via code, use the Vulkan Configurator that comes with the SDK so that you can actually configure validation

1

u/Tensorizer 2d ago

Added screenshot

0

u/Cyphall 2d ago edited 2d ago

Thinking back about your original issue, it may be expected to not see any validation error, depending on how you use the image in the 2nd queue after using it in the 1st.

The spec says that accessing an exclusive resource on another queue without proper QFOT makes the accessed data undefined, but it is not forbidden.
In fact, not using a QFOT when you do not need the content anymore is the expected usage:

If an application does not need the contents of a resource to remain valid when transferring from one queue family to another, then the ownership transfer should be skipped.

0

u/computron 1d ago

The setting for synchronization validation is on the right when the configuration (top left) or validation layer (bottom left) is selected. There's a drop down that lets you pick between some predefined settings, or you can toggle it under "user-defined settings". Look for "Synchronization" under "CPU Centric Validation". It can make things kinda slow so it's helpful to be able to turn it off sometimes.