Skip to content

Fix test_vulkan_interop_image descriptor/command-buffer reuse hazard in useSingleImageKernel path - #2805

Open
shajder wants to merge 2 commits into
KhronosGroup:mainfrom
shajder:vulkan_VL_interop_image_command_buffer_fence
Open

shajder wants to merge 2 commits into
KhronosGroup:mainfrom
shajder:vulkan_VL_interop_image_command_buffer_fence

Conversation

@shajder

@shajder shajder commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Fixes #2800

Environment: rusticl -> Zink -> Lavapipe (software), Mesa 26.3.0-devel, LLVM 17.0.6, VK_LAYER_KHRONOS_validation 1.4.313, Vulkan instance 1.4.358.

Fixes VUID-vkUpdateDescriptorSets-None-03047 and VUID-vkBeginCommandBuffer-commandBuffer-00049, only visible with options --useSingleImageKernel --useValidationLayers together.

vkDescriptorSet and vkCopyCommandBuffer were reused across the per-image loop in run_test_with_one_queue and run_test_with_two_queue without waiting for the previous iteration's dispatch to finish. Added a VulkanFence to synchronize reuse.

@rjodinchr rjodinchr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain why we should use a VulkanFence and not just call waitIdle?
If we keep VulkanFence, I think we should use std::make_shared instead of new, and we could have something like that:

if (i2DIdx < vkImage2DList->size() - 1)
{
  vkQueue.submit(...);
  vkImageDispatchFence->wait();
  vkImageDispatchFence->reset();
}

@shajder

shajder commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

Can you explain why we should use a VulkanFence and not just call waitIdle?

vkQueueWaitIdle drains the whole queue; from Khronos's own guidance (Vulkan-Samples wait_idle sample):

Don't: Use vkQueueWaitIdle() or vkDeviceWaitIdle() unless absolutely necessary for less granular synchronisation.
Do: Use Fences to asynchronously read back data to the CPU.

...

If we keep VulkanFence, I think we should use std::make_shared instead of new...

Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test_image_single_queue FAILED with --useSingleImageKernel when num2DImages > 1

4 participants