![]() |
ONNX Runtime
|
Struct that an EP implements for external resource import (memory + semaphore import). More...
#include <onnxruntime_ep_c_api.h>
Public Attributes | |
| uint32_t | ort_version_supported |
| Must be initialized to ORT_API_VERSION. | |
| bool(* | CanImportMemory )(const OrtExternalResourceImporterImpl *this_ptr, OrtExternalMemoryHandleType handle_type) |
| Check if the implementation can import external memory of the given handle type. | |
| void(* | ReleaseMemory )(OrtExternalResourceImporterImpl *this_ptr, OrtExternalMemoryHandle *handle) |
| Release an imported external memory handle. | |
| bool(* | CanImportSemaphore )(const OrtExternalResourceImporterImpl *this_ptr, OrtExternalSemaphoreType type) |
| Check if the implementation can import external semaphores of the given type. | |
| void(* | ReleaseSemaphore )(OrtExternalResourceImporterImpl *this_ptr, OrtExternalSemaphoreHandle *handle) |
| Release an imported external semaphore handle. | |
| void(* | Release )(OrtExternalResourceImporterImpl *this_ptr) |
| Release the OrtExternalResourceImporterImpl instance. | |
Struct that an EP implements for external resource import (memory + semaphore import).
This capability object provides methods for importing external GPU memory and semaphores for zero-copy import. EPs that support D3D12, CUDA, HIP, or Vulkan external resource APIs can implement this interface.
| OrtStatus * OrtExternalResourceImporterImpl::CreateTensorFromMemory | ( | OrtExternalResourceImporterImpl * | this_ptr, |
| const OrtExternalMemoryHandle * | mem_handle, | ||
| const OrtExternalTensorDescriptor * | tensor_desc, | ||
| OrtValue ** | out_tensor | ||
| ) |
Create a tensor backed by imported external memory.
The created tensor is a view over the imported memory and does not copy data.
| [in] | this_ptr | Pointer to the OrtExternalResourceImporterImpl instance. |
| [in] | mem_handle | The imported external memory handle (EP casts to its derived type). |
| [in] | tensor_desc | Descriptor specifying tensor element type, shape, and optional offset. |
| [out] | out_tensor | Output parameter set to the created OrtValue containing the tensor. |
| OrtStatus * OrtExternalResourceImporterImpl::ImportMemory | ( | OrtExternalResourceImporterImpl * | this_ptr, |
| const OrtExternalMemoryDescriptor * | desc, | ||
| OrtExternalMemoryHandle ** | out_handle | ||
| ) |
Import external memory.
The EP creates a derived type of OrtExternalMemoryHandle and returns a pointer to the base. EP is responsible for the lifetime of the handle (release via ReleaseMemory).
| [in] | this_ptr | Pointer to the OrtExternalResourceImporterImpl instance. |
| [in] | desc | Descriptor containing the external memory handle and properties. |
| [out] | out_handle | Output parameter set to the created OrtExternalMemoryHandle (EP's derived type). |
| OrtStatus * OrtExternalResourceImporterImpl::ImportSemaphore | ( | OrtExternalResourceImporterImpl * | this_ptr, |
| const OrtExternalSemaphoreDescriptor * | desc, | ||
| OrtExternalSemaphoreHandle ** | out_handle | ||
| ) |
Import an external semaphore.
The EP creates a derived type of OrtExternalSemaphoreHandle and returns a pointer to the base. EP is responsible for the lifetime of the handle (release via ReleaseSemaphore).
| [in] | this_ptr | Pointer to the OrtExternalResourceImporterImpl instance. |
| [in] | desc | Descriptor containing the external semaphore handle and type. |
| [out] | out_handle | Output parameter set to the created OrtExternalSemaphoreHandle (EP's derived type). |
| OrtStatus * OrtExternalResourceImporterImpl::SignalSemaphore | ( | OrtExternalResourceImporterImpl * | this_ptr, |
| OrtExternalSemaphoreHandle * | handle, | ||
| OrtSyncStream * | stream, | ||
| uint64_t | value | ||
| ) |
Signal an external semaphore from the EP's stream.
Inserts a signal operation into the EP's stream that sets the semaphore to the specified value when reached.
| [in] | this_ptr | Pointer to the OrtExternalResourceImporterImpl instance. |
| [in] | handle | The imported external semaphore (EP casts to its derived type). |
| [in] | stream | The OrtSyncStream to signal from. |
| [in] | value | The fence/semaphore value to signal. |
| OrtStatus * OrtExternalResourceImporterImpl::WaitSemaphore | ( | OrtExternalResourceImporterImpl * | this_ptr, |
| OrtExternalSemaphoreHandle * | handle, | ||
| OrtSyncStream * | stream, | ||
| uint64_t | value | ||
| ) |
Wait on an external semaphore on the EP's stream.
Inserts a wait operation into the EP's stream that blocks until the semaphore reaches the specified value.
| [in] | this_ptr | Pointer to the OrtExternalResourceImporterImpl instance. |
| [in] | handle | The imported external semaphore (EP casts to its derived type). |
| [in] | stream | The OrtSyncStream to wait on. |
| [in] | value | The fence/semaphore value to wait for. |
| bool( * OrtExternalResourceImporterImpl::CanImportMemory) (const OrtExternalResourceImporterImpl *this_ptr, OrtExternalMemoryHandleType handle_type) |
Check if the implementation can import external memory of the given handle type.
| [in] | this_ptr | Pointer to the OrtExternalResourceImporterImpl instance. |
| [in] | handle_type | The type of external memory handle to check. |
| bool( * OrtExternalResourceImporterImpl::CanImportSemaphore) (const OrtExternalResourceImporterImpl *this_ptr, OrtExternalSemaphoreType type) |
Check if the implementation can import external semaphores of the given type.
| [in] | this_ptr | Pointer to the OrtExternalResourceImporterImpl instance. |
| [in] | type | The type of external semaphore to check. |
| uint32_t OrtExternalResourceImporterImpl::ort_version_supported |
Must be initialized to ORT_API_VERSION.
| void( * OrtExternalResourceImporterImpl::Release) (OrtExternalResourceImporterImpl *this_ptr) |
Release the OrtExternalResourceImporterImpl instance.
This is called by ORT when the OrtExternalResourceImporterImpl instance is no longer needed. The implementation should release any resources held by the instance.
| [in] | this_ptr | Pointer to the OrtExternalResourceImporterImpl instance. |
| void( * OrtExternalResourceImporterImpl::ReleaseMemory) (OrtExternalResourceImporterImpl *this_ptr, OrtExternalMemoryHandle *handle) |
Release an imported external memory handle.
The EP deletes its derived type instance.
| [in] | this_ptr | Pointer to the OrtExternalResourceImporterImpl instance. |
| [in] | handle | The OrtExternalMemoryHandle to release (EP casts to its derived type). |
| void( * OrtExternalResourceImporterImpl::ReleaseSemaphore) (OrtExternalResourceImporterImpl *this_ptr, OrtExternalSemaphoreHandle *handle) |
Release an imported external semaphore handle.
The EP deletes its derived type instance.
| [in] | this_ptr | Pointer to the OrtExternalResourceImporterImpl instance. |
| [in] | handle | The OrtExternalSemaphoreHandle to release (EP casts to its derived type). |