• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_memory_flags *
183 *********************************/
184 #define cl_amd_device_memory_flags 1
185 #define CL_MEM_USE_PERSISTENT_MEM_AMD       (1 << 6)        // Alloc from GPU's CPU visible heap
186 
187 /* cl_device_info */
188 #define CL_DEVICE_MAX_ATOMIC_COUNTERS_EXT           0x4032
189 
190 /*********************************
191 * cl_amd_device_attribute_query *
192 *********************************/
193 #define CL_DEVICE_PROFILING_TIMER_OFFSET_AMD        0x4036
194 #define CL_DEVICE_TOPOLOGY_AMD                      0x4037
195 #define CL_DEVICE_BOARD_NAME_AMD                    0x4038
196 #define CL_DEVICE_GLOBAL_FREE_MEMORY_AMD            0x4039
197 #define CL_DEVICE_SIMD_PER_COMPUTE_UNIT_AMD         0x4040
198 #define CL_DEVICE_SIMD_WIDTH_AMD                    0x4041
199 #define CL_DEVICE_SIMD_INSTRUCTION_WIDTH_AMD        0x4042
200 #define CL_DEVICE_WAVEFRONT_WIDTH_AMD               0x4043
201 #define CL_DEVICE_GLOBAL_MEM_CHANNELS_AMD           0x4044
202 #define CL_DEVICE_GLOBAL_MEM_CHANNEL_BANKS_AMD      0x4045
203 #define CL_DEVICE_GLOBAL_MEM_CHANNEL_BANK_WIDTH_AMD 0x4046
204 #define CL_DEVICE_LOCAL_MEM_SIZE_PER_COMPUTE_UNIT_AMD   0x4047
205 #define CL_DEVICE_LOCAL_MEM_BANKS_AMD               0x4048
206 #define CL_DEVICE_THREAD_TRACE_SUPPORTED_AMD        0x4049
207 #define CL_DEVICE_GFXIP_MAJOR_AMD                   0x404A
208 #define CL_DEVICE_GFXIP_MINOR_AMD                   0x404B
209 #define CL_DEVICE_AVAILABLE_ASYNC_QUEUES_AMD        0x404C
210 #define CL_DEVICE_PREFERRED_WORK_GROUP_SIZE_AMD     0x4030
211 #define CL_DEVICE_MAX_WORK_GROUP_SIZE_AMD           0x4031
212 #define CL_DEVICE_PREFERRED_CONSTANT_BUFFER_SIZE_AMD    0x4033
213 
214 typedef union
215 {
216     struct { cl_uint type; cl_uint data[5]; } raw;
217     struct { cl_uint type; cl_uchar unused[17]; cl_uchar bus; cl_uchar device; cl_uchar function; } pcie;
218 } cl_device_topology_amd;
219 
220 #define CL_DEVICE_TOPOLOGY_TYPE_PCIE_AMD            1
221 
222 /**************************
223 * cl_amd_offline_devices *
224 **************************/
225 #define CL_CONTEXT_OFFLINE_DEVICES_AMD              0x403F
226 
227 /********************************
228 * cl_amd_bus_addressable_memory *
229 ********************************/
230 
231 /* cl_mem flag - bitfield */
232 #define CL_MEM_BUS_ADDRESSABLE_AMD               (1<<30)
233 #define CL_MEM_EXTERNAL_PHYSICAL_AMD             (1<<31)
234 
235 #define CL_COMMAND_WAIT_SIGNAL_AMD                0x4080
236 #define CL_COMMAND_WRITE_SIGNAL_AMD               0x4081
237 #define CL_COMMAND_MAKE_BUFFERS_RESIDENT_AMD      0x4082
238 
239 typedef struct _cl_bus_address_amd
240 {
241     cl_ulong surface_bus_address;
242     cl_ulong marker_bus_address;
243 } cl_bus_address_amd;
244 
245 typedef CL_API_ENTRY cl_int
246 (CL_API_CALL * clEnqueueWaitSignalAMD_fn)( cl_command_queue /*command_queue*/,
247                                            cl_mem /*mem_object*/,
248                                            cl_uint /*value*/,
249                                            cl_uint /*num_events*/,
250                                            const cl_event * /*event_wait_list*/,
251                                            cl_event * /*event*/) CL_EXT_SUFFIX__VERSION_1_2;
252 
253 typedef CL_API_ENTRY cl_int
254 (CL_API_CALL * clEnqueueWriteSignalAMD_fn)( cl_command_queue /*command_queue*/,
255                                             cl_mem /*mem_object*/,
256                                             cl_uint /*value*/,
257                                             cl_ulong /*offset*/,
258                                             cl_uint /*num_events*/,
259                                             const cl_event * /*event_list*/,
260                                             cl_event * /*event*/) CL_EXT_SUFFIX__VERSION_1_2;
261 
262 typedef CL_API_ENTRY cl_int
263 (CL_API_CALL * clEnqueueMakeBuffersResidentAMD_fn)( cl_command_queue /*command_queue*/,
264                                                     cl_uint /*num_mem_objs*/,
265                                                     cl_mem * /*mem_objects*/,
266                                                     cl_bool /*blocking_make_resident*/,
267                                                     cl_bus_address_amd * /*bus_addresses*/,
268                                                     cl_uint /*num_events*/,
269                                                     const cl_event * /*event_list*/,
270                                                     cl_event * /*event*/) CL_EXT_SUFFIX__VERSION_1_2;
271 
272 /**********************
273 * cl_amd_liquid_flash *
274 ***********************/
275 #define cl_amd_liquid_flash 1
276 
277 #define CL_COMMAND_READ_SSG_FILE_AMD 0x4083
278 #define CL_COMMAND_WRITE_SSG_FILE_AMD  0x4087
279 
280 #define CL_INVALID_FILE_OBJECT_AMD 0x4084
281 
282 typedef struct _cl_file_amd * cl_file_amd;
283 
284 typedef cl_uint cl_file_flags_amd;
285 #define CL_FILE_READ_ONLY_AMD   (1 << 0)
286 #define CL_FILE_WRITE_ONLY_AMD  (1 << 1)
287 #define CL_FILE_READ_WRITE_AMD  (1 << 2)
288 
289 typedef cl_uint cl_file_info_amd;
290 #define CL_FILE_BLOCK_SIZE_AMD 0x4085
291 #define CL_FILE_SIZE_AMD       0x4086
292 
293 typedef CL_API_ENTRY cl_file_amd
294 (CL_API_CALL * clCreateSsgFileObjectAMD_fn)(cl_context /*context*/,
295                                             cl_file_flags_amd /*flags*/,
296                                             const wchar_t * /*file_name*/,
297                                             cl_int * /*errcode_ret*/) CL_EXT_SUFFIX__VERSION_1_2;
298 
299 typedef CL_API_ENTRY cl_int
300 (CL_API_CALL * clGetSsgFileObjectInfoAMD_fn)(cl_file_amd /* file */,
301                                             cl_file_info_amd /* param_name */,
302                                             size_t /* param_value_size */,
303                                             void * /* param_value */,
304                                             size_t * /* param_value_size_ret */) CL_EXT_SUFFIX__VERSION_1_2;
305 
306 typedef CL_API_ENTRY cl_int
307 (CL_API_CALL * clRetainSsgFileObjectAMD_fn)( cl_file_amd /*file*/) CL_EXT_SUFFIX__VERSION_1_2;
308 
309 typedef CL_API_ENTRY cl_int
310 (CL_API_CALL * clReleaseSsgFileObjectAMD_fn)( cl_file_amd /*file*/) CL_EXT_SUFFIX__VERSION_1_2;
311 
312 typedef CL_API_ENTRY cl_int
313 (CL_API_CALL * clEnqueueReadSsgFileAMD_fn)(cl_command_queue /*command_queue*/,
314                                            cl_mem /*buffer*/,
315                                            cl_bool /*blocking_write*/,
316                                            size_t /*buffer_offset*/,
317                                            size_t /*cb*/,
318                                            cl_file_amd /*file*/,
319                                            size_t /*file_offset*/,
320                                            cl_uint /*num_events_in_wait_list*/,
321                                            const cl_event * /*event_wait_list*/,
322                                            cl_event * /*event*/) CL_EXT_SUFFIX__VERSION_1_2;
323 
324 typedef CL_API_ENTRY cl_int
325 (CL_API_CALL * clEnqueueWriteSsgFileAMD_fn)(cl_command_queue /*command_queue*/,
326                                             cl_mem /*buffer*/,
327                                             cl_bool /*blocking_read*/,
328                                             size_t /*buffer_offset*/,
329                                             size_t /*cb*/,
330                                             cl_file_amd /*file*/,
331                                             size_t /*file_offset*/,
332                                             cl_uint /*num_events_in_wait_list*/,
333                                             const cl_event * /*event_wait_list*/,
334                                             cl_event * /*event*/) CL_EXT_SUFFIX__VERSION_1_2;
335 
336 /*************************
337 * cl_amd_copy_buffer_p2p *
338 **************************/
339 #define CL_DEVICE_NUM_P2P_DEVICES_AMD 0x4088
340 #define CL_DEVICE_P2P_DEVICES_AMD 0x4089
341 
342 #define cl_amd_copy_buffer_p2p 1
343 
344 typedef CL_API_ENTRY cl_int
345 (CL_API_CALL * clEnqueueCopyBufferP2PAMD_fn)(cl_command_queue /*command_queue*/,
346                                              cl_mem /*src_buffer*/,
347                                              cl_mem /*dst_buffer*/,
348                                              size_t /*src_offset*/,
349                                              size_t /*dst_offset*/,
350                                              size_t /*cb*/,
351                                              cl_uint /*num_events_in_wait_list*/,
352                                              const cl_event* /*event_wait_list*/,
353                                              cl_event* /*event*/) CL_EXT_SUFFIX__VERSION_1_2;
354 
355 // <amd_internal>
356 /***************************
357 * cl_amd_command_intercept *
358 ***************************/
359 #define CL_CONTEXT_COMMAND_INTERCEPT_CALLBACK_AMD   0x403D
360 #define CL_QUEUE_COMMAND_INTERCEPT_ENABLE_AMD       (1ull << 63)
361 
362 typedef cl_int (CL_CALLBACK * intercept_callback_fn)(cl_event, cl_int *);
363 
364 /**************************
365 * cl_amd_command_queue_info *
366 **************************/
367 #define CL_QUEUE_THREAD_HANDLE_AMD                  0x403E
368 
369 /*   cl_kernel_exec_info for DVR DOPP texture support   */
370 #define CL_KERNEL_EXEC_INFO_NEW_VCOP_AMD            0x4120
371 #define CL_KERNEL_EXEC_INFO_PFPA_VCOP_AMD           0x4121
372 
373 /*************************
374 * cl_amd_object_metadata *
375 **************************/
376 #define cl_amd_object_metadata 1
377 
378 typedef size_t cl_key_amd;
379 
380 #define CL_INVALID_OBJECT_AMD    0x403A
381 #define CL_INVALID_KEY_AMD       0x403B
382 #define CL_PLATFORM_MAX_KEYS_AMD 0x403C
383 
384 typedef CL_API_ENTRY cl_key_amd (CL_API_CALL * clCreateKeyAMD_fn)(
385     cl_platform_id      /* platform */,
386     void (CL_CALLBACK * /* destructor */)( void* /* old_value */),
387     cl_int *            /* errcode_ret */) CL_API_SUFFIX__VERSION_1_1;
388 
389 typedef CL_API_ENTRY cl_int (CL_API_CALL * clObjectGetValueForKeyAMD_fn)(
390     void *               /* object */,
391     cl_key_amd           /* key */,
392     void **              /* ret_val */) CL_API_SUFFIX__VERSION_1_1;
393 
394 typedef CL_API_ENTRY cl_int (CL_API_CALL * clObjectSetValueForKeyAMD_fn)(
395     void *               /* object */,
396     cl_key_amd           /* key */,
397     void *               /* value */) CL_API_SUFFIX__VERSION_1_1;
398 // </amd_internal>
399 
400 /*********************************
401 * cl_arm_printf extension
402 *********************************/
403 #define CL_PRINTF_CALLBACK_ARM                      0x40B0
404 #define CL_PRINTF_BUFFERSIZE_ARM                    0x40B1
405 
406 #ifdef CL_VERSION_1_1
407    /***********************************
408     * cl_ext_device_fission extension *
409     ***********************************/
410     #define cl_ext_device_fission   1
411 
412     extern CL_API_ENTRY cl_int CL_API_CALL
413     clReleaseDeviceEXT( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
414 
415     typedef CL_API_ENTRY cl_int
416     (CL_API_CALL *clReleaseDeviceEXT_fn)( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
417 
418     extern CL_API_ENTRY cl_int CL_API_CALL
419     clRetainDeviceEXT( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
420 
421     typedef CL_API_ENTRY cl_int
422     (CL_API_CALL *clRetainDeviceEXT_fn)( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
423 
424     typedef cl_ulong  cl_device_partition_property_ext;
425     extern CL_API_ENTRY cl_int CL_API_CALL
426     clCreateSubDevicesEXT(  cl_device_id /*in_device*/,
427                             const cl_device_partition_property_ext * /* properties */,
428                             cl_uint /*num_entries*/,
429                             cl_device_id * /*out_devices*/,
430                             cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__VERSION_1_1;
431 
432     typedef CL_API_ENTRY cl_int
433     ( CL_API_CALL * clCreateSubDevicesEXT_fn)(  cl_device_id /*in_device*/,
434                                                 const cl_device_partition_property_ext * /* properties */,
435                                                 cl_uint /*num_entries*/,
436                                                 cl_device_id * /*out_devices*/,
437                                                 cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__VERSION_1_1;
438 
439     /* cl_device_partition_property_ext */
440     #define CL_DEVICE_PARTITION_EQUALLY_EXT             0x4050
441     #define CL_DEVICE_PARTITION_BY_COUNTS_EXT           0x4051
442     #define CL_DEVICE_PARTITION_BY_NAMES_EXT            0x4052
443     #define CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN_EXT  0x4053
444 
445     /* clDeviceGetInfo selectors */
446     #define CL_DEVICE_PARENT_DEVICE_EXT                 0x4054
447     #define CL_DEVICE_PARTITION_TYPES_EXT               0x4055
448     #define CL_DEVICE_AFFINITY_DOMAINS_EXT              0x4056
449     #define CL_DEVICE_REFERENCE_COUNT_EXT               0x4057
450     #define CL_DEVICE_PARTITION_STYLE_EXT               0x4058
451 
452     /* clGetImageInfo enum */
453     #define CL_IMAGE_BYTE_PITCH_AMD                     0x4059
454 
455     /* error codes */
456     #define CL_DEVICE_PARTITION_FAILED_EXT              -1057
457     #define CL_INVALID_PARTITION_COUNT_EXT              -1058
458     #define CL_INVALID_PARTITION_NAME_EXT               -1059
459 
460     /* CL_AFFINITY_DOMAINs */
461     #define CL_AFFINITY_DOMAIN_L1_CACHE_EXT             0x1
462     #define CL_AFFINITY_DOMAIN_L2_CACHE_EXT             0x2
463     #define CL_AFFINITY_DOMAIN_L3_CACHE_EXT             0x3
464     #define CL_AFFINITY_DOMAIN_L4_CACHE_EXT             0x4
465     #define CL_AFFINITY_DOMAIN_NUMA_EXT                 0x10
466     #define CL_AFFINITY_DOMAIN_NEXT_FISSIONABLE_EXT     0x100
467 
468     /* cl_device_partition_property_ext list terminators */
469     #define CL_PROPERTIES_LIST_END_EXT                  ((cl_device_partition_property_ext) 0)
470     #define CL_PARTITION_BY_COUNTS_LIST_END_EXT         ((cl_device_partition_property_ext) 0)
471     #define CL_PARTITION_BY_NAMES_LIST_END_EXT          ((cl_device_partition_property_ext) 0 - 1)
472 
473 /*********************************
474 * cl_qcom_ext_host_ptr extension
475 *********************************/
476 
477 #define CL_MEM_EXT_HOST_PTR_QCOM                  (1 << 29)
478 
479 #define CL_DEVICE_EXT_MEM_PADDING_IN_BYTES_QCOM   0x40A0
480 #define CL_DEVICE_PAGE_SIZE_QCOM                  0x40A1
481 #define CL_IMAGE_ROW_ALIGNMENT_QCOM               0x40A2
482 #define CL_IMAGE_SLICE_ALIGNMENT_QCOM             0x40A3
483 #define CL_MEM_HOST_UNCACHED_QCOM                 0x40A4
484 #define CL_MEM_HOST_WRITEBACK_QCOM                0x40A5
485 #define CL_MEM_HOST_WRITETHROUGH_QCOM             0x40A6
486 #define CL_MEM_HOST_WRITE_COMBINING_QCOM          0x40A7
487 
488 typedef cl_uint                                   cl_image_pitch_info_qcom;
489 
490 extern CL_API_ENTRY cl_int CL_API_CALL
491 clGetDeviceImageInfoQCOM(cl_device_id             device,
492                          size_t                   image_width,
493                          size_t                   image_height,
494                          const cl_image_format   *image_format,
495                          cl_image_pitch_info_qcom param_name,
496                          size_t                   param_value_size,
497                          void                    *param_value,
498                          size_t                  *param_value_size_ret);
499 
500 typedef struct _cl_mem_ext_host_ptr
501 {
502     /* Type of external memory allocation. */
503     /* Legal values will be defined in layered extensions. */
504     cl_uint  allocation_type;
505 
506     /* Host cache policy for this external memory allocation. */
507     cl_uint  host_cache_policy;
508 
509 } cl_mem_ext_host_ptr;
510 
511 /*********************************
512 * cl_qcom_ion_host_ptr extension
513 *********************************/
514 
515 #define CL_MEM_ION_HOST_PTR_QCOM                  0x40A8
516 
517 typedef struct _cl_mem_ion_host_ptr
518 {
519     /* Type of external memory allocation. */
520     /* Must be CL_MEM_ION_HOST_PTR_QCOM for ION allocations. */
521     cl_mem_ext_host_ptr  ext_host_ptr;
522 
523     /* ION file descriptor */
524     int                  ion_filedesc;
525 
526     /* Host pointer to the ION allocated memory */
527     void*                ion_hostptr;
528 
529 } cl_mem_ion_host_ptr;
530 
531 #endif /* CL_VERSION_1_1 */
532 
533 #if defined(CL_VERSION_1_2)
534 
535 /******************************************
536  * cl_img_yuv_image extension *
537  ******************************************/
538 
539 /* Image formats used in clCreateImage */
540 #define CL_NV21_IMG                                 0x40D0
541 #define CL_YV12_IMG                                 0x40D1
542 
543 /******************************************
544  * cl_img_cached_allocations extension *
545  ******************************************/
546 
547 /* Flag values used by clCreteBuffer */
548 #define CL_MEM_USE_UNCACHED_CPU_MEMORY_IMG         	(1 << 26)
549 #define CL_MEM_USE_CACHED_CPU_MEMORY_IMG           	(1 << 27)
550 
551 /******************************************
552  * cl_img_use_gralloc_ptr extension *
553  ******************************************/
554 
555 /* Flag values used by clCreteBuffer */
556 #define CL_MEM_USE_GRALLOC_PTR_IMG                 	(1 << 28)
557 
558 /* To be used by clGetEventInfo: */
559 #define CL_COMMAND_ACQUIRE_GRALLOC_OBJECTS_IMG      0x40D2
560 #define CL_COMMAND_RELEASE_GRALLOC_OBJECTS_IMG      0x40D3
561 
562 /* Error code from clEnqueueReleaseGrallocObjectsIMG */
563 #define CL_GRALLOC_RESOURCE_NOT_ACQUIRED_IMG        0x40D4
564 
565 extern CL_API_ENTRY cl_int CL_API_CALL
566 clEnqueueAcquireGrallocObjectsIMG(cl_command_queue      /* command_queue */,
567                                   cl_uint               /* num_objects */,
568                                   const cl_mem *        /* mem_objects */,
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 clEnqueueReleaseGrallocObjectsIMG(cl_command_queue      /* command_queue */,
575                                   cl_uint               /* num_objects */,
576                                   const cl_mem *        /* mem_objects */,
577                                   cl_uint               /* num_events_in_wait_list */,
578                                   const cl_event *      /* event_wait_list */,
579                                   cl_event *            /* event */) CL_EXT_SUFFIX__VERSION_1_2;
580 
581 #endif /* CL_VERSION_1_2 */
582 
583 #ifdef CL_VERSION_2_0
584 /*********************************
585 * cl_khr_subgroups extension
586 *********************************/
587 #define cl_khr_subgroups 1
588 
589 /* cl_kernel_sub_group_info is declared in CL.h. */
590 
591 /* cl_kernel_sub_group_info */
592 #define CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE_KHR	0x2033
593 #define CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE_KHR		0x2034
594 
595 extern CL_API_ENTRY cl_int CL_API_CALL
596 clGetKernelSubGroupInfoKHR(cl_kernel /* in_kernel */,
597 						   cl_device_id /*in_device*/,
598 						   cl_kernel_sub_group_info /* param_name */,
599 						   size_t /*input_value_size*/,
600 						   const void * /*input_value*/,
601 						   size_t /*param_value_size*/,
602 						   void* /*param_value*/,
603 						   size_t* /*param_value_size_ret*/ ) CL_EXT_SUFFIX__VERSION_2_0_DEPRECATED;
604 
605 typedef CL_API_ENTRY cl_int
606      ( CL_API_CALL * clGetKernelSubGroupInfoKHR_fn)(cl_kernel /* in_kernel */,
607 						      cl_device_id /*in_device*/,
608 						      cl_kernel_sub_group_info /* param_name */,
609 						      size_t /*input_value_size*/,
610 						      const void * /*input_value*/,
611 						      size_t /*param_value_size*/,
612 						      void* /*param_value*/,
613 						      size_t* /*param_value_size_ret*/ ) CL_EXT_SUFFIX__VERSION_2_0_DEPRECATED;
614 #endif /* CL_VERSION_2_0 */
615 
616 #ifdef CL_VERSION_2_1
617 /*********************************
618 * cl_khr_priority_hints extension
619 *********************************/
620 #define cl_khr_priority_hints 1
621 
622 typedef cl_uint  cl_queue_priority_khr;
623 
624 /* cl_command_queue_properties */
625 #define CL_QUEUE_PRIORITY_KHR 0x1096
626 
627 /* cl_queue_priority_khr */
628 #define CL_QUEUE_PRIORITY_HIGH_KHR (1<<0)
629 #define CL_QUEUE_PRIORITY_MED_KHR (1<<1)
630 #define CL_QUEUE_PRIORITY_LOW_KHR (1<<2)
631 
632 #endif /* CL_VERSION_2_1 */
633 
634 #ifdef CL_VERSION_2_1
635 /*********************************
636 * cl_khr_throttle_hints extension
637 *********************************/
638 #define cl_khr_throttle_hints 1
639 
640 typedef cl_uint  cl_queue_throttle_khr;
641 
642 /* cl_command_queue_properties */
643 #define CL_QUEUE_THROTTLE_KHR 0x1097
644 
645 /* cl_queue_throttle_khr */
646 #define CL_QUEUE_THROTTLE_HIGH_KHR (1<<0)
647 #define CL_QUEUE_THROTTLE_MED_KHR (1<<1)
648 #define CL_QUEUE_THROTTLE_LOW_KHR (1<<2)
649 
650 #endif /* CL_VERSION_2_1 */
651 
652 #ifdef CL_VERSION_2_2
653 /*********************************
654 * cl_khr_subgroup_named_barrier
655 *********************************/
656 #define cl_khr_subgroup_named_barrier 1
657 
658 /* cl_device_info */
659 #define CL_DEVICE_MAX_NAMED_BARRIER_COUNT_KHR       0x2035
660 
661 #endif /* CL_VERSION_2_2 */
662 
663 /**********************************
664  * cl_arm_import_memory extension *
665  **********************************/
666 
667 #ifdef CL_VERSION_1_0
668 
669 typedef intptr_t cl_import_properties_arm;
670 
671 /* Default and valid proporties name for cl_arm_import_memory */
672 #define CL_IMPORT_TYPE_ARM                        0x40B2
673 
674 /* Host process memory type default value for CL_IMPORT_TYPE_ARM property */
675 #define CL_IMPORT_TYPE_HOST_ARM                   0x40B3
676 
677 /* DMA BUF memory type value for CL_IMPORT_TYPE_ARM property */
678 #define CL_IMPORT_TYPE_DMA_BUF_ARM                0x40B4
679 
680 /* Secure DMA BUF memory type value for CL_IMPORT_TYPE_ARM property */
681 #define CL_IMPORT_TYPE_SECURE_ARM                 0x40B5
682 
683 /* This extension adds a new function that allows for direct memory import into
684  * OpenCL via the clImportMemoryARM function.
685  *
686  * Memory imported through this interface will be mapped into the device's page
687  * tables directly, providing zero copy access. It will never fall back to copy
688  * operations and aliased buffers.
689  *
690  * Types of memory supported for import are specified as additional extension
691  * strings.
692  *
693  * This extension produces cl_mem allocations which are compatible with all other
694  * users of cl_mem in the standard API.
695  *
696  * This extension maps pages with the same properties as the normal buffer creation
697  * function clCreateBuffer.
698  */
699 extern CL_API_ENTRY cl_mem CL_API_CALL
700 clImportMemoryARM( cl_context context,
701                    cl_mem_flags flags,
702                    const cl_import_properties_arm *properties,
703                    void *memory,
704                    size_t size,
705                    cl_int *errcode_ret) CL_EXT_SUFFIX__VERSION_1_0;
706 
707 
708 #endif /* CL_VERSION_1_0 */
709 
710 /******************************************
711  * cl_arm_shared_virtual_memory extension *
712  ******************************************/
713 
714 #ifdef CL_VERSION_1_2
715 
716 /* Used by clGetDeviceInfo */
717 #define CL_DEVICE_SVM_CAPABILITIES_ARM                  0x40B6
718 
719 /* Used by clGetMemObjectInfo */
720 #define CL_MEM_USES_SVM_POINTER_ARM                     0x40B7
721 
722 /* Used by clSetKernelExecInfoARM: */
723 #define CL_KERNEL_EXEC_INFO_SVM_PTRS_ARM                0x40B8
724 #define CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM_ARM   0x40B9
725 
726 /* To be used by clGetEventInfo: */
727 #define CL_COMMAND_SVM_FREE_ARM                         0x40BA
728 #define CL_COMMAND_SVM_MEMCPY_ARM                       0x40BB
729 #define CL_COMMAND_SVM_MEMFILL_ARM                      0x40BC
730 #define CL_COMMAND_SVM_MAP_ARM                          0x40BD
731 #define CL_COMMAND_SVM_UNMAP_ARM                        0x40BE
732 
733 /* Flag values returned by clGetDeviceInfo with CL_DEVICE_SVM_CAPABILITIES_ARM as the param_name. */
734 #define CL_DEVICE_SVM_COARSE_GRAIN_BUFFER_ARM           (1 << 0)
735 #define CL_DEVICE_SVM_FINE_GRAIN_BUFFER_ARM             (1 << 1)
736 #define CL_DEVICE_SVM_FINE_GRAIN_SYSTEM_ARM             (1 << 2)
737 #define CL_DEVICE_SVM_ATOMICS_ARM                       (1 << 3)
738 
739 /* Flag values used by clSVMAllocARM: */
740 #define CL_MEM_SVM_FINE_GRAIN_BUFFER_ARM                (1 << 10)
741 #define CL_MEM_SVM_ATOMICS_ARM                          (1 << 11)
742 
743 typedef cl_bitfield cl_svm_mem_flags_arm;
744 typedef cl_uint     cl_kernel_exec_info_arm;
745 typedef cl_bitfield cl_device_svm_capabilities_arm;
746 
747 extern CL_API_ENTRY void * CL_API_CALL
748 clSVMAllocARM(cl_context       /* context */,
749               cl_svm_mem_flags_arm /* flags */,
750               size_t           /* size */,
751               cl_uint          /* alignment */) CL_EXT_SUFFIX__VERSION_1_2;
752 
753 extern CL_API_ENTRY void CL_API_CALL
754 clSVMFreeARM(cl_context        /* context */,
755              void *            /* svm_pointer */) CL_EXT_SUFFIX__VERSION_1_2;
756 
757 extern CL_API_ENTRY cl_int CL_API_CALL
758 clEnqueueSVMFreeARM(cl_command_queue  /* command_queue */,
759                     cl_uint           /* num_svm_pointers */,
760                     void *[]          /* svm_pointers[] */,
761                     void (CL_CALLBACK * /*pfn_free_func*/)(cl_command_queue /* queue */,
762                                                            cl_uint          /* num_svm_pointers */,
763                                                            void *[]         /* svm_pointers[] */,
764                                                            void *           /* user_data */),
765                     void *            /* user_data */,
766                     cl_uint           /* num_events_in_wait_list */,
767                     const cl_event *  /* event_wait_list */,
768                     cl_event *        /* event */) CL_EXT_SUFFIX__VERSION_1_2;
769 
770 extern CL_API_ENTRY cl_int CL_API_CALL
771 clEnqueueSVMMemcpyARM(cl_command_queue  /* command_queue */,
772                       cl_bool           /* blocking_copy */,
773                       void *            /* dst_ptr */,
774                       const void *      /* src_ptr */,
775                       size_t            /* size */,
776                       cl_uint           /* num_events_in_wait_list */,
777                       const cl_event *  /* event_wait_list */,
778                       cl_event *        /* event */) CL_EXT_SUFFIX__VERSION_1_2;
779 
780 extern CL_API_ENTRY cl_int CL_API_CALL
781 clEnqueueSVMMemFillARM(cl_command_queue  /* command_queue */,
782                        void *            /* svm_ptr */,
783                        const void *      /* pattern */,
784                        size_t            /* pattern_size */,
785                        size_t            /* size */,
786                        cl_uint           /* num_events_in_wait_list */,
787                        const cl_event *  /* event_wait_list */,
788                        cl_event *        /* event */) CL_EXT_SUFFIX__VERSION_1_2;
789 
790 extern CL_API_ENTRY cl_int CL_API_CALL
791 clEnqueueSVMMapARM(cl_command_queue  /* command_queue */,
792                    cl_bool           /* blocking_map */,
793                    cl_map_flags      /* flags */,
794                    void *            /* svm_ptr */,
795                    size_t            /* size */,
796                    cl_uint           /* num_events_in_wait_list */,
797                    const cl_event *  /* event_wait_list */,
798                    cl_event *        /* event */) CL_EXT_SUFFIX__VERSION_1_2;
799 
800 extern CL_API_ENTRY cl_int CL_API_CALL
801 clEnqueueSVMUnmapARM(cl_command_queue  /* command_queue */,
802                      void *            /* svm_ptr */,
803                      cl_uint           /* num_events_in_wait_list */,
804                      const cl_event *  /* event_wait_list */,
805                      cl_event *        /* event */) CL_EXT_SUFFIX__VERSION_1_2;
806 
807 extern CL_API_ENTRY cl_int CL_API_CALL
808 clSetKernelArgSVMPointerARM(cl_kernel    /* kernel */,
809                             cl_uint      /* arg_index */,
810                             const void * /* arg_value */) CL_EXT_SUFFIX__VERSION_1_2;
811 extern CL_API_ENTRY cl_int CL_API_CALL
812 clSetKernelExecInfoARM(cl_kernel            /* kernel */,
813                        cl_kernel_exec_info_arm  /* param_name */,
814                        size_t               /* param_value_size */,
815                        const void *         /* param_value */) CL_EXT_SUFFIX__VERSION_1_2;
816 
817 #endif /* CL_VERSION_1_2 */
818 
819 #ifdef __cplusplus
820 }
821 #endif
822 
823 
824 #endif /* __CL_EXT_H */
825