-
Notifications
You must be signed in to change notification settings - Fork 535
Add the VK_EXT_external_semaphore_drm_syncobj extension #2692
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| // Copyright 2026 The Khronos Group Inc. | ||
| // | ||
| // SPDX-License-Identifier: CC-BY-4.0 | ||
|
|
||
| include::{generated}/meta/{refprefix}VK_EXT_external_semaphore_drm_syncobj.adoc[] | ||
|
|
||
| === Other Extension Metadata | ||
|
|
||
| *Last Modified Date*:: | ||
| 2026-03-02 | ||
| *IP Status*:: | ||
| No known IP claims. | ||
| *Contributors*:: | ||
| - Julian Orth | ||
| - James Jones, NVIDIA | ||
| - Simon Ser | ||
| - Lisa Wu, Arm Ltd. | ||
| - Jon Leech, Khronos | ||
|
|
||
| === Description | ||
|
|
||
| This extension adds the ability to import and export timeline semaphores as DRM | ||
| synchronization objects (syncobj). | ||
|
|
||
| include::{generated}/interfaces/VK_EXT_external_semaphore_drm_syncobj.adoc[] | ||
|
|
||
| === Version History | ||
|
|
||
| * Revision 1, 2026-03-02 (Julian Orth) | ||
| ** Initial revision |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| // Copyright 2021-2026 The Khronos Group Inc. | ||
| // | ||
| // SPDX-License-Identifier: CC-BY-4.0 | ||
|
|
||
| = VK_EXT_external_semaphore_drm_syncobj | ||
| :toc: left | ||
| :docs: https://docs.vulkan.org/spec/latest/ | ||
| :refpages: https://docs.vulkan.org/refpages/latest/refpages/source/ | ||
| :sectnums: | ||
|
|
||
| This extension aims to add interoperability between timeline semaphores and | ||
| syncobjs. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nitpicking: |
||
|
|
||
| == Problem Statement | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nitpicking:IMHO, the information in this session seems to fit better as a proposal instead of a problem statement. :) Particaluarly, the information about the syncobjs provides the justification why it is the chosen solution, while the information about 'OPAQUE_FD' seems like an alternative proposal, and the limitation comes along with it. For the problem statement, it may be sufficient to explain what is the problem the extension is intended to solve. For example:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I don't think that is true. Vulkan does have such types on windows. And I think opaque FDs can be shared with cuda on the nvidia driver. I wrote this section to show specifically why there is value in supporting syncobj interop. If it is already assumed that all interop with any external synchronization primitive is valuable, then I'd rather just cut this section down to the following without changing the proposal section.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fair enough.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can do that if it is the consensus. If I were to read the proposal document, I would prefer to know more about why the extension was added and what things I could do with it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The reason I suggested an alternative problem statement is that the original problem statement reads like “Vulkan lacks a sync handle type for syncobj” and I slightly disagree with it. I think the actual problem is that we lack a mechanism to share timeline semaphore payloads between Vulkan and other APIs on Linux. Opaque_FD could be used in a fairly limited set of use cases, while syncobj fits better to that problem, because it is a Linux kernel primitive with the same semantics as a Vulkan timeline semaphore, and is widely supported by the Linux ecosys. Therefore exporting/importing timeline semaphore payloads through drm syncobj handle becomes the choice on Linux. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks very much for writing the proposal document, by the way.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
That was how I intended it to be read. The two usecases from the problem statement are the usecases I wanted to solve with this extension. It being the first well-defined handle type for timeline semaphores on linux is only a side effect and having any other such type would not solve the usecases I had in mind, since they specifically use syncobjs. |
||
|
|
||
| Linux DRM synchronization objects (syncobjs) are a kernel primitive that can be | ||
| used to implement timeline semaphores. Syncobjs can be represented as file | ||
| descriptors and some implementations use them as the file type of | ||
| `VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT`. | ||
|
|
||
| Syncobjs are also used for inter-process synchronization. In some situations it | ||
| might be useful to use the same syncobj both as a timeline semaphore and for | ||
| inter-process synchronization. | ||
|
|
||
| Syncobjs furthermore allow applications to asynchronously wait for individual | ||
| timeline points by integrating with `poll(2)`. In some applications it might be | ||
| preferable to use this mechanism to wait for signal operations. | ||
|
|
||
| Currently, there is no official mechanism for applications to export syncobjs | ||
| from timeline semaphores or to import syncobjs into timeline semaphores. | ||
| Applications can detect whether the file descriptor used for | ||
| `VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT` refers to a syncobj but this | ||
| does not solve the issue on implementations that do not use syncobjs. | ||
|
|
||
| == Proposal | ||
|
|
||
| The `VK_EXT_external_semaphore_drm_syncobj` extension adds a new handle type | ||
| `VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_DRM_SYNCOBJ_BIT_EXT`. | ||
|
|
||
| This type can be used to import syncobjs into/export syncobjs from timeline | ||
| semaphores with _reference_ transference and _permanent_ permanence. | ||
|
|
||
| Existing VUs disallow _temporary_ permanence for timeline semaphores. | ||
|
|
||
| The mapping between syncobj points and timeline semaphore points is unambiguous | ||
| since both support `2^64 - 1` points for timeline operations. | ||
|
|
||
| == Issues | ||
|
|
||
| === Should binary semaphores also be supported? | ||
|
|
||
| Some implementations use syncobjs to implement binary semaphores. This was not | ||
| explored as part of this proposal. If the need arises, the author believes that | ||
| support could be added with a new revision of the extension. | ||
|
|
||
| For now, binary semaphores already support interop via | ||
| `VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT`, albeit without | ||
| wait-before-signal support. | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this extension specifically assumes DRM timeline synchronization objects, but binary syncobjs are a thing too, so the spec should probably be specific here and elsewhere. You may want to consider including that in the name as well, but it might also be considered overly verbose. I could go either way personally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't believe the kernel distinguishes between binary and timeline syncobjs. The ioctl to create a syncobj does not have a way to allocate one or the other:
The kernel warns against using both binary and timeline ioctls on the same syncobj but I believe the following sentence from this PR already covers this:
Vulkan timeline semaphore values correspond to syncobj points.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, I can confirm that the kernel makes no difference between binary and timeline syncobjs. A binary syncobj is a timeline syncobj with only point 0 being used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do think it's reasonable to have a Vulkan VU or at least a note that says that it should only be imported as the same timeline type it was exported as. That won't cover every case since the client can go call DRM ioctls itself, but if someone is, for instance, using this to share semaphores between two different Vulkan devices, they're going to run into trouble if they mix and match.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This extension only supports import to/export from timeline semaphores.