oneAPI Deep Neural Network Library (oneDNN)
Performance library for Deep Learning
1.96.0
dnnl::ocl_interop Namespace Reference

OpenCL interoperability namespace. More...

Functions

engine make_engine (cl_device_id device, cl_context context)
 Constructs an engine from OpenCL device and context objects. More...
 
cl_context get_context (const engine &aengine)
 Returns OpenCL context associated with the engine. More...
 
cl_device_id get_device (const engine &aengine)
 Returns OpenCL device associated with the engine. More...
 
stream make_stream (const engine &aengine, cl_command_queue queue)
 Constructs an execution stream for the specified engine and OpenCL queue. More...
 
cl_command_queue get_command_queue (const stream &astream)
 Returns OpenCL queue object associated with the execution stream. More...
 
cl_mem get_mem_object (const memory &amemory)
 Returns the OpenCL memory object associated with the memory object. More...
 
void set_mem_object (memory &amemory, cl_mem mem_object)
 Sets the OpenCL memory object associated with the memory object. More...
 

Detailed Description

OpenCL interoperability namespace.

Function Documentation

◆ make_engine()

engine dnnl::ocl_interop::make_engine ( cl_device_id  device,
cl_context  context 
)
inline

Constructs an engine from OpenCL device and context objects.

Parameters
deviceThe OpenCL device that this engine will encapsulate.
contextThe OpenCL context (containing the device) that this engine will use for all operations.
Returns
An engine.

◆ get_context()

cl_context dnnl::ocl_interop::get_context ( const engine aengine)
inline

Returns OpenCL context associated with the engine.

Parameters
aengineAn engine.
Returns
Underlying OpenCL context.
Examples:
gpu_opencl_interop.cpp.

◆ get_device()

cl_device_id dnnl::ocl_interop::get_device ( const engine aengine)
inline

Returns OpenCL device associated with the engine.

Parameters
aengineAn engine.
Returns
Underlying OpenCL device.

◆ make_stream()

stream dnnl::ocl_interop::make_stream ( const engine aengine,
cl_command_queue  queue 
)
inline

Constructs an execution stream for the specified engine and OpenCL queue.

Parameters
aengineEngine to create the stream on.
queueOpenCL queue to use for the stream.
Returns
An execution stream.

◆ get_command_queue()

cl_command_queue dnnl::ocl_interop::get_command_queue ( const stream astream)
inline

Returns OpenCL queue object associated with the execution stream.

Parameters
astreamAn execution stream.
Returns
Underlying OpenCL queue.
Examples:
gpu_opencl_interop.cpp.

◆ get_mem_object()

cl_mem dnnl::ocl_interop::get_mem_object ( const memory amemory)
inline

Returns the OpenCL memory object associated with the memory object.

Parameters
amemoryA memory object.
Returns
Underlying OpenCL memory object.
Examples:
gpu_opencl_interop.cpp.

◆ set_mem_object()

void dnnl::ocl_interop::set_mem_object ( memory amemory,
cl_mem  mem_object 
)
inline

Sets the OpenCL memory object associated with the memory object.

For behavioral details see memory::set_data_handle().

Parameters
amemoryA memory object.
mem_objectOpenCL cl_mem object to use as the underlying storage. It must have at least get_desc().get_size() bytes allocated.