summaryrefslogtreecommitdiff
path: root/src/cl_khr_icd.c
blob: e4daf7948fd5f7a3e1f43f18d3f69e4a36c792d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
/* 
 * Copyright © 2013 Simon Richter
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
 */
#include <ocl_icd.h>

#include "cl_platform_id.h"
#include "CL/cl_intel.h" // for clGetKernelSubGroupInfoKHR
/* The interop functions are only available if sharing is enabled */
#ifdef HAS_GL_EGL
#define CL_GL_INTEROP(x) x
#else
#define CL_GL_INTEROP(x) (void *) NULL
#endif
/* These are not yet implemented in Beignet */
#define CL_NOTYET(x) (void *) NULL

/** Return platform list through ICD interface
 * This code is used only if a client is linked directly against the library
 * instead of using the ICD loader. In this case, no other implementations
 * should exist in the process address space, so the call is equivalent to
 * clGetPlatformIDs().
 *
 * @param[in]   num_entries     Number of entries allocated in return buffer
 * @param[out]  platforms       Platform identifiers supported by this implementation
 * @param[out]  num_platforms   Number of platform identifiers returned
 * @return      OpenCL error code
 * @retval      CL_SUCCESS                      Successful execution
 * @retval      CL_PLATFORM_NOT_FOUND_KHR       No platforms provided
 * @retval      CL_INVALID_VALUE                Invalid parameters
 */
cl_int
clIcdGetPlatformIDsKHR(cl_uint          num_entries,
                 cl_platform_id * platforms,
                 cl_uint *        num_platforms)
{
  return clGetPlatformIDs(num_entries, platforms, num_platforms);
}

struct _cl_icd_dispatch const cl_khr_icd_dispatch = {
  clGetPlatformIDs,
  clGetPlatformInfo,
  clGetDeviceIDs,
  clGetDeviceInfo,
  clCreateContext,
  clCreateContextFromType,
  clRetainContext,
  clReleaseContext,
  clGetContextInfo,
  clCreateCommandQueue,
  clRetainCommandQueue,
  clReleaseCommandQueue,
  clGetCommandQueueInfo,
  (void *) NULL, /* clSetCommandQueueProperty */
  clCreateBuffer,
  clCreateImage2D,
  clCreateImage3D,
  clRetainMemObject,
  clReleaseMemObject,
  clGetSupportedImageFormats,
  clGetMemObjectInfo,
  clGetImageInfo,
  clCreateSampler,
  clRetainSampler,
  clReleaseSampler,
  clGetSamplerInfo,
  clCreateProgramWithSource,
  clCreateProgramWithBinary,
  clRetainProgram,
  clReleaseProgram,
  clBuildProgram,
  clUnloadCompiler,
  clGetProgramInfo,
  clGetProgramBuildInfo,
  clCreateKernel,
  clCreateKernelsInProgram,
  clRetainKernel,
  clReleaseKernel,
  clSetKernelArg,
  clGetKernelInfo,
  clGetKernelWorkGroupInfo,
  clWaitForEvents,
  clGetEventInfo,
  clRetainEvent,
  clReleaseEvent,
  clGetEventProfilingInfo,
  clFlush,
  clFinish,
  clEnqueueReadBuffer,
  clEnqueueWriteBuffer,
  clEnqueueCopyBuffer,
  clEnqueueReadImage,
  clEnqueueWriteImage,
  clEnqueueCopyImage,
  clEnqueueCopyImageToBuffer,
  clEnqueueCopyBufferToImage,
  clEnqueueMapBuffer,
  clEnqueueMapImage,
  clEnqueueUnmapMemObject,
  clEnqueueNDRangeKernel,
  clEnqueueTask,
  clEnqueueNativeKernel,
  clEnqueueMarker,
  clEnqueueWaitForEvents,
  clEnqueueBarrier,
  clGetExtensionFunctionAddress,
  CL_GL_INTEROP(clCreateFromGLBuffer),
  CL_GL_INTEROP(clCreateFromGLTexture2D),
  CL_NOTYET(clCreateFromGLTexture3D),
  CL_NOTYET(clCreateFromGLRenderbuffer),
  CL_NOTYET(clGetGLObjectInfo),
  CL_NOTYET(clGetGLTextureInfo),
  CL_GL_INTEROP(clEnqueueAcquireGLObjects),
  CL_GL_INTEROP(clEnqueueReleaseGLObjects),
  CL_NOTYET(clGetGLContextInfoKHR),
  (void *) NULL,
  (void *) NULL,
  (void *) NULL,
  (void *) NULL,
  (void *) NULL,
  (void *) NULL,
  clSetEventCallback,
  clCreateSubBuffer,
  clSetMemObjectDestructorCallback,
  clCreateUserEvent,
  clSetUserEventStatus,
  clEnqueueReadBufferRect,
  clEnqueueWriteBufferRect,
  clEnqueueCopyBufferRect,
  CL_NOTYET(clCreateSubDevicesEXT),
  CL_NOTYET(clRetainDeviceEXT),
  CL_NOTYET(clReleaseDeviceEXT),
#ifdef CL_VERSION_1_2
  (void *) NULL,
  clCreateSubDevices,
  clRetainDevice,
  clReleaseDevice,
  clCreateImage,
  clCreateProgramWithBuiltInKernels,
  clCompileProgram,
  clLinkProgram,
  clUnloadPlatformCompiler,
  clGetKernelArgInfo,
  clEnqueueFillBuffer,
  clEnqueueFillImage,
  clEnqueueMigrateMemObjects,
  clEnqueueMarkerWithWaitList,
  clEnqueueBarrierWithWaitList,
  clGetExtensionFunctionAddressForPlatform,
  CL_GL_INTEROP(clCreateFromGLTexture),
  (void *) NULL,
  (void *) NULL,
  (void *) NULL,
  (void *) NULL,
  (void *) NULL,
  (void *) NULL,
  (void *) NULL,
  (void *) NULL,
  (void *) NULL,
  (void *) NULL,
  (void *) NULL,
  (void *) NULL,
  (void *) NULL,
  (void *) NULL,
#endif
#ifdef CL_VERSION_2_0
  clCreateCommandQueueWithProperties,
  clCreatePipe,
  clGetPipeInfo,
  clSVMAlloc,
  clSVMFree,
  clEnqueueSVMFree,
  clEnqueueSVMMemcpy,
  clEnqueueSVMMemFill,
  clEnqueueSVMMap,
  clEnqueueSVMUnmap,
  clCreateSamplerWithProperties,
  clSetKernelArgSVMPointer,
  clSetKernelExecInfo,
  clGetKernelSubGroupInfoKHR,
#endif
};