SYCL interoperability namespace. More...
Enumerations | |
enum | memory_kind |
Memory allocation kind. More... | |
Functions | |
dnnl_sycl_interop_memory_kind_t | convert_to_c (memory_kind akind) |
Converts a memory allocation kind enum value from C++ API to C API type. More... | |
engine | make_engine (const cl::sycl::device &adevice, const cl::sycl::context &acontext) |
Constructs an engine from SYCL device and context objects. More... | |
cl::sycl::context | get_context (const engine &aengine) |
Returns the SYCL context associated with an engine. More... | |
cl::sycl::device | get_device (const engine &aengine) |
Returns the SYCL device associated with an engine. More... | |
stream | make_stream (const engine &aengine, cl::sycl::queue &aqueue) |
Creates an execution stream for a given engine associated with a SYCL queue. More... | |
cl::sycl::queue | get_queue (const stream &astream) |
Returns the SYCL queue associated with an execution stream. More... | |
template<typename T , int ndims = 1> | |
cl::sycl::buffer< T, ndims > | get_buffer (const memory &amemory) |
Returns the SYCL buffer associated with a memory object. More... | |
template<typename T , int ndims> | |
void | set_buffer (memory &amemory, cl::sycl::buffer< T, ndims > &abuffer) |
Sets SYCL buffer associated with a memory object. More... | |
template<typename T , int ndims> | |
void | set_buffer (memory &amemory, cl::sycl::buffer< T, ndims > &abuffer, const stream &astream) |
Sets SYCL buffer associated with a memory object in a specified stream. More... | |
memory_kind | get_memory_kind (const memory &amemory) |
Returns the memory allocation kind associated with a memory object. More... | |
memory | make_memory (const memory::desc &memory_desc, const engine &aengine, memory_kind kind, void *handle=DNNL_MEMORY_ALLOCATE) |
Creates a memory object. More... | |
template<typename T , int ndims = 1> | |
memory | make_memory (const memory::desc &memory_desc, const engine &aengine, cl::sycl::buffer< T, ndims > &abuffer) |
Constructs a memory object from a SYCL buffer. More... | |
cl::sycl::event | execute (const dnnl::primitive &aprimitive, const stream &astream, const std::unordered_map< int, memory > &args, const std::vector< cl::sycl::event > &deps={}) |
Executes computations specified by the primitive in a specified stream and returns a SYCL event. More... | |
SYCL interoperability namespace.
|
strong |
|
inline |
Converts a memory allocation kind enum value from C++ API to C API type.
akind | C++ API memory allocation kind enum value. |
|
inline |
Constructs an engine from SYCL device and context objects.
adevice | SYCL device. |
acontext | SYCL context. |
|
inline |
Returns the SYCL context associated with an engine.
aengine | Engine to query. |
|
inline |
Returns the SYCL device associated with an engine.
aengine | Engine to query. |
Creates an execution stream for a given engine associated with a SYCL queue.
aengine | Engine object to use for the stream. |
aqueue | SYCL queue to use for the stream. |
|
inline |
Returns the SYCL queue associated with an execution stream.
astream | Execution stream to query. |
cl::sycl::buffer<T, ndims> dnnl::sycl_interop::get_buffer | ( | const memory & | amemory | ) |
Returns the SYCL buffer associated with a memory object.
Throws an exception if the memory allocation kind associated with the memory object is not equal to dnnl::sycl_interop::memory_kind::buffer.
T | Type of the requested buffer. |
ndims | Number of dimensions of the requested buffer. |
amemory | Memory object. |
void dnnl::sycl_interop::set_buffer | ( | memory & | amemory, |
cl::sycl::buffer< T, ndims > & | abuffer | ||
) |
Sets SYCL buffer associated with a memory object.
T | Type of the buffer. |
ndims | Number of dimensions of the buffer. |
amemory | Memory object to change. |
abuffer | SYCL buffer. |
void dnnl::sycl_interop::set_buffer | ( | memory & | amemory, |
cl::sycl::buffer< T, ndims > & | abuffer, | ||
const stream & | astream | ||
) |
Sets SYCL buffer associated with a memory object in a specified stream.
T | Type of the buffer. |
ndims | Number of dimensions of the buffer. |
amemory | Memory object to change. |
abuffer | SYCL buffer. |
astream | Stream to use to execute padding in. |
|
inline |
Returns the memory allocation kind associated with a memory object.
amemory | A memory object. |
|
inline |
Creates a memory object.
Unless handle
is equal to DNNL_MEMORY_NONE or DNNL_MEMORY_ALLOCATE, the constructed memory object will have the underlying buffer set. In this case, the buffer will be initialized as if:
memory_kind
is equal to dnnl::sycl_interop::memory_kind::usm, ormemory_kind
is equal to dnnl::sycl_interop::memory_kind::buffer.memory_desc | Memory descriptor. |
aengine | Engine to use. |
kind | Memory allocation kind to specify the type of handle. |
handle | Handle of the memory buffer to use as an underlying storage.
|
memory dnnl::sycl_interop::make_memory | ( | const memory::desc & | memory_desc, |
const engine & | aengine, | ||
cl::sycl::buffer< T, ndims > & | abuffer | ||
) |
Constructs a memory object from a SYCL buffer.
memory_desc | Memory descriptor. |
aengine | Engine to use. |
abuffer | A SYCL buffer to use. |
|
inline |
Executes computations specified by the primitive in a specified stream and returns a SYCL event.
Arguments are passed via an arguments map containing <index, memory object> pairs. The index must be one of the DNNL_ARG_*
values such as DNNL_ARG_SRC
, and the memory must have a memory descriptor matching the one returned by dnnl::primitive_desc::query_md(query::exec_arg_md, index) unless using dynamic shapes (see DNNL_RUNTIME_DIM_VAL).
aprimitive | Primitive to execute. |
astream | Stream object. The stream must belong to the same engine as the primitive. |
args | Arguments map. |
deps | Optional vector with cl::sycl::event dependencies. |