Implement an abstract Fence type to expose waiting for command buffer completion.#1007
Implement an abstract Fence type to expose waiting for command buffer completion.#1007manon-traverse wants to merge 3 commits intollvm:mainfrom
Conversation
|
@manon-traverse - is this |
|
#987 was merged, is it time to rebase this? |
@damyanp No it's mainly waiting for the metal-cpp update PR to get merged in: #1004 |
bcf1180 to
41f208f
Compare
damyanp
left a comment
There was a problem hiding this comment.
It's hard to convince myself this is the right abstraction since I don't think anything is actually using the abstraction - as far as I can tell, there isn't anything actually using the fence through the Fence interface?
The abstract is being used. However it is just being used for waiting for work completion by waiting on the signal value. Once @MarijnS95's work on command buffer submission on the queue is completed the Fence will be signaled by that function. Currently, the API-agnostic and API-specific code is fairly intertwined. As we get more of the graphics APIs covered in the API agnostic code this will become less of a problem. |
Move command buffer submission logic from each backend's Device into Queue::submit(), which takes ownership of the command buffers. For now it blocks internally until completion; a TODO marks that it will return a Fence once the Fence abstraction from PR llvm#1007 is available. - Metal: commit + waitUntilCompleted + error check - Vulkan: vkEndCommandBuffer + temporary fence + vkQueueSubmit + wait - DX12: CmdList Close + ExecuteCommandLists + fence signal/wait VulkanQueue now stores a VkDevice handle (with a TODO for lifetime management) so it can create/destroy fences independently. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move command buffer submission logic from each backend's Device into Queue::submit(), which takes ownership of the command buffers. For now it blocks internally until completion; a TODO marks that it will return a Fence once the Fence abstraction from PR llvm#1007 is available. - Metal: commit + waitUntilCompleted + error check - Vulkan: vkEndCommandBuffer + temporary fence + vkQueueSubmit + wait - DX12: CmdList Close + ExecuteCommandLists + fence signal/wait VulkanQueue now stores a VkDevice handle (with a TODO for lifetime management) so it can create/destroy fences independently. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move command buffer submission logic from each backend's Device into Queue::submit(), which takes ownership of the command buffers. For now it blocks internally until completion; a TODO marks that it will return a Fence once the Fence abstraction from PR llvm#1007 is available. - Metal: commit + waitUntilCompleted + error check - Vulkan: vkEndCommandBuffer + temporary fence + vkQueueSubmit + wait - DX12: CmdList Close + ExecuteCommandLists + fence signal/wait VulkanQueue now stores a VkDevice handle (with a TODO for lifetime management) so it can create/destroy fences independently. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move command buffer submission logic from each backend's Device into Queue::submit(), which takes ownership of the command buffers. For now it blocks internally until completion; a TODO marks that it will return a Fence once the Fence abstraction from PR llvm#1007 is available. - Metal: commit() + waitUntilCompleted() - Vulkan: vkEndCommandBuffer() + vkQueueSubmit() with temporary fence + vkWaitForFences() - DX12: CmdList::Close() + ExecuteCommandLists() + Queue::Signal()/Fence::SetEventOnCompletion() wait VulkanQueue now stores a VkDevice handle (with a TODO for lifetime management) so it can create/destroy fences independently. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move command buffer submission logic from each backend's Device into Queue::submit(), which takes ownership of the command buffers. For now it blocks internally until completion; a TODO marks that it will return a Fence once the Fence abstraction from PR llvm#1007 is available. - Metal: commit() + waitUntilCompleted() - Vulkan: vkEndCommandBuffer() + vkQueueSubmit() with temporary fence + vkWaitForFences() - DX12: CmdList::Close() + ExecuteCommandLists() + Queue::Signal()/Fence::SetEventOnCompletion() wait VulkanQueue now stores a VkDevice handle (with a TODO for lifetime management) so it can create/destroy fences independently. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The Fence type is modeled around the DX12 Fence. The closest equivalent in Vulkan is a Timeline Semaphore. These are widely supported and included in Vulkan 1.2. Metal provides the same functionality through the SharedEvent type.
The abstract interface allows us to wait for GPU work to complete by waiting on a signal value using:
Fence->waitForCompletion(SignalValue);Signaling the value still requires downcasting because queue submission is not done via an abstract interface yet.