Performance library for Deep Learning
1.96.0
17 #ifndef ONEAPI_DNNL_DNNL_OCL_HPP
18 #define ONEAPI_DNNL_DNNL_OCL_HPP
29 #include <unordered_map>
31 #include "oneapi/dnnl/dnnl_ocl.h"
50 namespace ocl_interop {
62 "could not create an engine");
71 cl_context context =
nullptr;
74 "could not get an OpenCL context from an engine");
83 cl_device_id device =
nullptr;
85 "could not get an OpenCL device from an engine");
98 "could not create a stream");
107 cl_command_queue queue =
nullptr;
110 "could not get an OpenCL command queue from a stream");
122 "could not get OpenCL buffer object from a memory object");
137 "could not set OpenCL buffer object from a memory 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.
An execution stream.
Definition: dnnl.hpp:975
An execution engine.
Definition: dnnl.hpp:859
An opaque structure to describe an engine.
void set_mem_object(memory &amemory, cl_mem mem_object)
Sets the OpenCL memory object associated with the memory object.
Definition: dnnl_ocl.hpp:134
cl_mem get_mem_object(const memory &amemory)
Returns the OpenCL memory object associated with the memory object.
Definition: dnnl_ocl.hpp:118
cl_context get_context(const engine &aengine)
Returns OpenCL context associated with the engine.
Definition: dnnl_ocl.hpp:70
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.
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.
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.
cl_command_queue get_command_queue(const stream &astream)
Returns OpenCL queue object associated with the execution stream.
Definition: dnnl_ocl.hpp:106
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.
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.
T get(bool allow_empty=false) const
Returns the underlying C API handle.
Definition: dnnl.hpp:185
Memory object.
Definition: dnnl.hpp:1098
static void wrap_c_api(dnnl_status_t status, const char *message)
A convenience function for wrapping calls to C API functions.
Definition: dnnl.hpp:103
cl_device_id get_device(const engine &aengine)
Returns OpenCL device associated with the engine.
Definition: dnnl_ocl.hpp:82
oneDNN namespace
Definition: dnnl.hpp:74
An opaque structure to describe an execution stream.
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.
engine make_engine(cl_device_id device, cl_context context)
Constructs an engine from OpenCL device and context objects.
Definition: dnnl_ocl.hpp:58
stream make_stream(const engine &aengine, cl_command_queue queue)
Constructs an execution stream for the specified engine and OpenCL queue.
Definition: dnnl_ocl.hpp:94