oneAPI Deep Neural Network Library (oneDNN)
Performance library for Deep Learning
2.1.3
dnnl_ocl.h
1/*******************************************************************************
2* Copyright 2020 Intel Corporation
3*
4* Licensed under the Apache License, Version 2.0 (the "License");
5* you may not use this file except in compliance with the License.
6* You may obtain a copy of the License at
7*
8* http://www.apache.org/licenses/LICENSE-2.0
9*
10* Unless required by applicable law or agreed to in writing, software
11* distributed under the License is distributed on an "AS IS" BASIS,
12* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13* See the License for the specific language governing permissions and
14* limitations under the License.
15*******************************************************************************/
16
17#ifndef ONEAPI_DNNL_DNNL_OCL_H
18#define ONEAPI_DNNL_DNNL_OCL_H
19
20#include "oneapi/dnnl/dnnl.h"
21
23// Set target version for OpenCL explicitly to suppress a compiler warning.
24#ifndef CL_TARGET_OPENCL_VERSION
25#define CL_TARGET_OPENCL_VERSION 120
26#endif
27
28#include <CL/cl.h>
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
37
40
43
51 const_dnnl_memory_t memory, cl_mem *mem_object);
52
62 dnnl_memory_t memory, cl_mem mem_object);
63
72 dnnl_engine_t *engine, cl_device_id device, cl_context context);
73
81 dnnl_engine_t engine, cl_context *context);
82
90 dnnl_engine_t engine, cl_device_id *device);
91
101 dnnl_stream_t *stream, dnnl_engine_t engine, cl_command_queue queue);
102
110 dnnl_stream_t stream, cl_command_queue *queue);
111
113
115
117
118#ifdef __cplusplus
119}
120#endif
121
122#endif
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_memory_get_mem_object(const_dnnl_memory_t memory, cl_mem *mem_object)
Returns an OpenCL memory object associated with 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.
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_engine_get_context(dnnl_engine_t engine, cl_context *context)
Returns the OpenCL context associated with an engine.
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_get_device(dnnl_engine_t engine, cl_device_id *device)
Returns the OpenCL device associated with an engine.
dnnl_status_t
Status values returned by the library functions.
Definition: dnnl_types.h:39
C API.
An opaque structure to describe an engine.
An opaque structure to describe a memory.
An opaque structure to describe an execution stream.