0
|
1 /*******************************************************************************
|
|
2 * Copyright (c) 2008-2009 The Khronos Group Inc.
|
|
3 *
|
|
4 * Permission is hereby granted, free of charge, to any person obtaining a
|
|
5 * copy of this software and/or associated documentation files (the
|
|
6 * "Materials"), to deal in the Materials without restriction, including
|
|
7 * without limitation the rights to use, copy, modify, merge, publish,
|
|
8 * distribute, sublicense, and/or sell copies of the Materials, and to
|
|
9 * permit persons to whom the Materials are furnished to do so, subject to
|
|
10 * the following conditions:
|
|
11 *
|
|
12 * The above copyright notice and this permission notice shall be included
|
|
13 * in all copies or substantial portions of the Materials.
|
|
14 *
|
|
15 * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
18 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
19 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
20 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
21 * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
|
22 ******************************************************************************/
|
|
23
|
|
24 // $Revision: 9283 $ on $Date: 2009-10-14 10:18:57 -0700 (Wed, 14 Oct 2009) $
|
|
25
|
|
26 module opencl.c.opencl;
|
|
27
|
|
28 public import opencl.c.platform;
|
|
29
|
|
30 extern(C):
|
|
31
|
|
32 alias const(void)*
|
|
33 cl_platform_id,
|
|
34 cl_device_id,
|
|
35 cl_context,
|
|
36 cl_command_queue,
|
|
37 cl_mem,
|
|
38 cl_program,
|
|
39 cl_kernel,
|
|
40 cl_event,
|
|
41 cl_sampler;
|
|
42
|
|
43 alias cl_uint cl_bool; // WARNING! Unlike cl_ types in cl_platform.h, cl_bool is not guaranteed to be the same size as the bool in kernels.
|
|
44 alias cl_ulong cl_bitfield;
|
|
45 alias cl_bitfield cl_device_type;
|
|
46 alias cl_uint cl_platform_info;
|
|
47 alias cl_uint cl_device_info;
|
|
48 alias cl_bitfield cl_device_address_info;
|
|
49 alias cl_bitfield cl_device_fp_config;
|
|
50 alias cl_uint cl_device_mem_cache_type;
|
|
51 alias cl_uint cl_device_local_mem_type;
|
|
52 alias cl_bitfield cl_device_exec_capabilities;
|
|
53 alias cl_bitfield cl_command_queue_properties;
|
|
54
|
|
55 alias cl_bitfield cl_context_properties;
|
|
56 alias cl_uint cl_context_info;
|
|
57 alias cl_uint cl_command_queue_info;
|
|
58 alias cl_uint cl_channel_order;
|
|
59 alias cl_uint cl_channel_type;
|
|
60 alias cl_bitfield cl_mem_flags;
|
|
61 alias cl_uint cl_mem_object_type;
|
|
62 alias cl_uint cl_mem_info;
|
|
63 alias cl_uint cl_image_info;
|
|
64 alias cl_uint cl_addressing_mode;
|
|
65 alias cl_uint cl_filter_mode;
|
|
66 alias cl_uint cl_sampler_info;
|
|
67 alias cl_bitfield cl_map_flags;
|
|
68 alias cl_uint cl_program_info;
|
|
69 alias cl_uint cl_program_build_info;
|
|
70 alias cl_uint cl_build_status;
|
|
71 alias cl_uint cl_kernel_info;
|
|
72 alias cl_uint cl_kernel_work_group_info;
|
|
73 alias cl_uint cl_event_info;
|
|
74 alias cl_uint cl_command_type;
|
|
75 alias cl_uint cl_profiling_info;
|
|
76
|
|
77 struct cl_image_format
|
|
78 {
|
|
79 cl_channel_order image_channel_order;
|
|
80 cl_channel_type image_channel_data_type;
|
|
81 }
|
|
82
|
|
83 /******************************************************************************/
|
|
84
|
|
85 enum
|
|
86 {
|
|
87 // Error Codes
|
|
88 CL_SUCCESS = 0,
|
|
89 CL_DEVICE_NOT_FOUND = -1,
|
|
90 CL_DEVICE_NOT_AVAILABLE = -2,
|
|
91 CL_COMPILER_NOT_AVAILABLE = -3,
|
|
92 CL_MEM_OBJECT_ALLOCATION_FAILURE = -4,
|
|
93 CL_OUT_OF_RESOURCES = -5,
|
|
94 CL_OUT_OF_HOST_MEMORY = -6,
|
|
95 CL_PROFILING_INFO_NOT_AVAILABLE = -7,
|
|
96 CL_MEM_COPY_OVERLAP = -8,
|
|
97 CL_IMAGE_FORMAT_MISMATCH = -9,
|
|
98 CL_IMAGE_FORMAT_NOT_SUPPORTED = -10,
|
|
99 CL_BUILD_PROGRAM_FAILURE = -11,
|
|
100 CL_MAP_FAILURE = -12,
|
|
101
|
|
102 CL_INVALID_VALUE = -30,
|
|
103 CL_INVALID_DEVICE_TYPE = -31,
|
|
104 CL_INVALID_PLATFORM = -32,
|
|
105 CL_INVALID_DEVICE = -33,
|
|
106 CL_INVALID_CONTEXT = -34,
|
|
107 CL_INVALID_QUEUE_PROPERTIES = -35,
|
|
108 CL_INVALID_COMMAND_QUEUE = -36,
|
|
109 CL_INVALID_HOST_PTR = -37,
|
|
110 CL_INVALID_MEM_OBJECT = -38,
|
|
111 CL_INVALID_IMAGE_FORMAT_DESCRIPTOR = -39,
|
|
112 CL_INVALID_IMAGE_SIZE = -40,
|
|
113 CL_INVALID_SAMPLER = -41,
|
|
114 CL_INVALID_BINARY = -42,
|
|
115 CL_INVALID_BUILD_OPTIONS = -43,
|
|
116 CL_INVALID_PROGRAM = -44,
|
|
117 CL_INVALID_PROGRAM_EXECUTABLE = -45,
|
|
118 CL_INVALID_KERNEL_NAME = -46,
|
|
119 CL_INVALID_KERNEL_DEFINITION = -47,
|
|
120 CL_INVALID_KERNEL = -48,
|
|
121 CL_INVALID_ARG_INDEX = -49,
|
|
122 CL_INVALID_ARG_VALUE = -50,
|
|
123 CL_INVALID_ARG_SIZE = -51,
|
|
124 CL_INVALID_KERNEL_ARGS = -52,
|
|
125 CL_INVALID_WORK_DIMENSION = -53,
|
|
126 CL_INVALID_WORK_GROUP_SIZE = -54,
|
|
127 CL_INVALID_WORK_ITEM_SIZE = -55,
|
|
128 CL_INVALID_GLOBAL_OFFSET = -56,
|
|
129 CL_INVALID_EVENT_WAIT_LIST = -57,
|
|
130 CL_INVALID_EVENT = -58,
|
|
131 CL_INVALID_OPERATION = -59,
|
|
132 CL_INVALID_GL_OBJECT = -60,
|
|
133 CL_INVALID_BUFFER_SIZE = -61,
|
|
134 CL_INVALID_MIP_LEVEL = -62,
|
|
135 CL_INVALID_GLOBAL_WORK_SIZE = -63,
|
|
136
|
|
137 // OpenCL Version
|
|
138 CL_VERSION_1_0 = 1,
|
|
139
|
|
140 // cl_bool
|
|
141 CL_FALSE = 0,
|
|
142 CL_TRUE = 1,
|
|
143
|
|
144 // cl_platform_info
|
|
145 CL_PLATFORM_PROFILE = 0x0900,
|
|
146 CL_PLATFORM_VERSION = 0x0901,
|
|
147 CL_PLATFORM_NAME = 0x0902,
|
|
148 CL_PLATFORM_VENDOR = 0x0903,
|
|
149 CL_PLATFORM_EXTENSIONS = 0x0904,
|
|
150
|
|
151 // cl_device_type - bitfield
|
|
152 CL_DEVICE_TYPE_DEFAULT = (1 << 0),
|
|
153 CL_DEVICE_TYPE_CPU = (1 << 1),
|
|
154 CL_DEVICE_TYPE_GPU = (1 << 2),
|
|
155 CL_DEVICE_TYPE_ACCELERATOR = (1 << 3),
|
|
156 CL_DEVICE_TYPE_ALL = 0xFFFFFFFF,
|
|
157
|
|
158 // cl_device_info
|
|
159 CL_DEVICE_TYPE = 0x1000,
|
|
160 CL_DEVICE_VENDOR_ID = 0x1001,
|
|
161 CL_DEVICE_MAX_COMPUTE_UNITS = 0x1002,
|
|
162 CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS = 0x1003,
|
|
163 CL_DEVICE_MAX_WORK_GROUP_SIZE = 0x1004,
|
|
164 CL_DEVICE_MAX_WORK_ITEM_SIZES = 0x1005,
|
|
165 CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR = 0x1006,
|
|
166 CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT = 0x1007,
|
|
167 CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT = 0x1008,
|
|
168 CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG = 0x1009,
|
|
169 CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT = 0x100A,
|
|
170 CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE = 0x100B,
|
|
171 CL_DEVICE_MAX_CLOCK_FREQUENCY = 0x100C,
|
|
172 CL_DEVICE_ADDRESS_BITS = 0x100D,
|
|
173 CL_DEVICE_MAX_READ_IMAGE_ARGS = 0x100E,
|
|
174 CL_DEVICE_MAX_WRITE_IMAGE_ARGS = 0x100F,
|
|
175 CL_DEVICE_MAX_MEM_ALLOC_SIZE = 0x1010,
|
|
176 CL_DEVICE_IMAGE2D_MAX_WIDTH = 0x1011,
|
|
177 CL_DEVICE_IMAGE2D_MAX_HEIGHT = 0x1012,
|
|
178 CL_DEVICE_IMAGE3D_MAX_WIDTH = 0x1013,
|
|
179 CL_DEVICE_IMAGE3D_MAX_HEIGHT = 0x1014,
|
|
180 CL_DEVICE_IMAGE3D_MAX_DEPTH = 0x1015,
|
|
181 CL_DEVICE_IMAGE_SUPPORT = 0x1016,
|
|
182 CL_DEVICE_MAX_PARAMETER_SIZE = 0x1017,
|
|
183 CL_DEVICE_MAX_SAMPLERS = 0x1018,
|
|
184 CL_DEVICE_MEM_BASE_ADDR_ALIGN = 0x1019,
|
|
185 CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE = 0x101A,
|
|
186 CL_DEVICE_SINGLE_FP_CONFIG = 0x101B,
|
|
187 CL_DEVICE_GLOBAL_MEM_CACHE_TYPE = 0x101C,
|
|
188 CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE = 0x101D,
|
|
189 CL_DEVICE_GLOBAL_MEM_CACHE_SIZE = 0x101E,
|
|
190 CL_DEVICE_GLOBAL_MEM_SIZE = 0x101F,
|
|
191 CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE = 0x1020,
|
|
192 CL_DEVICE_MAX_CONSTANT_ARGS = 0x1021,
|
|
193 CL_DEVICE_LOCAL_MEM_TYPE = 0x1022,
|
|
194 CL_DEVICE_LOCAL_MEM_SIZE = 0x1023,
|
|
195 CL_DEVICE_ERROR_CORRECTION_SUPPORT = 0x1024,
|
|
196 CL_DEVICE_PROFILING_TIMER_RESOLUTION = 0x1025,
|
|
197 CL_DEVICE_ENDIAN_LITTLE = 0x1026,
|
|
198 CL_DEVICE_AVAILABLE = 0x1027,
|
|
199 CL_DEVICE_COMPILER_AVAILABLE = 0x1028,
|
|
200 CL_DEVICE_EXECUTION_CAPABILITIES = 0x1029,
|
|
201 CL_DEVICE_QUEUE_PROPERTIES = 0x102A,
|
|
202 CL_DEVICE_NAME = 0x102B,
|
|
203 CL_DEVICE_VENDOR = 0x102C,
|
|
204 CL_DRIVER_VERSION = 0x102D,
|
|
205 CL_DEVICE_PROFILE = 0x102E,
|
|
206 CL_DEVICE_VERSION = 0x102F,
|
|
207 CL_DEVICE_EXTENSIONS = 0x1030,
|
|
208 CL_DEVICE_PLATFORM = 0x1031,
|
|
209
|
|
210 // cl_device_fp_config - bitfield
|
|
211 CL_FP_DENORM = (1 << 0),
|
|
212 CL_FP_INF_NAN = (1 << 1),
|
|
213 CL_FP_ROUND_TO_NEAREST = (1 << 2),
|
|
214 CL_FP_ROUND_TO_ZERO = (1 << 3),
|
|
215 CL_FP_ROUND_TO_INF = (1 << 4),
|
|
216 CL_FP_FMA = (1 << 5),
|
|
217
|
|
218 // cl_device_mem_cache_type
|
|
219 CL_NONE = 0x0,
|
|
220 CL_READ_ONLY_CACHE = 0x1,
|
|
221 CL_READ_WRITE_CACHE = 0x2,
|
|
222
|
|
223 // cl_device_local_mem_type
|
|
224 CL_LOCAL = 0x1,
|
|
225 CL_GLOBAL = 0x2,
|
|
226
|
|
227 // cl_device_exec_capabilities - bitfield
|
|
228 CL_EXEC_KERNEL = (1 << 0),
|
|
229 CL_EXEC_NATIVE_KERNEL = (1 << 1),
|
|
230
|
|
231 // cl_command_queue_properties - bitfield
|
|
232 CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE = (1 << 0),
|
|
233 CL_QUEUE_PROFILING_ENABLE = (1 << 1),
|
|
234
|
|
235 // cl_context_info
|
|
236 CL_CONTEXT_REFERENCE_COUNT = 0x1080,
|
|
237 CL_CONTEXT_DEVICES = 0x1081,
|
|
238 CL_CONTEXT_PROPERTIES = 0x1082,
|
|
239
|
|
240 // cl_context_properties
|
|
241 CL_CONTEXT_PLATFORM = 0x1084,
|
|
242
|
|
243 // cl_command_queue_info
|
|
244 CL_QUEUE_CONTEXT = 0x1090,
|
|
245 CL_QUEUE_DEVICE = 0x1091,
|
|
246 CL_QUEUE_REFERENCE_COUNT = 0x1092,
|
|
247 CL_QUEUE_PROPERTIES = 0x1093,
|
|
248
|
|
249 // cl_mem_flags - bitfield
|
|
250 CL_MEM_READ_WRITE = (1 << 0),
|
|
251 CL_MEM_WRITE_ONLY = (1 << 1),
|
|
252 CL_MEM_READ_ONLY = (1 << 2),
|
|
253 CL_MEM_USE_HOST_PTR = (1 << 3),
|
|
254 CL_MEM_ALLOC_HOST_PTR = (1 << 4),
|
|
255 CL_MEM_COPY_HOST_PTR = (1 << 5),
|
|
256
|
|
257 // cl_channel_order
|
|
258 CL_R = 0x10B0,
|
|
259 CL_A = 0x10B1,
|
|
260 CL_RG = 0x10B2,
|
|
261 CL_RA = 0x10B3,
|
|
262 CL_RGB = 0x10B4,
|
|
263 CL_RGBA = 0x10B5,
|
|
264 CL_BGRA = 0x10B6,
|
|
265 CL_ARGB = 0x10B7,
|
|
266 CL_INTENSITY = 0x10B8,
|
|
267 CL_LUMINANCE = 0x10B9,
|
|
268
|
|
269 // cl_channel_type
|
|
270 CL_SNORM_INT8 = 0x10D0,
|
|
271 CL_SNORM_INT16 = 0x10D1,
|
|
272 CL_UNORM_INT8 = 0x10D2,
|
|
273 CL_UNORM_INT16 = 0x10D3,
|
|
274 CL_UNORM_SHORT_565 = 0x10D4,
|
|
275 CL_UNORM_SHORT_555 = 0x10D5,
|
|
276 CL_UNORM_INT_101010 = 0x10D6,
|
|
277 CL_SIGNED_INT8 = 0x10D7,
|
|
278 CL_SIGNED_INT16 = 0x10D8,
|
|
279 CL_SIGNED_INT32 = 0x10D9,
|
|
280 CL_UNSIGNED_INT8 = 0x10DA,
|
|
281 CL_UNSIGNED_INT16 = 0x10DB,
|
|
282 CL_UNSIGNED_INT32 = 0x10DC,
|
|
283 CL_HALF_FLOAT = 0x10DD,
|
|
284 CL_FLOAT = 0x10DE,
|
|
285
|
|
286 // cl_mem_object_type
|
|
287 CL_MEM_OBJECT_BUFFER = 0x10F0,
|
|
288 CL_MEM_OBJECT_IMAGE2D = 0x10F1,
|
|
289 CL_MEM_OBJECT_IMAGE3D = 0x10F2,
|
|
290
|
|
291 // cl_mem_info
|
|
292 CL_MEM_TYPE = 0x1100,
|
|
293 CL_MEM_FLAGS = 0x1101,
|
|
294 CL_MEM_SIZE = 0x1102,
|
|
295 CL_MEM_HOST_PTR = 0x1103,
|
|
296 CL_MEM_MAP_COUNT = 0x1104,
|
|
297 CL_MEM_REFERENCE_COUNT = 0x1105,
|
|
298 CL_MEM_CONTEXT = 0x1106,
|
|
299
|
|
300 // cl_image_info
|
|
301 CL_IMAGE_FORMAT = 0x1110,
|
|
302 CL_IMAGE_ELEMENT_SIZE = 0x1111,
|
|
303 CL_IMAGE_ROW_PITCH = 0x1112,
|
|
304 CL_IMAGE_SLICE_PITCH = 0x1113,
|
|
305 CL_IMAGE_WIDTH = 0x1114,
|
|
306 CL_IMAGE_HEIGHT = 0x1115,
|
|
307 CL_IMAGE_DEPTH = 0x1116,
|
|
308
|
|
309 // cl_addressing_mode
|
|
310 CL_ADDRESS_NONE = 0x1130,
|
|
311 CL_ADDRESS_CLAMP_TO_EDGE = 0x1131,
|
|
312 CL_ADDRESS_CLAMP = 0x1132,
|
|
313 CL_ADDRESS_REPEAT = 0x1133,
|
|
314
|
|
315 // cl_filter_mode
|
|
316 CL_FILTER_NEAREST = 0x1140,
|
|
317 CL_FILTER_LINEAR = 0x1141,
|
|
318
|
|
319 // cl_sampler_info
|
|
320 CL_SAMPLER_REFERENCE_COUNT = 0x1150,
|
|
321 CL_SAMPLER_CONTEXT = 0x1151,
|
|
322 CL_SAMPLER_NORMALIZED_COORDS = 0x1152,
|
|
323 CL_SAMPLER_ADDRESSING_MODE = 0x1153,
|
|
324 CL_SAMPLER_FILTER_MODE = 0x1154,
|
|
325
|
|
326 // cl_map_flags - bitfield
|
|
327 CL_MAP_READ = (1 << 0),
|
|
328 CL_MAP_WRITE = (1 << 1),
|
|
329
|
|
330 // cl_program_info
|
|
331 CL_PROGRAM_REFERENCE_COUNT = 0x1160,
|
|
332 CL_PROGRAM_CONTEXT = 0x1161,
|
|
333 CL_PROGRAM_NUM_DEVICES = 0x1162,
|
|
334 CL_PROGRAM_DEVICES = 0x1163,
|
|
335 CL_PROGRAM_SOURCE = 0x1164,
|
|
336 CL_PROGRAM_BINARY_SIZES = 0x1165,
|
|
337 CL_PROGRAM_BINARIES = 0x1166,
|
|
338
|
|
339 // cl_program_build_info
|
|
340 CL_PROGRAM_BUILD_STATUS = 0x1181,
|
|
341 CL_PROGRAM_BUILD_OPTIONS = 0x1182,
|
|
342 CL_PROGRAM_BUILD_LOG = 0x1183,
|
|
343
|
|
344 // cl_build_status
|
|
345 CL_BUILD_SUCCESS = 0,
|
|
346 CL_BUILD_NONE = -1,
|
|
347 CL_BUILD_ERROR = -2,
|
|
348 CL_BUILD_IN_PROGRESS = -3,
|
|
349
|
|
350 // cl_kernel_info
|
|
351 CL_KERNEL_FUNCTION_NAME = 0x1190,
|
|
352 CL_KERNEL_NUM_ARGS = 0x1191,
|
|
353 CL_KERNEL_REFERENCE_COUNT = 0x1192,
|
|
354 CL_KERNEL_CONTEXT = 0x1193,
|
|
355 CL_KERNEL_PROGRAM = 0x1194,
|
|
356
|
|
357 // cl_kernel_work_group_info
|
|
358 CL_KERNEL_WORK_GROUP_SIZE = 0x11B0,
|
|
359 CL_KERNEL_COMPILE_WORK_GROUP_SIZE = 0x11B1,
|
|
360 CL_KERNEL_LOCAL_MEM_SIZE = 0x11B2,
|
|
361
|
|
362 // cl_event_info
|
|
363 CL_EVENT_COMMAND_QUEUE = 0x11D0,
|
|
364 CL_EVENT_COMMAND_TYPE = 0x11D1,
|
|
365 CL_EVENT_REFERENCE_COUNT = 0x11D2,
|
|
366 CL_EVENT_COMMAND_EXECUTION_STATUS = 0x11D3,
|
|
367
|
|
368 // cl_command_type
|
|
369 CL_COMMAND_NDRANGE_KERNEL = 0x11F0,
|
|
370 CL_COMMAND_TASK = 0x11F1,
|
|
371 CL_COMMAND_NATIVE_KERNEL = 0x11F2,
|
|
372 CL_COMMAND_READ_BUFFER = 0x11F3,
|
|
373 CL_COMMAND_WRITE_BUFFER = 0x11F4,
|
|
374 CL_COMMAND_COPY_BUFFER = 0x11F5,
|
|
375 CL_COMMAND_READ_IMAGE = 0x11F6,
|
|
376 CL_COMMAND_WRITE_IMAGE = 0x11F7,
|
|
377 CL_COMMAND_COPY_IMAGE = 0x11F8,
|
|
378 CL_COMMAND_COPY_IMAGE_TO_BUFFER = 0x11F9,
|
|
379 CL_COMMAND_COPY_BUFFER_TO_IMAGE = 0x11FA,
|
|
380 CL_COMMAND_MAP_BUFFER = 0x11FB,
|
|
381 CL_COMMAND_MAP_IMAGE = 0x11FC,
|
|
382 CL_COMMAND_UNMAP_MEM_OBJECT = 0x11FD,
|
|
383 CL_COMMAND_MARKER = 0x11FE,
|
|
384 CL_COMMAND_ACQUIRE_GL_OBJECTS = 0x11FF,
|
|
385 CL_COMMAND_RELEASE_GL_OBJECTS = 0x1200,
|
|
386
|
|
387 // command execution status
|
|
388 CL_COMPLETE = 0x0,
|
|
389 CL_RUNNING = 0x1,
|
|
390 CL_SUBMITTED = 0x2,
|
|
391 CL_QUEUED = 0x3,
|
|
392
|
|
393 // cl_profiling_info
|
|
394 CL_PROFILING_COMMAND_QUEUED = 0x1280,
|
|
395 CL_PROFILING_COMMAND_SUBMIT = 0x1281,
|
|
396 CL_PROFILING_COMMAND_START = 0x1282,
|
|
397 CL_PROFILING_COMMAND_END = 0x1283
|
|
398 }
|
|
399
|
|
400 /********************************************************************************************************/
|
|
401
|
|
402 // Platform API
|
|
403 cl_int clGetPlatformIDs(
|
|
404 cl_uint num_entries,
|
|
405 cl_platform_id* platforms,
|
|
406 cl_uint* num_platforms
|
|
407 );
|
|
408
|
|
409 cl_int clGetPlatformInfo(
|
|
410 cl_platform_id platform,
|
|
411 cl_platform_info param_name,
|
|
412 size_t param_value_size,
|
|
413 void* param_value,
|
|
414 size_t* param_value_size_ret
|
|
415 );
|
|
416
|
|
417 // Device APIs
|
|
418 cl_int clGetDeviceIDs(
|
|
419 cl_platform_id platform,
|
|
420 cl_device_type device_type,
|
|
421 cl_uint num_entries,
|
|
422 cl_device_id* devices,
|
|
423 cl_uint* num_devices
|
|
424 );
|
|
425
|
|
426 cl_int clGetDeviceInfo(
|
|
427 cl_device_id device,
|
|
428 cl_device_info param_name,
|
|
429 size_t param_value_size,
|
|
430 void* param_value,
|
|
431 size_t* param_value_size_ret
|
|
432 );
|
|
433
|
|
434 // Context APIs
|
|
435
|
|
436 typedef void function(
|
|
437 const(char)*,
|
|
438 const(void)*,
|
|
439 size_t,
|
|
440 const(void)*
|
|
441 ) cl_logging_fn;
|
|
442
|
|
443 cl_context clCreateContext(
|
|
444 const(cl_context_properties)* properties,
|
|
445 cl_uint num_devices,
|
|
446 const(cl_device_id)* devices,
|
|
447 cl_logging_fn pfn_notify,
|
|
448 void* user_data,
|
|
449 cl_int* errcode_ret
|
|
450 );
|
|
451
|
|
452 cl_context clCreateContextFromType(
|
|
453 const(cl_context_properties)* properties,
|
|
454 cl_device_type device_type,
|
|
455 cl_logging_fn pfn_notify,
|
|
456 void* user_data,
|
|
457 cl_int* errcode_ret
|
|
458 );
|
|
459
|
|
460 cl_int clRetainContext(
|
|
461 cl_context context
|
|
462 );
|
|
463
|
|
464 cl_int clReleaseContext(
|
|
465 cl_context context
|
|
466 );
|
|
467
|
|
468 cl_int clGetContextInfo(
|
|
469 cl_context context,
|
|
470 cl_context_info param_name,
|
|
471 size_t param_value_size,
|
|
472 void* param_value,
|
|
473 size_t* param_value_size_ret
|
|
474 );
|
|
475
|
|
476 // Command Queue APIs
|
|
477 cl_command_queue clCreateCommandQueue(
|
|
478 cl_context context,
|
|
479 cl_device_id device,
|
|
480 cl_command_queue_properties properties,
|
|
481 cl_int* errcode_ret
|
|
482 );
|
|
483
|
|
484 cl_int clRetainCommandQueue(
|
|
485 cl_command_queue command_queue
|
|
486 );
|
|
487
|
|
488 cl_int clReleaseCommandQueue(
|
|
489 cl_command_queue command_queue
|
|
490 );
|
|
491
|
|
492 cl_int clGetCommandQueueInfo(
|
|
493 cl_command_queue command_queue,
|
|
494 cl_command_queue_info param_name,
|
|
495 size_t param_value_size,
|
|
496 void * param_value,
|
|
497 size_t * param_value_size_ret
|
|
498 );
|
|
499
|
|
500 cl_int clSetCommandQueueProperty(
|
|
501 cl_command_queue command_queue,
|
|
502 cl_command_queue_properties properties,
|
|
503 cl_bool enable,
|
|
504 cl_command_queue_properties* old_properties
|
|
505 );
|
|
506
|
|
507 // Memory Object APIs
|
|
508 cl_mem clCreateBuffer(
|
|
509 cl_context context,
|
|
510 cl_mem_flags flags,
|
|
511 size_t size,
|
|
512 void * host_ptr,
|
|
513 cl_int * errcode_ret
|
|
514 );
|
|
515
|
|
516 cl_mem clCreateImage2D(
|
|
517 cl_context context,
|
|
518 cl_mem_flags flags,
|
|
519 const(cl_image_format)* image_format,
|
|
520 size_t image_width,
|
|
521 size_t image_height,
|
|
522 size_t image_row_pitch,
|
|
523 void* host_ptr,
|
|
524 cl_int* errcode_ret
|
|
525 );
|
|
526
|
|
527 cl_mem clCreateImage3D(
|
|
528 cl_context context,
|
|
529 cl_mem_flags flags,
|
|
530 const(cl_image_format)* image_format,
|
|
531 size_t image_width,
|
|
532 size_t image_height,
|
|
533 size_t image_depth,
|
|
534 size_t image_row_pitch,
|
|
535 size_t image_slice_pitch,
|
|
536 void* host_ptr,
|
|
537 cl_int* errcode_ret
|
|
538 );
|
|
539
|
|
540 cl_int clRetainMemObject(
|
|
541 cl_mem memobj
|
|
542 );
|
|
543
|
|
544 cl_int clReleaseMemObject(
|
|
545 cl_mem memobj
|
|
546 );
|
|
547
|
|
548 cl_int clGetSupportedImageFormats(
|
|
549 cl_context context,
|
|
550 cl_mem_flags flags,
|
|
551 cl_mem_object_type image_type,
|
|
552 cl_uint num_entries,
|
|
553 cl_image_format* image_formats,
|
|
554 cl_uint* num_image_formats
|
|
555 );
|
|
556
|
|
557 cl_int clGetMemObjectInfo(
|
|
558 cl_mem memobj,
|
|
559 cl_mem_info param_name,
|
|
560 size_t param_value_size,
|
|
561 void* param_value,
|
|
562 size_t* param_value_size_ret
|
|
563 );
|
|
564
|
|
565 cl_int clGetImageInfo(
|
|
566 cl_mem image,
|
|
567 cl_image_info param_name,
|
|
568 size_t param_value_size,
|
|
569 void * param_value,
|
|
570 size_t * param_value_size_ret
|
|
571 );
|
|
572
|
|
573 // Sampler APIs
|
|
574 cl_sampler clCreateSampler(
|
|
575 cl_context context,
|
|
576 cl_bool normalized_coords,
|
|
577 cl_addressing_mode addressing_mode,
|
|
578 cl_filter_mode filter_mode,
|
|
579 cl_int* errcode_ret
|
|
580 );
|
|
581
|
|
582 cl_int clRetainSampler(
|
|
583 cl_sampler sampler
|
|
584 );
|
|
585
|
|
586 cl_int clReleaseSampler(
|
|
587 cl_sampler sampler
|
|
588 );
|
|
589
|
|
590 cl_int clGetSamplerInfo(
|
|
591 cl_sampler sampler,
|
|
592 cl_sampler_info param_name,
|
|
593 size_t param_value_size,
|
|
594 void* param_value,
|
|
595 size_t* param_value_size_ret
|
|
596 );
|
|
597
|
|
598 // Program Object APIs
|
|
599 cl_program clCreateProgramWithSource(
|
|
600 cl_context context,
|
|
601 cl_uint count,
|
|
602 const(char*)* strings,
|
|
603 const(size_t)* lengths,
|
|
604 cl_int* errcode_ret
|
|
605 );
|
|
606
|
|
607 cl_program clCreateProgramWithBinary(
|
|
608 cl_context context,
|
|
609 cl_uint num_devices,
|
|
610 const(cl_device_id)* device_list,
|
|
611 const(size_t)* lengths,
|
|
612 const(ubyte*)* binaries,
|
|
613 cl_int* binary_status,
|
|
614 cl_int* errcode_ret
|
|
615 );
|
|
616
|
|
617 cl_int clRetainProgram(
|
|
618 cl_program program
|
|
619 );
|
|
620
|
|
621 cl_int clReleaseProgram(
|
|
622 cl_program program
|
|
623 );
|
|
624
|
|
625 cl_int clBuildProgram(
|
|
626 cl_program program,
|
|
627 cl_uint num_devices,
|
|
628 const(cl_device_id)* device_list,
|
|
629 const(char)* options,
|
|
630 void function(
|
|
631 cl_program program,
|
|
632 void* user_data
|
|
633 ) pfn_notify,
|
|
634 void* user_data
|
|
635 );
|
|
636
|
|
637 cl_int clUnloadCompiler();
|
|
638
|
|
639 cl_int clGetProgramInfo(
|
|
640 cl_program program,
|
|
641 cl_program_info param_name,
|
|
642 size_t param_value_size,
|
|
643 void* param_value,
|
|
644 size_t* param_value_size_ret
|
|
645 );
|
|
646
|
|
647 cl_int clGetProgramBuildInfo(
|
|
648 cl_program program,
|
|
649 cl_device_id device,
|
|
650 cl_program_build_info param_name,
|
|
651 size_t param_value_size,
|
|
652 void* param_value,
|
|
653 size_t* param_value_size_ret
|
|
654 );
|
|
655
|
|
656 // Kernel Object APIs
|
|
657 cl_kernel clCreateKernel(
|
|
658 cl_program program,
|
|
659 const(char)* kernel_name,
|
|
660 cl_int* errcode_ret
|
|
661 );
|
|
662
|
|
663 cl_int clCreateKernelsInProgram(
|
|
664 cl_program program,
|
|
665 cl_uint num_kernels,
|
|
666 cl_kernel* kernels,
|
|
667 cl_uint* num_kernels_ret
|
|
668 );
|
|
669
|
|
670 cl_int clRetainKernel(
|
|
671 cl_kernel kernel
|
|
672 );
|
|
673
|
|
674 cl_int clReleaseKernel(
|
|
675 cl_kernel kernel
|
|
676 );
|
|
677
|
|
678 cl_int clSetKernelArg(
|
|
679 cl_kernel kernel,
|
|
680 cl_uint arg_indx,
|
|
681 size_t arg_size,
|
|
682 const(void)* arg_value
|
|
683 );
|
|
684
|
|
685 cl_int clGetKernelInfo(
|
|
686 cl_kernel kernel,
|
|
687 cl_kernel_info param_name,
|
|
688 size_t param_value_size,
|
|
689 void* param_value,
|
|
690 size_t* param_value_size_ret
|
|
691 );
|
|
692
|
|
693 cl_int clGetKernelWorkGroupInfo(
|
|
694 cl_kernel kernel,
|
|
695 cl_device_id device,
|
|
696 cl_kernel_work_group_info param_name,
|
|
697 size_t param_value_size,
|
|
698 void* param_value,
|
|
699 size_t* param_value_size_ret
|
|
700 );
|
|
701
|
|
702 // Event Object APIs
|
|
703 cl_int clWaitForEvents(
|
|
704 cl_uint num_events,
|
|
705 const(cl_event)* event_list
|
|
706 );
|
|
707
|
|
708 cl_int clGetEventInfo(
|
|
709 cl_event event,
|
|
710 cl_event_info param_name,
|
|
711 size_t param_value_size,
|
|
712 void* param_value,
|
|
713 size_t* param_value_size_ret
|
|
714 );
|
|
715
|
|
716 cl_int clRetainEvent(
|
|
717 cl_event event
|
|
718 );
|
|
719
|
|
720 cl_int clReleaseEvent(
|
|
721 cl_event event
|
|
722 );
|
|
723
|
|
724 // Profiling APIs
|
|
725 cl_int clGetEventProfilingInfo(
|
|
726 cl_event event,
|
|
727 cl_profiling_info param_name,
|
|
728 size_t param_value_size,
|
|
729 void* param_value,
|
|
730 size_t* param_value_size_ret
|
|
731 );
|
|
732
|
|
733 // Flush and Finish APIs
|
|
734 cl_int clFlush(
|
|
735 cl_command_queue command_queue
|
|
736 );
|
|
737
|
|
738 cl_int clFinish(
|
|
739 cl_command_queue command_queue
|
|
740 );
|
|
741
|
|
742 // Enqueued Commands APIs
|
|
743 cl_int clEnqueueReadBuffer(
|
|
744 cl_command_queue command_queue,
|
|
745 cl_mem buffer,
|
|
746 cl_bool blocking_read,
|
|
747 size_t offset,
|
|
748 size_t cb,
|
|
749 void * ptr,
|
|
750 cl_uint num_events_in_wait_list,
|
|
751 const(cl_event)* event_wait_list,
|
|
752 cl_event* event
|
|
753 );
|
|
754
|
|
755 cl_int clEnqueueWriteBuffer(
|
|
756 cl_command_queue command_queue,
|
|
757 cl_mem buffer,
|
|
758 cl_bool blocking_write,
|
|
759 size_t offset,
|
|
760 size_t cb,
|
|
761 const(void)* ptr,
|
|
762 cl_uint num_events_in_wait_list,
|
|
763 const(cl_event)* event_wait_list,
|
|
764 cl_event* event
|
|
765 );
|
|
766
|
|
767 cl_int clEnqueueCopyBuffer(
|
|
768 cl_command_queue command_queue,
|
|
769 cl_mem src_buffer,
|
|
770 cl_mem dst_buffer,
|
|
771 size_t src_offset,
|
|
772 size_t dst_offset,
|
|
773 size_t cb,
|
|
774 cl_uint num_events_in_wait_list,
|
|
775 const(cl_event)* event_wait_list,
|
|
776 cl_event* event
|
|
777 );
|
|
778
|
|
779 cl_int clEnqueueReadImage(
|
|
780 cl_command_queue command_queue,
|
|
781 cl_mem image,
|
|
782 cl_bool blocking_read,
|
|
783 const(size_t)* origin[3],
|
|
784 const(size_t)* region[3],
|
|
785 size_t row_pitch,
|
|
786 size_t slice_pitch,
|
|
787 void* ptr,
|
|
788 cl_uint num_events_in_wait_list,
|
|
789 const(cl_event)* event_wait_list,
|
|
790 cl_event* event
|
|
791 );
|
|
792
|
|
793 cl_int clEnqueueWriteImage(
|
|
794 cl_command_queue command_queue,
|
|
795 cl_mem image,
|
|
796 cl_bool blocking_write,
|
|
797 const(size_t)* origin[3],
|
|
798 const(size_t)* region[3],
|
|
799 size_t input_row_pitch,
|
|
800 size_t input_slice_pitch,
|
|
801 const(void)* ptr,
|
|
802 cl_uint num_events_in_wait_list,
|
|
803 const(cl_event)* event_wait_list,
|
|
804 cl_event* event
|
|
805 );
|
|
806
|
|
807 cl_int clEnqueueCopyImage(
|
|
808 cl_command_queue command_queue,
|
|
809 cl_mem src_image,
|
|
810 cl_mem dst_image,
|
|
811 const(size_t)* src_origin[3],
|
|
812 const(size_t)* dst_origin[3],
|
|
813 const(size_t)* region[3],
|
|
814 cl_uint num_events_in_wait_list,
|
|
815 const(cl_event)* event_wait_list,
|
|
816 cl_event* event
|
|
817 );
|
|
818
|
|
819 cl_int clEnqueueCopyImageToBuffer(
|
|
820 cl_command_queue command_queue,
|
|
821 cl_mem src_image,
|
|
822 cl_mem dst_buffer,
|
|
823 const(size_t)* src_origin[3],
|
|
824 const(size_t)* region[3],
|
|
825 size_t dst_offset,
|
|
826 cl_uint num_events_in_wait_list,
|
|
827 const(cl_event)* event_wait_list,
|
|
828 cl_event* event
|
|
829 );
|
|
830
|
|
831 cl_int clEnqueueCopyBufferToImage(
|
|
832 cl_command_queue command_queue,
|
|
833 cl_mem src_buffer,
|
|
834 cl_mem dst_image,
|
|
835 size_t src_offset,
|
|
836 const(size_t)* dst_origin[3],
|
|
837 const(size_t)* region[3],
|
|
838 cl_uint num_events_in_wait_list,
|
|
839 const(cl_event)* event_wait_list,
|
|
840 cl_event* event
|
|
841 );
|
|
842
|
|
843 void* clEnqueueMapBuffer(
|
|
844 cl_command_queue command_queue,
|
|
845 cl_mem buffer,
|
|
846 cl_bool blocking_map,
|
|
847 cl_map_flags map_flags,
|
|
848 size_t offset,
|
|
849 size_t cb,
|
|
850 cl_uint num_events_in_wait_list,
|
|
851 const(cl_event)* event_wait_list,
|
|
852 cl_event* event,
|
|
853 cl_int* errcode_ret
|
|
854 );
|
|
855
|
|
856 void* clEnqueueMapImage(
|
|
857 cl_command_queue command_queue,
|
|
858 cl_mem image,
|
|
859 cl_bool blocking_map,
|
|
860 cl_map_flags map_flags,
|
|
861 const(size_t)* origin[3],
|
|
862 const(size_t)* region[3],
|
|
863 size_t* image_row_pitch,
|
|
864 size_t* image_slice_pitch,
|
|
865 cl_uint num_events_in_wait_list,
|
|
866 const(cl_event)* event_wait_list,
|
|
867 cl_event* event,
|
|
868 cl_int* errcode_ret
|
|
869 );
|
|
870
|
|
871 cl_int clEnqueueUnmapMemObject(
|
|
872 cl_command_queue command_queue,
|
|
873 cl_mem memobj,
|
|
874 void* mapped_ptr,
|
|
875 cl_uint num_events_in_wait_list,
|
|
876 const(cl_event)* event_wait_list,
|
|
877 cl_event* event
|
|
878 );
|
|
879
|
|
880 cl_int clEnqueueNDRangeKernel(
|
|
881 cl_command_queue command_queue,
|
|
882 cl_kernel kernel,
|
|
883 cl_uint work_dim,
|
|
884 const(size_t)* global_work_offset,
|
|
885 const(size_t)* global_work_size,
|
|
886 const(size_t)* local_work_size,
|
|
887 cl_uint num_events_in_wait_list,
|
|
888 const(cl_event)* event_wait_list,
|
|
889 cl_event* event
|
|
890 );
|
|
891
|
|
892 cl_int clEnqueueTask(
|
|
893 cl_command_queue command_queue,
|
|
894 cl_kernel kernel,
|
|
895 cl_uint num_events_in_wait_list,
|
|
896 const(cl_event)* event_wait_list,
|
|
897 cl_event* event
|
|
898 );
|
|
899
|
|
900 cl_int clEnqueueNativeKernel(
|
|
901 cl_command_queue command_queue,
|
|
902 void function(
|
|
903 void*
|
|
904 ) user_func,
|
|
905 void* args,
|
|
906 size_t cb_args,
|
|
907 cl_uint num_mem_objects,
|
|
908 const(cl_mem)* mem_list,
|
|
909 const(void*)* args_mem_loc,
|
|
910 cl_uint num_events_in_wait_list,
|
|
911 const(cl_event)* event_wait_list,
|
|
912 cl_event* event
|
|
913 );
|
|
914
|
|
915 cl_int clEnqueueMarker(
|
|
916 cl_command_queue command_queue,
|
|
917 cl_event* event
|
|
918 );
|
|
919
|
|
920 cl_int clEnqueueWaitForEvents(
|
|
921 cl_command_queue command_queue,
|
|
922 cl_uint num_events,
|
|
923 const(cl_event)* event_list
|
|
924 );
|
|
925
|
|
926 cl_int clEnqueueBarrier(
|
|
927 cl_command_queue command_queue
|
|
928 );
|
|
929
|
|
930 //Extension function access
|
|
931 //
|
|
932 // Returns the extension function address for the given function name,
|
|
933 // or NULL if a valid function can not be found. The client must
|
|
934 // check to make sure the address is not NULL, before using or
|
|
935 // calling the returned function address.
|
|
936 //
|
|
937 void* clGetExtensionFunctionAddress(const(char)* func_name); |