ONNX Runtime
Loading...
Searching...
No Matches
OrtExternalMemoryHandle Struct Reference

Base struct for imported external memory handles. More...

#include <onnxruntime_ep_c_api.h>

Public Attributes

uint32_t version
 Must be ORT_API_VERSION.
 
const OrtEpDeviceep_device
 EP device that created this handle.
 
OrtExternalMemoryDescriptor descriptor
 External memory descriptor.
 
void(* Release )(OrtExternalMemoryHandle *handle)
 Release callback for this handle. EP sets this to its release function.
 

Detailed Description

Base struct for imported external memory handles.

EPs derive from this struct to add EP-specific fields (e.g., CUdeviceptr for CUDA). EP is responsible for creating and releasing instances of the derived type.

Example derived type for CUDA EP:

struct MyCudaExternalMemoryHandle : OrtExternalMemoryHandle {
CUexternalMemory ext_memory;
CUdeviceptr mapped_ptr;
bool is_dedicated;
};
Base struct for imported external memory handles.
Definition onnxruntime_ep_c_api.h:45
Since
Version 1.24.

Member Data Documentation

◆ descriptor

OrtExternalMemoryDescriptor OrtExternalMemoryHandle::descriptor

External memory descriptor.

◆ ep_device

const OrtEpDevice* OrtExternalMemoryHandle::ep_device

EP device that created this handle.

◆ Release

void( * OrtExternalMemoryHandle::Release) (OrtExternalMemoryHandle *handle)

Release callback for this handle. EP sets this to its release function.

ORT calls this when ReleaseExternalMemoryHandle is invoked. The EP's callback should cast the handle to its derived type and delete it.

◆ version

uint32_t OrtExternalMemoryHandle::version

Must be ORT_API_VERSION.