Skip to content
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

Add mechanism to specify named win32 NT handles #1177

Merged
merged 8 commits into from
Sep 3, 2024
6 changes: 5 additions & 1 deletion api/cl_khr_external_memory_win32.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ include::{generated}/meta/{refprefix}cl_khr_external_memory_win32.txt[]
=== Other Extension Metadata

*Last Modified Date*::
2024-03-15
2024-06-11
*IP Status*::
No known IP claims.
*Contributors*::
Expand Down Expand Up @@ -40,6 +40,7 @@ image memory object.
* {cl_external_memory_handle_type_khr_TYPE}
** {CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_WIN32_KHR}
** {CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_WIN32_KMT_KHR}
** {CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_WIN32_NAME_KHR}

=== Version History

Expand All @@ -57,3 +58,6 @@ image memory object.
(provisional).
* Revision 1.0.0, 2024-03-15
** First non-provisional version.
* Revision 1.1.0, 2024-06-11
** Added {CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_WIN32_NAME_KHR}.

5 changes: 4 additions & 1 deletion api/cl_khr_external_semaphore_win32.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ include::{generated}/meta/{refprefix}cl_khr_external_semaphore_win32.txt[]
=== Other Extension Metadata

*Last Modified Date*::
2021-09-10
2024-06-11
*IP Status*::
No known IP claims.
*Contributors*::
Expand Down Expand Up @@ -39,8 +39,11 @@ introduced by {cl_khr_external_semaphore_EXT}.
* {cl_external_semaphore_handle_type_khr_TYPE}
** {CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_KHR}
** {CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_KMT_KHR}
** {CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_NAME_KHR}

=== Version History

* Revision 0.9.0, 2021-09-10
** Initial version (provisional).
* Revision 0.9.1, 2024-06-11
** Added {CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_NAME_KHR}.
22 changes: 22 additions & 0 deletions api/opencl_runtime_layer.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -5618,6 +5618,16 @@ buffer or an image memory object from an external handle:
It does not own a reference to the underlying memory resource
represented by its memory object, and will therefore become invalid when
all memory objects associated with it are destroyed.
* {CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_WIN32_NAME_KHR_anchor} specifies an NT handle name that
has only limited valid usage outside of OpenCL and other compatible
APIs.
NT handle name is a null-terminated UTF-16 string naming the payload to import.
It must be compatible with the functions `DuplicateHandle`,
`CloseHandle`, `CompareObjectHandles`, `GetHandleInformation`, and
`SetHandleInformation`.
It owns a reference to the underlying memory resource represented by its
memory object.

endif::cl_khr_external_memory_win32[]

For these extensions, importing memory object payloads from Windows handles
Expand Down Expand Up @@ -13127,6 +13137,14 @@ a semaphore from an external handle:
It does not own a reference to the underlying synchronization primitive
represented by its semaphore object, and will therefore become invalid
when all semaphore objects associated with it are destroyed.
* {CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_NAME_KHR} specifies an NT handle name that has
only limited valid usage outside of OpenCL and other compatible APIs.
NT handle name is a null-terminated UTF-16 string naming the payload to import.
It must be compatible with the functions `DuplicateHandle`,
`CloseHandle`, `CompareObjectHandles`, `GetHandleInformation`, and
`SetHandleInformation`.
It owns a reference to the underlying synchronization primitive
represented by its semaphore object.

endif::cl_khr_external_semaphore_win32[]

Expand All @@ -13146,6 +13164,10 @@ include::{generated}/api/version-notes/CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_KHR.asci
include::{generated}/api/version-notes/CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_KMT_KHR.asciidoc[]
| Reference
| Temporary, Permanent

include::{generated}/api/version-notes/CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_NAME_KHR.asciidoc[]
| Reference
| Temporary, Permanent
endif::cl_khr_external_semaphore_win32[]
|====

Expand Down
10 changes: 7 additions & 3 deletions xml/cl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1894,7 +1894,9 @@ server's OpenCL/api-docs repository.
<enum value="0x2062" name="CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_WIN32_KMT_KHR"/>
<unused start="0x2063" end="0x2066" comment="Reserved to Khronos for interop"/>
<enum value="0x2067" name="CL_EXTERNAL_MEMORY_HANDLE_DMA_BUF_KHR"/>
<unused start="0x2068" end="0x2FFF" comment="Reserved to Khronos for interop"/>
<enum value="0x2068" name="CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_NAME_KHR"/>
<enum value="0x2069" name="CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_WIN32_NAME_KHR"/>
Comment on lines +1887 to +1888
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these should also be added to the <extension name="cl_khr_external_memory_win32" block below, to associate them with this extension.

<unused start="0x206A" end="0x2FFF" comment="Reserved to Khronos for interop"/>
</enums>

<enums start="0x3000" end="0x3FFF" name="enums.3000" vendor="Khronos" comment="Platform IDs. Allocate individually.">
Expand Down Expand Up @@ -7076,13 +7078,14 @@ server's OpenCL/api-docs repository.
<command name="clReImportSemaphoreSyncFdKHR"/>
</require>
</extension>
<extension name="cl_khr_external_semaphore_win32" revision="0.9.0" supported="opencl" depends="CL_VERSION_1_2+cl_khr_semaphore+cl_khr_external_semaphore" ratified="opencl" provisional="true">
<extension name="cl_khr_external_semaphore_win32" revision="0.9.1" supported="opencl" depends="CL_VERSION_1_2+cl_khr_semaphore+cl_khr_external_semaphore" ratified="opencl" provisional="true">
<require>
<type name="CL/cl.h"/>
</require>
<require comment="cl_external_semaphore_handle_type_khr">
<enum name="CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_KHR"/>
<enum name="CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_KMT_KHR"/>
<enum name="CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_NAME_KHR"/>
</require>
</extension>
<extension name="cl_khr_external_memory" revision="1.0.0" supported="opencl" depends="CL_VERSION_3_0" ratified="opencl">
Expand Down Expand Up @@ -7128,13 +7131,14 @@ server's OpenCL/api-docs repository.
<enum name="CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_FD_KHR"/>
</require>
</extension>
<extension name="cl_khr_external_memory_win32" revision="1.0.0" supported="opencl" depends="CL_VERSION_3_0+cl_khr_external_memory" ratified="opencl">
<extension name="cl_khr_external_memory_win32" revision="1.1.0" supported="opencl" depends="CL_VERSION_3_0+cl_khr_external_memory" ratified="opencl">
<require>
<type name="CL/cl.h"/>
</require>
<require comment="cl_external_memory_handle_type_khr">
<enum name="CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_WIN32_KHR"/>
<enum name="CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_WIN32_KMT_KHR"/>
<enum name="CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_WIN32_NAME_KHR"/>
</require>
</extension>
<extension name="cl_intel_sharing_format_query" revision="0.0.0" supported="opencl">
Expand Down