Introduce KHR_external_semaphore_fd only for FD==-1#2670
Merged
billhollings merged 1 commit intoKhronosGroup:mainfrom Dec 12, 2025
Merged
Introduce KHR_external_semaphore_fd only for FD==-1#2670billhollings merged 1 commit intoKhronosGroup:mainfrom
billhollings merged 1 commit intoKhronosGroup:mainfrom
Conversation
There is a special use case for when importing/exporting a semaphore of handle type `VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT` and FD == -1. According to the Vulkan specs, calling `vkImportSemaphoreFdKHR` has the effect of signaling the binary semaphore and calling `vkGetSemaphoreFdKHR` has the effect of waiting on the binary semaphore. Outside of KHR_external_semaphore_fd extension, there is no other way to achieve this behaviour. For example, `vkWaitSemaphores` does not operate on a binary semaphore and there is no other defined way for a CPU to send a signal operation. In theory, we can use EXT_metal_objects and export the VkSemaphore to a `MTLSharedEvent` but we do not have access to the `MVKSemaphoreMTLEvent` in order to determine the `_mtlEventValue` (last encoded wait value). This functionality is required to implement Venus on macOS which uses these functions to synchronize the guest semaphore state to the host.
d8db746 to
2f1358e
Compare
billhollings
approved these changes
Dec 12, 2025
Contributor
billhollings
left a comment
There was a problem hiding this comment.
Thanks for submitting! LGTM.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There is a special use case for when importing/exporting a semaphore of handle type
VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BITand FD == -1. According to the Vulkan specs, callingvkImportSemaphoreFdKHRhas the effect of signaling the binary semaphore and callingvkGetSemaphoreFdKHRhas the effect of waiting on the binary semaphore.Outside of KHR_external_semaphore_fd extension, there is no other way to achieve this behaviour. For example,
vkWaitSemaphoresdoes not operate on a binary semaphore and there is no other defined way for a CPU to send a signal operation.In theory, we can use EXT_metal_objects and export the VkSemaphore to a
MTLSharedEventbut we do not have access to theMVKSemaphoreMTLEventin order to determine the_mtlEventValue(last encoded wait value).This functionality is required to implement Venus on macOS which uses these functions to synchronize the guest semaphore state to the host.