mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:30:52 +01:00
[PR #470] [MERGED] vulkan: every submission starts with a full memory barrier, as an ExecuteCommandLists boundary (VK-SUBMIT-BARRIER) #521
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#521
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/470
Author: @Kokonotcu
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @QemmHD
Base:
main← Head:pr/submission-barrier📝 Commits (2)
6e81b92Every submission starts with a full memory barrier (ExecuteCommandLists boundary)9f9a503Submission barrier: not on a context without vkCmdPipelineBarrier📊 Changes
2 files changed (+71 additions, -0 deletions)
View changed files
📝
runtime/src/vulkan_backend.h(+12 -0)📝
runtime/test/vk_queue_test.cpp(+59 -0)📄 Description
Claim: VK-SUBMIT-BARRIER (#14).
What was wrong: D3D12 ends every
ExecuteCommandListswith its work done and its writes visible to the next submission on the queue. Implicit state decay relies on it, and a list may touch memory an earlier submission wrote without any barrier (two submissions copying into one buffer, say). Vulkan orders submissions on a queue only by their barriers, and nothing in aVulkanQueue's command buffer ordered it after the previous one. Synchronization validation reports it invk_queue_test's back-to-back copies into one buffer: WRITE_AFTER_WRITE between submissions, 10 errors, the test fails underLEONIDA_VK_VALIDATION=1.What changed:
execute_nowrecords anALL_COMMANDS -> ALL_COMMANDSmemory barrier (MEMORY_WRITE -> MEMORY_READ | MEMORY_WRITE) right aftervkBeginCommandBuffer. The second commit skips it on a context withoutvkCmdPipelineBarrier:replay_query_edges_test's mocked context has none, and the first commit alone crashed that test.Cost: one global memory barrier per submitted command buffer. Execution order between submissions is unchanged; the barrier only makes writes visible.
Tests:
vk_queue_test4b counts the command buffers begun and those whose first barrier is this one, over two submissions each on the direct and the copy queue: 4 of 4 (0 before).Tested on Windows 10, i7-11800H, RTX 3080 Laptop (NVIDIA driver), on
main8f481cf16, withLEONIDA_VK_VALIDATION=1:vk_queuepasses with 0 validation errors,replay_query_edgespasses. On our cumulative branch the GPU tests (^(d3d12_|vk_)) under validation pass with this in place.🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.