You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[CORE][NVEP]: add support for Vulkan interop (#27456)
### Description
<!-- Describe your changes. -->
The Vulkan interop works in a similar way as D3D12 interop.
The shared handles from Vulkan work for CUDA the same way as D3D12
handles. For Linux, we can use file descriptors.
As a sync primitive we use Vulkan timeline semaphores. They are widely
supported since Vulkan 1.2 and work in a similar way as the existing
`ID3D12Fence`s.
### Motivation and Context
<!-- - Why is this change required? What problem does it solve?
- If it fixes an open issue, please link to the issue here. -->
This change allows to use graphics interop also on Vulkan and on Linux.
It addresses a TODO in the external memory API.
# If an external project (e.g. dawn from Webgpu EP has already added a Vulkan::Headers target we shouldn't try to import another version of the Vulkan headers)
ORT_EXTERNAL_SEMAPHORE_D3D12_FENCE = 0, /**< Shared HANDLE from ID3D12Device::CreateSharedHandle(fence) */
1070
+
ORT_EXTERNAL_SEMAPHORE_D3D12_FENCE = 0, /**< Shared HANDLE from ID3D12Device::CreateSharedHandle(fence) */
1071
+
ORT_EXTERNAL_SEMAPHORE_VK_TIMELINE_SEMAPHORE_WIN32 = 1, /**< Shared HANDLE from vkGetSemaphoreWin32HandleKHR of a VkSemaphore created as VK_SEMAPHORE_TYPE_TIMELINE */
1072
+
ORT_EXTERNAL_SEMAPHORE_VK_TIMELINE_SEMAPHORE_OPAQUE_FD = 2, /**< File descriptor from vkGetSemaphoreFdKHR of a VkSemaphore created as VK_SEMAPHORE_TYPE_TIMELINE */
1071
1073
} OrtExternalSemaphoreType;
1072
1074
1073
1075
/** \brief Descriptor for importing external semaphores.
"[NvTensorRTRTX EP] Vulkan CIG context not yet implemented");
1560
+
int cig_supported{false};
1561
+
if (cudaSuccess != cudaDeviceGetAttribute(&cig_supported, cudaDevAttrVulkanCigSupported, device_id)) {
1562
+
returnonnxruntime::CreateStatus(ORT_EP_FAIL,
1563
+
"[NvTensorRTRTX EP] Could not determine CiG support for CUDA device");
1564
+
}
1565
+
if (!cig_supported) {
1566
+
LOGS_DEFAULT(INFO) << "[NvTensorRTRTX EP] InitGraphicsInterop: CiG for Vulkan is not supported on the given device. Will use the default CUDA context";
LOGS_DEFAULT(WARNING) << "[NvTensorRTRTX EP] InitGraphicsInterop: Can't enable CUDA in Graphics (CiG) for Vulkan without onnxruntime::nv::provider_option_names::kExternalComputeQueueDataParamNV_data";
"[NvTensorRTRTX EP] Could not parse provided values for onnxruntime::nv::provider_option_names::kExternalComputeQueueDataParamNV_data or onnxruntime::nv::provider_option_names::kExternalComputeQueueDataParamNV_data_len");
0 commit comments