Originally posted by MorrisS.
View Post
Implicit memory ordering – semaphores and fences
Semaphores and fences are quite similar things in Vulkan, but serve a different purpose. Semaphores facilitate GPU <-> GPU synchronization across Vulkan queues, and fences facilitate GPU -> CPU synchronization.
These objects are signaled as part of a vkQueueSubmit. However, one very important thing to note about semaphores and fences is how they interact with memory. To signal a semaphore or fence, all previously submitted commands to the queue must complete. If this were a regular pipeline barrier, we would have srcStageMask = ALL_COMMANDS_BIT. However, we also get a full memory barrier, in the sense that all pending writes are made available. Essentially, srcAccessMask = MEMORY_WRITE_BIT.
Semaphores and fences are quite similar things in Vulkan, but serve a different purpose. Semaphores facilitate GPU <-> GPU synchronization across Vulkan queues, and fences facilitate GPU -> CPU synchronization.
These objects are signaled as part of a vkQueueSubmit. However, one very important thing to note about semaphores and fences is how they interact with memory. To signal a semaphore or fence, all previously submitted commands to the queue must complete. If this were a regular pipeline barrier, we would have srcStageMask = ALL_COMMANDS_BIT. However, we also get a full memory barrier, in the sense that all pending writes are made available. Essentially, srcAccessMask = MEMORY_WRITE_BIT.
The reality is Vulkan has both explicit syncronization. and implicit syncronization.
Note that one of the Vulkan implicit syncs is called fences guess what dma_fence in the Linux kernel on dmabuf lines up with.
Basically that write-up you are point to is in fact faulty not based on what is in the Vulkan specification. Yes Vulkan you are meant to have both implicit sync and explicit sync and able to use what one suites the problem best.
Vulkan is "Implicit and explicit sync together" and that is what need to be implemented for vulkan to work to specification. A pure explicit sync only graphical stack is not 100% Vulkan compatible. Do note the writeup lwn you were point to suggested at the end doing implicit and explicit sync together. It was not saying you could do explicit sync only as Nvidia developers are attempting to push.
Yes Ekstrand had miss in the spec of Vulkan that is valid to use implicit sync if developer of program wants to.
Comment