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

Import Vulkan resources via named NT handle #1895

Merged
merged 4 commits into from
Nov 5, 2024

Conversation

saurabhnv
Copy link
Contributor

@saurabhnv saurabhnv commented Feb 17, 2024

Add coverage to import Vulkan resources (memory and semaphore) in Windows via named NT handles.
If no name is given during resource creation, then use NT handles for import.
If a name is given, have an option to either use that name or get the NT handle and use that for import.
Resolves KhronosGroup/OpenCL-Docs#943

Copy link
Contributor

@joshqti joshqti left a comment

Choose a reason for hiding this comment

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

Do we need a new function parameter? Why not add a new enum to VulkanExternalMemoryHandleType?

@@ -550,7 +550,7 @@ clExternalMemory::clExternalMemory(const clExternalMemory &externalMemory)
clExternalMemory::clExternalMemory(
const VulkanDeviceMemory *deviceMemory,
VulkanExternalMemoryHandleType externalMemoryHandleType, uint64_t size,
cl_context context, cl_device_id deviceId)
cl_context context, cl_device_id deviceId, cl_bool useNameForImport)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not add new enum?

Copy link
Contributor Author

@saurabhnv saurabhnv Oct 15, 2024

Choose a reason for hiding this comment

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

Yeah, looks like when I was writing this there was no CL_*_HANDLE_OPAQUE_WIN32_NAME_KHR, but since it is there now, will remove the added param and add those enums in VulkanExternalMemoryHandleType and VulkanExternalSemaphoreHandleType to use those instead.

* Associate an optional name with the vk resource when handle type is NT
* Use the name when available for importing the resource in OpenCL
* Refactor ctor/dtor for WindowsSecurityAttributes class
Minor change to support importing a named resource either
directly using the associated name or via NT handle.
* Remove the unnecessary usage of useNameForImport
* Add new enum to VulkanExternalMemoryHandleType
  and VulkanExternalSemaphoreHandleType
@joshqti
Copy link
Contributor

joshqti commented Nov 4, 2024

LGTM

Copy link
Contributor

@joshqti joshqti left a comment

Choose a reason for hiding this comment

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

lgtm

@joshqti joshqti merged commit ef73a1d into KhronosGroup:main Nov 5, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Importing external memory via named NT handle reference along with pointer reference
3 participants