1 /*******************************************************************************
2  * Copyright (c) 2008-2015 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  * MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
16  * KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
17  * SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
18  *    https://www.khronos.org/registry/
19  *
20  * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26  * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
27  ******************************************************************************/
28 
29 /* $Revision: 11928 $ on $Date: 2010-07-13 09:04:56 -0700 (Tue, 13 Jul 2010) $ */
30 
31 /* cl_ext.h contains OpenCL extensions which don't have external */
32 /* (OpenGL, D3D) dependencies.                                   */
33 
34 #ifndef __CL_EXT_H
35 #define __CL_EXT_H
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 #ifdef __APPLE__
42         #include <OpenCL/cl.h>
43     #include <AvailabilityMacros.h>
44 #else
45         #include <CL/cl.h>
46 #endif
47 
48 /* cl_khr_fp16 extension - no extension #define since it has no functions  */
49 #define CL_DEVICE_HALF_FP_CONFIG                    0x1033
50 
51 /* Memory object destruction
52  *
53  * Apple extension for use to manage externally allocated buffers used with cl_mem objects with CL_MEM_USE_HOST_PTR
54  *
55  * Registers a user callback function that will be called when the memory object is deleted and its resources
56  * freed. Each call to clSetMemObjectCallbackFn registers the specified user callback function on a callback
57  * stack associated with memobj. The registered user callback functions are called in the reverse order in
58  * which they were registered. The user callback functions are called and then the memory object is deleted
59  * and its resources freed. This provides a mechanism for the application (and libraries) using memobj to be
60  * notified when the memory referenced by host_ptr, specified when the memory object is created and used as
61  * the storage bits for the memory object, can be reused or freed.
62  *
63  * The application may not call CL api's with the cl_mem object passed to the pfn_notify.
64  *
65  * Please check for the "cl_APPLE_SetMemObjectDestructor" extension using clGetDeviceInfo(CL_DEVICE_EXTENSIONS)
66  * before using.
67  */
68 #define cl_APPLE_SetMemObjectDestructor 1
69 cl_int  CL_API_ENTRY clSetMemObjectDestructorAPPLE(  cl_mem /* memobj */,
70                                         void (* /*pfn_notify*/)( cl_mem /* memobj */, void* /*user_data*/),
71                                         void * /*user_data */ )             CL_EXT_SUFFIX__VERSION_1_0;
72 
73 
74 /* Context Logging Functions
75  *
76  * The next three convenience functions are intended to be used as the pfn_notify parameter to clCreateContext().
77  * Please check for the "cl_APPLE_ContextLoggingFunctions" extension using clGetDeviceInfo(CL_DEVICE_EXTENSIONS)
78  * before using.
79  *
80  * clLogMessagesToSystemLog fowards on all log messages to the Apple System Logger
81  */
82 #define cl_APPLE_ContextLoggingFunctions 1
83 extern void CL_API_ENTRY clLogMessagesToSystemLogAPPLE(  const char * /* errstr */,
84                                             const void * /* private_info */,
85                                             size_t       /* cb */,
86                                             void *       /* user_data */ )  CL_EXT_SUFFIX__VERSION_1_0;
87 
88 /* clLogMessagesToStdout sends all log messages to the file descriptor stdout */
89 extern void CL_API_ENTRY clLogMessagesToStdoutAPPLE(   const char * /* errstr */,
90                                           const void * /* private_info */,
91                                           size_t       /* cb */,
92                                           void *       /* user_data */ )    CL_EXT_SUFFIX__VERSION_1_0;
93 
94 /* clLogMessagesToStderr sends all log messages to the file descriptor stderr */
95 extern void CL_API_ENTRY clLogMessagesToStderrAPPLE(   const char * /* errstr */,
96                                           const void * /* private_info */,
97                                           size_t       /* cb */,
98                                           void *       /* user_data */ )    CL_EXT_SUFFIX__VERSION_1_0;
99 
100 
101 /************************
102 * cl_khr_icd extension *
103 ************************/
104 #define cl_khr_icd 1
105 
106 /* cl_platform_info                                                        */
107 #define CL_PLATFORM_ICD_SUFFIX_KHR                  0x0920
108 
109 /* Additional Error Codes                                                  */
110 #define CL_PLATFORM_NOT_FOUND_KHR                   -1001
111 
112 extern CL_API_ENTRY cl_int CL_API_CALL
113 clIcdGetPlatformIDsKHR(cl_uint          /* num_entries */,
114                        cl_platform_id * /* platforms */,
115                        cl_uint *        /* num_platforms */);
116 
117 typedef CL_API_ENTRY cl_int (CL_API_CALL *clIcdGetPlatformIDsKHR_fn)(
118     cl_uint          /* num_entries */,
119     cl_platform_id * /* platforms */,
120     cl_uint *        /* num_platforms */);
121 
122 
123 /* Extension: cl_khr_image2D_buffer
124  *
125  * This extension allows a 2D image to be created from a cl_mem buffer without a copy.
126  * The type associated with a 2D image created from a buffer in an OpenCL program is image2d_t.
127  * Both the sampler and sampler-less read_image built-in functions are supported for 2D images
128  * and 2D images created from a buffer.  Similarly, the write_image built-ins are also supported
129  * for 2D images created from a buffer.
130  *
131  * When the 2D image from buffer is created, the client must specify the width,
132  * height, image format (i.e. channel order and channel data type) and optionally the row pitch
133  *
134  * The pitch specified must be a multiple of CL_DEVICE_IMAGE_PITCH_ALIGNMENT pixels.
135  * The base address of the buffer must be aligned to CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT pixels.
136  */
137 
138 /*************************************
139  * cl_khr_initalize_memory extension *
140  *************************************/
141 
142 #define CL_CONTEXT_MEMORY_INITIALIZE_KHR            0x2030
143 
144 
145 /**************************************
146  * cl_khr_terminate_context extension *
147  **************************************/
148 
149 #define CL_DEVICE_TERMINATE_CAPABILITY_KHR          0x2031
150 #define CL_CONTEXT_TERMINATE_KHR                    0x2032
151 
152 #define cl_khr_terminate_context 1
153 extern CL_API_ENTRY cl_int CL_API_CALL clTerminateContextKHR(cl_context /* context */) CL_EXT_SUFFIX__VERSION_1_2;
154 
155 typedef CL_API_ENTRY cl_int (CL_API_CALL *clTerminateContextKHR_fn)(cl_context /* context */) CL_EXT_SUFFIX__VERSION_1_2;
156 
157 
158 /*
159  * Extension: cl_khr_spir
160  *
161  * This extension adds support to create an OpenCL program object from a
162  * Standard Portable Intermediate Representation (SPIR) instance
163  */
164 
165 #define CL_DEVICE_SPIR_VERSIONS                     0x40E0
166 #define CL_PROGRAM_BINARY_TYPE_INTERMEDIATE         0x40E1
167 
168 
169 /******************************************
170 * cl_nv_device_attribute_query extension *
171 ******************************************/
172 /* cl_nv_device_attribute_query extension - no extension #define since it has no functions */
173 #define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV       0x4000
174 #define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV       0x4001
175 #define CL_DEVICE_REGISTERS_PER_BLOCK_NV            0x4002
176 #define CL_DEVICE_WARP_SIZE_NV                      0x4003
177 #define CL_DEVICE_GPU_OVERLAP_NV                    0x4004
178 #define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV            0x4005
179 #define CL_DEVICE_INTEGRATED_MEMORY_NV              0x4006
180 
181 /*********************************
182 * cl_amd_device_attribute_query *
183 *********************************/
184 #define CL_DEVICE_PROFILING_TIMER_OFFSET_AMD        0x4036
185 
186 /*********************************
187 * cl_arm_printf extension
188 *********************************/
189 #define CL_PRINTF_CALLBACK_ARM                      0x40B0
190 #define CL_PRINTF_BUFFERSIZE_ARM                    0x40B1
191 
192 #ifdef CL_VERSION_1_1
193    /***********************************
194     * cl_ext_device_fission extension *
195     ***********************************/
196     #define cl_ext_device_fission   1
197 
198     extern CL_API_ENTRY cl_int CL_API_CALL
199     clReleaseDeviceEXT( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
200 
201     typedef CL_API_ENTRY cl_int
202     (CL_API_CALL *clReleaseDeviceEXT_fn)( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
203 
204     extern CL_API_ENTRY cl_int CL_API_CALL
205     clRetainDeviceEXT( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
206 
207     typedef CL_API_ENTRY cl_int
208     (CL_API_CALL *clRetainDeviceEXT_fn)( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
209 
210     typedef cl_ulong  cl_device_partition_property_ext;
211     extern CL_API_ENTRY cl_int CL_API_CALL
212     clCreateSubDevicesEXT(  cl_device_id /*in_device*/,
213                             const cl_device_partition_property_ext * /* properties */,
214                             cl_uint /*num_entries*/,
215                             cl_device_id * /*out_devices*/,
216                             cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__VERSION_1_1;
217 
218     typedef CL_API_ENTRY cl_int
219     ( CL_API_CALL * clCreateSubDevicesEXT_fn)(  cl_device_id /*in_device*/,
220                                                 const cl_device_partition_property_ext * /* properties */,
221                                                 cl_uint /*num_entries*/,
222                                                 cl_device_id * /*out_devices*/,
223                                                 cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__VERSION_1_1;
224 
225     /* cl_device_partition_property_ext */
226     #define CL_DEVICE_PARTITION_EQUALLY_EXT             0x4050
227     #define CL_DEVICE_PARTITION_BY_COUNTS_EXT           0x4051
228     #define CL_DEVICE_PARTITION_BY_NAMES_EXT            0x4052
229     #define CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN_EXT  0x4053
230 
231     /* clDeviceGetInfo selectors */
232     #define CL_DEVICE_PARENT_DEVICE_EXT                 0x4054
233     #define CL_DEVICE_PARTITION_TYPES_EXT               0x4055
234     #define CL_DEVICE_AFFINITY_DOMAINS_EXT              0x4056
235     #define CL_DEVICE_REFERENCE_COUNT_EXT               0x4057
236     #define CL_DEVICE_PARTITION_STYLE_EXT               0x4058
237 
238     /* error codes */
239     #define CL_DEVICE_PARTITION_FAILED_EXT              -1057
240     #define CL_INVALID_PARTITION_COUNT_EXT              -1058
241     #define CL_INVALID_PARTITION_NAME_EXT               -1059
242 
243     /* CL_AFFINITY_DOMAINs */
244     #define CL_AFFINITY_DOMAIN_L1_CACHE_EXT             0x1
245     #define CL_AFFINITY_DOMAIN_L2_CACHE_EXT             0x2
246     #define CL_AFFINITY_DOMAIN_L3_CACHE_EXT             0x3
247     #define CL_AFFINITY_DOMAIN_L4_CACHE_EXT             0x4
248     #define CL_AFFINITY_DOMAIN_NUMA_EXT                 0x10
249     #define CL_AFFINITY_DOMAIN_NEXT_FISSIONABLE_EXT     0x100
250 
251     /* cl_device_partition_property_ext list terminators */
252     #define CL_PROPERTIES_LIST_END_EXT                  ((cl_device_partition_property_ext) 0)
253     #define CL_PARTITION_BY_COUNTS_LIST_END_EXT         ((cl_device_partition_property_ext) 0)
254     #define CL_PARTITION_BY_NAMES_LIST_END_EXT          ((cl_device_partition_property_ext) 0 - 1)
255 
256 /*********************************
257 * cl_qcom_ext_host_ptr extension
258 *********************************/
259 
260 #define CL_MEM_EXT_HOST_PTR_QCOM                  (1 << 29)
261 
262 #define CL_DEVICE_EXT_MEM_PADDING_IN_BYTES_QCOM   0x40A0
263 #define CL_DEVICE_PAGE_SIZE_QCOM                  0x40A1
264 #define CL_IMAGE_ROW_ALIGNMENT_QCOM               0x40A2
265 #define CL_IMAGE_SLICE_ALIGNMENT_QCOM             0x40A3
266 #define CL_MEM_HOST_UNCACHED_QCOM                 0x40A4
267 #define CL_MEM_HOST_WRITEBACK_QCOM                0x40A5
268 #define CL_MEM_HOST_WRITETHROUGH_QCOM             0x40A6
269 #define CL_MEM_HOST_WRITE_COMBINING_QCOM          0x40A7
270 
271 typedef cl_uint                                   cl_image_pitch_info_qcom;
272 
273 extern CL_API_ENTRY cl_int CL_API_CALL
274 clGetDeviceImageInfoQCOM(cl_device_id             device,
275                          size_t                   image_width,
276                          size_t                   image_height,
277                          const cl_image_format   *image_format,
278                          cl_image_pitch_info_qcom param_name,
279                          size_t                   param_value_size,
280                          void                    *param_value,
281                          size_t                  *param_value_size_ret);
282 
283 typedef struct _cl_mem_ext_host_ptr
284 {
285     /* Type of external memory allocation. */
286     /* Legal values will be defined in layered extensions. */
287     cl_uint  allocation_type;
288 
289     /* Host cache policy for this external memory allocation. */
290     cl_uint  host_cache_policy;
291 
292 } cl_mem_ext_host_ptr;
293 
294 /*********************************
295 * cl_qcom_ion_host_ptr extension
296 *********************************/
297 
298 #define CL_MEM_ION_HOST_PTR_QCOM                  0x40A8
299 
300 typedef struct _cl_mem_ion_host_ptr
301 {
302     /* Type of external memory allocation. */
303     /* Must be CL_MEM_ION_HOST_PTR_QCOM for ION allocations. */
304     cl_mem_ext_host_ptr  ext_host_ptr;
305 
306     /* ION file descriptor */
307     int                  ion_filedesc;
308 
309     /* Host pointer to the ION allocated memory */
310     void*                ion_hostptr;
311 
312 } cl_mem_ion_host_ptr;
313 
314 #endif /* CL_VERSION_1_1 */
315 
316 #if defined(CL_VERSION_1_2)
317 
318 /******************************************
319  * cl_img_yuv_image extension *
320  ******************************************/
321 
322 /* Image formats used in clCreateImage */
323 #define CL_NV21_IMG                                 0x40D0
324 #define CL_YV12_IMG                                 0x40D1
325 
326 /******************************************
327  * cl_img_cached_allocations extension *
328  ******************************************/
329 
330 /* Flag values used by clCreteBuffer */
331 #define CL_MEM_USE_UNCACHED_CPU_MEMORY_IMG         	(1 << 26)
332 #define CL_MEM_USE_CACHED_CPU_MEMORY_IMG           	(1 << 27)
333 
334 /******************************************
335  * cl_img_use_gralloc_ptr extension *
336  ******************************************/
337 
338 /* Flag values used by clCreteBuffer */
339 #define CL_MEM_USE_GRALLOC_PTR_IMG                 	(1 << 28)
340 
341 /* To be used by clGetEventInfo: */
342 #define CL_COMMAND_ACQUIRE_GRALLOC_OBJECTS_IMG      0x40D2
343 #define CL_COMMAND_RELEASE_GRALLOC_OBJECTS_IMG      0x40D3
344 
345 /* Error code from clEnqueueReleaseGrallocObjectsIMG */
346 #define CL_GRALLOC_RESOURCE_NOT_ACQUIRED_IMG        0x40D4
347 
348 extern CL_API_ENTRY cl_int CL_API_CALL
349 clEnqueueAcquireGrallocObjectsIMG(cl_command_queue      /* command_queue */,
350                                   cl_uint               /* num_objects */,
351                                   const cl_mem *        /* mem_objects */,
352                                   cl_uint               /* num_events_in_wait_list */,
353                                   const cl_event *      /* event_wait_list */,
354                                   cl_event *            /* event */) CL_EXT_SUFFIX__VERSION_1_2;
355 
356 extern CL_API_ENTRY cl_int CL_API_CALL
357 clEnqueueReleaseGrallocObjectsIMG(cl_command_queue      /* command_queue */,
358                                   cl_uint               /* num_objects */,
359                                   const cl_mem *        /* mem_objects */,
360                                   cl_uint               /* num_events_in_wait_list */,
361                                   const cl_event *      /* event_wait_list */,
362                                   cl_event *            /* event */) CL_EXT_SUFFIX__VERSION_1_2;
363 
364 #endif /* CL_VERSION_1_2 */
365 
366 #ifdef CL_VERSION_2_0
367 /*********************************
368 * cl_khr_subgroups extension
369 *********************************/
370 #define cl_khr_subgroups 1
371 
372 /* cl_kernel_sub_group_info is declared in CL.h. */
373 
374 /* cl_kernel_sub_group_info */
375 #define CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE_KHR	0x2033
376 #define CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE_KHR		0x2034
377 
378 extern CL_API_ENTRY cl_int CL_API_CALL
379 clGetKernelSubGroupInfoKHR(cl_kernel /* in_kernel */,
380 						   cl_device_id /*in_device*/,
381 						   cl_kernel_sub_group_info /* param_name */,
382 						   size_t /*input_value_size*/,
383 						   const void * /*input_value*/,
384 						   size_t /*param_value_size*/,
385 						   void* /*param_value*/,
386 						   size_t* /*param_value_size_ret*/ ) CL_EXT_SUFFIX__VERSION_2_0_DEPRECATED;
387 
388 typedef CL_API_ENTRY cl_int
389      ( CL_API_CALL * clGetKernelSubGroupInfoKHR_fn)(cl_kernel /* in_kernel */,
390 						      cl_device_id /*in_device*/,
391 						      cl_kernel_sub_group_info /* param_name */,
392 						      size_t /*input_value_size*/,
393 						      const void * /*input_value*/,
394 						      size_t /*param_value_size*/,
395 						      void* /*param_value*/,
396 						      size_t* /*param_value_size_ret*/ ) CL_EXT_SUFFIX__VERSION_2_0_DEPRECATED;
397 #endif /* CL_VERSION_2_0 */
398 
399 #ifdef CL_VERSION_2_1
400 /*********************************
401 * cl_khr_priority_hints extension
402 *********************************/
403 #define cl_khr_priority_hints 1
404 
405 typedef cl_uint  cl_queue_priority_khr;
406 
407 /* cl_command_queue_properties */
408 #define CL_QUEUE_PRIORITY_KHR 0x1096
409 
410 /* cl_queue_priority_khr */
411 #define CL_QUEUE_PRIORITY_HIGH_KHR (1<<0)
412 #define CL_QUEUE_PRIORITY_MED_KHR (1<<1)
413 #define CL_QUEUE_PRIORITY_LOW_KHR (1<<2)
414 
415 #endif /* CL_VERSION_2_1 */
416 
417 #ifdef CL_VERSION_2_1
418 /*********************************
419 * cl_khr_throttle_hints extension
420 *********************************/
421 #define cl_khr_throttle_hints 1
422 
423 typedef cl_uint  cl_queue_throttle_khr;
424 
425 /* cl_command_queue_properties */
426 #define CL_QUEUE_THROTTLE_KHR 0x1097
427 
428 /* cl_queue_throttle_khr */
429 #define CL_QUEUE_THROTTLE_HIGH_KHR (1<<0)
430 #define CL_QUEUE_THROTTLE_MED_KHR (1<<1)
431 #define CL_QUEUE_THROTTLE_LOW_KHR (1<<2)
432 
433 #endif /* CL_VERSION_2_1 */
434 
435 #ifdef CL_VERSION_2_2
436 /*********************************
437 * cl_khr_subgroup_named_barrier
438 *********************************/
439 #define cl_khr_subgroup_named_barrier 1
440 
441 /* cl_device_info */
442 #define CL_DEVICE_MAX_NAMED_BARRIER_COUNT_KHR       0x2035
443 
444 #endif /* CL_VERSION_2_2 */
445 
446 /**********************************
447  * cl_arm_import_memory extension *
448  **********************************/
449 
450 #ifdef CL_VERSION_1_0
451 
452 typedef intptr_t cl_import_properties_arm;
453 
454 /* Default and valid proporties name for cl_arm_import_memory */
455 #define CL_IMPORT_TYPE_ARM                        0x40B2
456 
457 /* Host process memory type default value for CL_IMPORT_TYPE_ARM property */
458 #define CL_IMPORT_TYPE_HOST_ARM                   0x40B3
459 
460 /* DMA BUF memory type value for CL_IMPORT_TYPE_ARM property */
461 #define CL_IMPORT_TYPE_DMA_BUF_ARM                0x40B4
462 
463 /* Secure DMA BUF memory type value for CL_IMPORT_TYPE_ARM property */
464 #define CL_IMPORT_TYPE_SECURE_ARM                 0x40B5
465 
466 /* This extension adds a new function that allows for direct memory import into
467  * OpenCL via the clImportMemoryARM function.
468  *
469  * Memory imported through this interface will be mapped into the device's page
470  * tables directly, providing zero copy access. It will never fall back to copy
471  * operations and aliased buffers.
472  *
473  * Types of memory supported for import are specified as additional extension
474  * strings.
475  *
476  * This extension produces cl_mem allocations which are compatible with all other
477  * users of cl_mem in the standard API.
478  *
479  * This extension maps pages with the same properties as the normal buffer creation
480  * function clCreateBuffer.
481  */
482 extern CL_API_ENTRY cl_mem CL_API_CALL
483 clImportMemoryARM( cl_context context,
484                    cl_mem_flags flags,
485                    const cl_import_properties_arm *properties,
486                    void *memory,
487                    size_t size,
488                    cl_int *errcode_ret) CL_EXT_SUFFIX__VERSION_1_0;
489 
490 
491 #endif /* CL_VERSION_1_0 */
492 
493 /******************************************
494  * cl_arm_shared_virtual_memory extension *
495  ******************************************/
496 
497 #ifdef CL_VERSION_1_2
498 
499 /* Used by clGetDeviceInfo */
500 #define CL_DEVICE_SVM_CAPABILITIES_ARM                  0x40B6
501 
502 /* Used by clGetMemObjectInfo */
503 #define CL_MEM_USES_SVM_POINTER_ARM                     0x40B7
504 
505 /* Used by clSetKernelExecInfoARM: */
506 #define CL_KERNEL_EXEC_INFO_SVM_PTRS_ARM                0x40B8
507 #define CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM_ARM   0x40B9
508 
509 /* To be used by clGetEventInfo: */
510 #define CL_COMMAND_SVM_FREE_ARM                         0x40BA
511 #define CL_COMMAND_SVM_MEMCPY_ARM                       0x40BB
512 #define CL_COMMAND_SVM_MEMFILL_ARM                      0x40BC
513 #define CL_COMMAND_SVM_MAP_ARM                          0x40BD
514 #define CL_COMMAND_SVM_UNMAP_ARM                        0x40BE
515 
516 /* Flag values returned by clGetDeviceInfo with CL_DEVICE_SVM_CAPABILITIES_ARM as the param_name. */
517 #define CL_DEVICE_SVM_COARSE_GRAIN_BUFFER_ARM           (1 << 0)
518 #define CL_DEVICE_SVM_FINE_GRAIN_BUFFER_ARM             (1 << 1)
519 #define CL_DEVICE_SVM_FINE_GRAIN_SYSTEM_ARM             (1 << 2)
520 #define CL_DEVICE_SVM_ATOMICS_ARM                       (1 << 3)
521 
522 /* Flag values used by clSVMAllocARM: */
523 #define CL_MEM_SVM_FINE_GRAIN_BUFFER_ARM                (1 << 10)
524 #define CL_MEM_SVM_ATOMICS_ARM                          (1 << 11)
525 
526 typedef cl_bitfield cl_svm_mem_flags_arm;
527 typedef cl_uint     cl_kernel_exec_info_arm;
528 typedef cl_bitfield cl_device_svm_capabilities_arm;
529 
530 extern CL_API_ENTRY void * CL_API_CALL
531 clSVMAllocARM(cl_context       /* context */,
532               cl_svm_mem_flags_arm /* flags */,
533               size_t           /* size */,
534               cl_uint          /* alignment */) CL_EXT_SUFFIX__VERSION_1_2;
535 
536 extern CL_API_ENTRY void CL_API_CALL
537 clSVMFreeARM(cl_context        /* context */,
538              void *            /* svm_pointer */) CL_EXT_SUFFIX__VERSION_1_2;
539 
540 extern CL_API_ENTRY cl_int CL_API_CALL
541 clEnqueueSVMFreeARM(cl_command_queue  /* command_queue */,
542                     cl_uint           /* num_svm_pointers */,
543                     void *[]          /* svm_pointers[] */,
544                     void (CL_CALLBACK * /*pfn_free_func*/)(cl_command_queue /* queue */,
545                                                            cl_uint          /* num_svm_pointers */,
546                                                            void *[]         /* svm_pointers[] */,
547                                                            void *           /* user_data */),
548                     void *            /* user_data */,
549                     cl_uint           /* num_events_in_wait_list */,
550                     const cl_event *  /* event_wait_list */,
551                     cl_event *        /* event */) CL_EXT_SUFFIX__VERSION_1_2;
552 
553 extern CL_API_ENTRY cl_int CL_API_CALL
554 clEnqueueSVMMemcpyARM(cl_command_queue  /* command_queue */,
555                       cl_bool           /* blocking_copy */,
556                       void *            /* dst_ptr */,
557                       const void *      /* src_ptr */,
558                       size_t            /* size */,
559                       cl_uint           /* num_events_in_wait_list */,
560                       const cl_event *  /* event_wait_list */,
561                       cl_event *        /* event */) CL_EXT_SUFFIX__VERSION_1_2;
562 
563 extern CL_API_ENTRY cl_int CL_API_CALL
564 clEnqueueSVMMemFillARM(cl_command_queue  /* command_queue */,
565                        void *            /* svm_ptr */,
566                        const void *      /* pattern */,
567                        size_t            /* pattern_size */,
568                        size_t            /* size */,
569                        cl_uint           /* num_events_in_wait_list */,
570                        const cl_event *  /* event_wait_list */,
571                        cl_event *        /* event */) CL_EXT_SUFFIX__VERSION_1_2;
572 
573 extern CL_API_ENTRY cl_int CL_API_CALL
574 clEnqueueSVMMapARM(cl_command_queue  /* command_queue */,
575                    cl_bool           /* blocking_map */,
576                    cl_map_flags      /* flags */,
577                    void *            /* svm_ptr */,
578                    size_t            /* size */,
579                    cl_uint           /* num_events_in_wait_list */,
580                    const cl_event *  /* event_wait_list */,
581                    cl_event *        /* event */) CL_EXT_SUFFIX__VERSION_1_2;
582 
583 extern CL_API_ENTRY cl_int CL_API_CALL
584 clEnqueueSVMUnmapARM(cl_command_queue  /* command_queue */,
585                      void *            /* svm_ptr */,
586                      cl_uint           /* num_events_in_wait_list */,
587                      const cl_event *  /* event_wait_list */,
588                      cl_event *        /* event */) CL_EXT_SUFFIX__VERSION_1_2;
589 
590 extern CL_API_ENTRY cl_int CL_API_CALL
591 clSetKernelArgSVMPointerARM(cl_kernel    /* kernel */,
592                             cl_uint      /* arg_index */,
593                             const void * /* arg_value */) CL_EXT_SUFFIX__VERSION_1_2;
594 extern CL_API_ENTRY cl_int CL_API_CALL
595 clSetKernelExecInfoARM(cl_kernel            /* kernel */,
596                        cl_kernel_exec_info_arm  /* param_name */,
597                        size_t               /* param_value_size */,
598                        const void *         /* param_value */) CL_EXT_SUFFIX__VERSION_1_2;
599 
600 #endif /* CL_VERSION_1_2 */
601 
602 #ifdef __cplusplus
603 }
604 #endif
605 
606 
607 #endif /* __CL_EXT_H */
608