oneAPI Deep Neural Network Library (oneDNN)
Performance library for Deep Learning
1.96.0
OpenCL interoperability API

API extensions to interact with the underlying OpenCL run-time. More...

Namespaces

 dnnl::ocl_interop
 OpenCL interoperability namespace.
 

Functions

dnnl_status_t DNNL_API dnnl_ocl_interop_memory_get_mem_object (const_dnnl_memory_t memory, cl_mem *mem_object)
 Returns an OpenCL memory object associated with a memory object. More...
 
dnnl_status_t DNNL_API dnnl_ocl_interop_memory_set_mem_object (dnnl_memory_t memory, cl_mem mem_object)
 Sets OpenCL memory object associated with a memory object. More...
 
dnnl_status_t DNNL_API dnnl_ocl_interop_engine_create (dnnl_engine_t *engine, cl_device_id device, cl_context context)
 Creates an engine associated with an OpenCL device and an OpenCL context. More...
 
dnnl_status_t DNNL_API dnnl_ocl_interop_engine_get_context (dnnl_engine_t engine, cl_context *context)
 Returns the OpenCL context associated with an engine. More...
 
dnnl_status_t DNNL_API dnnl_ocl_interop_get_device (dnnl_engine_t engine, cl_device_id *device)
 Returns the OpenCL device associated with an engine. More...
 
dnnl_status_t DNNL_API dnnl_ocl_interop_stream_create (dnnl_stream_t *stream, dnnl_engine_t engine, cl_command_queue queue)
 Creates an execution stream for a given engine associated with an OpenCL command queue. More...
 
dnnl_status_t DNNL_API dnnl_ocl_interop_stream_get_command_queue (dnnl_stream_t stream, cl_command_queue *queue)
 Returns the OpenCL command queue associated with an execution stream. More...
 

Detailed Description

API extensions to interact with the underlying OpenCL run-time.

See also
OpenCL Interoperability in developer guide

Function Documentation

◆ dnnl_ocl_interop_memory_get_mem_object()

dnnl_status_t DNNL_API dnnl_ocl_interop_memory_get_mem_object ( const_dnnl_memory_t  memory,
cl_mem *  mem_object 
)

Returns an OpenCL memory object associated with a memory object.

Parameters
memoryMemory object.
mem_objectOutput OpenCL memory object.
Returns
dnnl_success on success and a status describing the error otherwise.

◆ dnnl_ocl_interop_memory_set_mem_object()

dnnl_status_t DNNL_API dnnl_ocl_interop_memory_set_mem_object ( dnnl_memory_t  memory,
cl_mem  mem_object 
)

Sets OpenCL memory object associated with a memory object.

For behavioral details, see dnnl_memory_set_data_handle().

Parameters
memoryMemory object.
mem_objectOpenCL memory object.
Returns
dnnl_success on success and a status describing the error otherwise.

◆ dnnl_ocl_interop_engine_create()

dnnl_status_t DNNL_API dnnl_ocl_interop_engine_create ( dnnl_engine_t engine,
cl_device_id  device,
cl_context  context 
)

Creates an engine associated with an OpenCL device and an OpenCL context.

Parameters
engineOutput engine.
deviceUnderlying OpenCL device to use for the engine.
contextUnderlying OpenCL context to use for the engine.
Returns
dnnl_success on success and a status describing the error otherwise.

◆ dnnl_ocl_interop_engine_get_context()

dnnl_status_t DNNL_API dnnl_ocl_interop_engine_get_context ( dnnl_engine_t  engine,
cl_context *  context 
)

Returns the OpenCL context associated with an engine.

Parameters
engineEngine to query.
contextOutput underlying OpenCL context of the engine.
Returns
dnnl_success on success and a status describing the error otherwise.

◆ dnnl_ocl_interop_get_device()

dnnl_status_t DNNL_API dnnl_ocl_interop_get_device ( dnnl_engine_t  engine,
cl_device_id *  device 
)

Returns the OpenCL device associated with an engine.

Parameters
engineEngine to query.
deviceOutput underlying OpenCL device of the engine.
Returns
dnnl_success on success and a status describing the error otherwise.

◆ dnnl_ocl_interop_stream_create()

dnnl_status_t DNNL_API dnnl_ocl_interop_stream_create ( dnnl_stream_t stream,
dnnl_engine_t  engine,
cl_command_queue  queue 
)

Creates an execution stream for a given engine associated with an OpenCL command queue.

Parameters
streamOutput execution stream.
engineEngine to create the execution stream on.
queueOpenCL command queue to use.
Returns
dnnl_success on success and a status describing the error otherwise.

◆ dnnl_ocl_interop_stream_get_command_queue()

dnnl_status_t DNNL_API dnnl_ocl_interop_stream_get_command_queue ( dnnl_stream_t  stream,
cl_command_queue *  queue 
)

Returns the OpenCL command queue associated with an execution stream.

Parameters
streamExecution stream to query.
queueOutput OpenCL command queue.
Returns
dnnl_success on success and a status describing the error otherwise.