Skip to content

Commit

Permalink
Add mechanism to specify named win32 NT handles
Browse files Browse the repository at this point in the history
Currently, cl_khr_external_semaphore and cl_khr_external_memory define properties
to specify external win32 NT handle via pointer. Win32 NT handles can also be specified
via named strings.

Add properties to specify external Win32 NT handles via named strings too.

Fixes #943
  • Loading branch information
nikhiljnv committed May 21, 2024
1 parent 0483627 commit 3042bc1
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
1 change: 1 addition & 0 deletions api/cl_khr_external_memory_win32.asciidoc
Original file line number Diff line number Diff line change
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 Down
19 changes: 19 additions & 0 deletions api/opencl_runtime_layer.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -5619,6 +5619,14 @@ buffer or an image memory object from an external handle:
represented by its memory object, and will therefore become invalid when
all memory objects associated with it are destroyed.
endif::cl_khr_external_memory_win32[]
* {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.
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.

For these extensions, importing memory object payloads from Windows handles
does not transfer ownership of the handle to the OpenCL implementation.
Expand Down Expand Up @@ -13127,6 +13135,13 @@ 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.
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 +13161,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
4 changes: 3 additions & 1 deletion 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"/>
<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

0 comments on commit 3042bc1

Please sign in to comment.