xref: /third_party/mesa3d/include/CL/cl_ext.h (revision bf215546)
1/*******************************************************************************
2 * Copyright (c) 2008-2020 The Khronos Group Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *    http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 ******************************************************************************/
16
17/* cl_ext.h contains OpenCL extensions which don't have external */
18/* (OpenGL, D3D) dependencies.                                   */
19
20#ifndef __CL_EXT_H
21#define __CL_EXT_H
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27#include <CL/cl.h>
28
29/* cl_khr_fp64 extension - no extension #define since it has no functions  */
30/* CL_DEVICE_DOUBLE_FP_CONFIG is defined in CL.h for OpenCL >= 120 */
31
32#if CL_TARGET_OPENCL_VERSION <= 110
33#define CL_DEVICE_DOUBLE_FP_CONFIG                       0x1032
34#endif
35
36/* cl_khr_fp16 extension - no extension #define since it has no functions  */
37#define CL_DEVICE_HALF_FP_CONFIG                    0x1033
38
39/* Memory object destruction
40 *
41 * Apple extension for use to manage externally allocated buffers used with cl_mem objects with CL_MEM_USE_HOST_PTR
42 *
43 * Registers a user callback function that will be called when the memory object is deleted and its resources
44 * freed. Each call to clSetMemObjectCallbackFn registers the specified user callback function on a callback
45 * stack associated with memobj. The registered user callback functions are called in the reverse order in
46 * which they were registered. The user callback functions are called and then the memory object is deleted
47 * and its resources freed. This provides a mechanism for the application (and libraries) using memobj to be
48 * notified when the memory referenced by host_ptr, specified when the memory object is created and used as
49 * the storage bits for the memory object, can be reused or freed.
50 *
51 * The application may not call CL api's with the cl_mem object passed to the pfn_notify.
52 *
53 * Please check for the "cl_APPLE_SetMemObjectDestructor" extension using clGetDeviceInfo(CL_DEVICE_EXTENSIONS)
54 * before using.
55 */
56#define cl_APPLE_SetMemObjectDestructor 1
57cl_int  CL_API_ENTRY clSetMemObjectDestructorAPPLE(  cl_mem memobj,
58                                        void (* pfn_notify)(cl_mem memobj, void * user_data),
59                                        void * user_data)             CL_EXT_SUFFIX__VERSION_1_0;
60
61
62/* Context Logging Functions
63 *
64 * The next three convenience functions are intended to be used as the pfn_notify parameter to clCreateContext().
65 * Please check for the "cl_APPLE_ContextLoggingFunctions" extension using clGetDeviceInfo(CL_DEVICE_EXTENSIONS)
66 * before using.
67 *
68 * clLogMessagesToSystemLog forwards on all log messages to the Apple System Logger
69 */
70#define cl_APPLE_ContextLoggingFunctions 1
71extern void CL_API_ENTRY clLogMessagesToSystemLogAPPLE(  const char * errstr,
72                                            const void * private_info,
73                                            size_t       cb,
74                                            void *       user_data)  CL_EXT_SUFFIX__VERSION_1_0;
75
76/* clLogMessagesToStdout sends all log messages to the file descriptor stdout */
77extern void CL_API_ENTRY clLogMessagesToStdoutAPPLE(   const char * errstr,
78                                          const void * private_info,
79                                          size_t       cb,
80                                          void *       user_data)    CL_EXT_SUFFIX__VERSION_1_0;
81
82/* clLogMessagesToStderr sends all log messages to the file descriptor stderr */
83extern void CL_API_ENTRY clLogMessagesToStderrAPPLE(   const char * errstr,
84                                          const void * private_info,
85                                          size_t       cb,
86                                          void *       user_data)    CL_EXT_SUFFIX__VERSION_1_0;
87
88
89/************************
90* cl_khr_icd extension *
91************************/
92#define cl_khr_icd 1
93
94/* cl_platform_info                                                        */
95#define CL_PLATFORM_ICD_SUFFIX_KHR                  0x0920
96
97/* Additional Error Codes                                                  */
98#define CL_PLATFORM_NOT_FOUND_KHR                   -1001
99
100extern CL_API_ENTRY cl_int CL_API_CALL
101clIcdGetPlatformIDsKHR(cl_uint          num_entries,
102                       cl_platform_id * platforms,
103                       cl_uint *        num_platforms);
104
105typedef CL_API_ENTRY cl_int
106(CL_API_CALL *clIcdGetPlatformIDsKHR_fn)(cl_uint          num_entries,
107                                         cl_platform_id * platforms,
108                                         cl_uint *        num_platforms);
109
110
111/*******************************
112 * cl_khr_il_program extension *
113 *******************************/
114#define cl_khr_il_program 1
115
116/* New property to clGetDeviceInfo for retrieving supported intermediate
117 * languages
118 */
119#define CL_DEVICE_IL_VERSION_KHR                    0x105B
120
121/* New property to clGetProgramInfo for retrieving for retrieving the IL of a
122 * program
123 */
124#define CL_PROGRAM_IL_KHR                           0x1169
125
126extern CL_API_ENTRY cl_program CL_API_CALL
127clCreateProgramWithILKHR(cl_context   context,
128                         const void * il,
129                         size_t       length,
130                         cl_int *     errcode_ret);
131
132typedef CL_API_ENTRY cl_program
133(CL_API_CALL *clCreateProgramWithILKHR_fn)(cl_context   context,
134                                           const void * il,
135                                           size_t       length,
136                                           cl_int *     errcode_ret) CL_EXT_SUFFIX__VERSION_1_2;
137
138/* Extension: cl_khr_image2d_from_buffer
139 *
140 * This extension allows a 2D image to be created from a cl_mem buffer without
141 * a copy. The type associated with a 2D image created from a buffer in an
142 * OpenCL program is image2d_t. Both the sampler and sampler-less read_image
143 * built-in functions are supported for 2D images and 2D images created from
144 * a buffer.  Similarly, the write_image built-ins are also supported for 2D
145 * images created from a buffer.
146 *
147 * When the 2D image from buffer is created, the client must specify the
148 * width, height, image format (i.e. channel order and channel data type)
149 * and optionally the row pitch.
150 *
151 * The pitch specified must be a multiple of
152 * CL_DEVICE_IMAGE_PITCH_ALIGNMENT_KHR pixels.
153 * The base address of the buffer must be aligned to
154 * CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT_KHR pixels.
155 */
156
157#define CL_DEVICE_IMAGE_PITCH_ALIGNMENT_KHR              0x104A
158#define CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT_KHR       0x104B
159
160
161/**************************************
162 * cl_khr_initialize_memory extension *
163 **************************************/
164
165#define CL_CONTEXT_MEMORY_INITIALIZE_KHR            0x2030
166
167
168/**************************************
169 * cl_khr_terminate_context extension *
170 **************************************/
171
172#define CL_CONTEXT_TERMINATED_KHR                   -1121
173
174#define CL_DEVICE_TERMINATE_CAPABILITY_KHR          0x2031
175#define CL_CONTEXT_TERMINATE_KHR                    0x2032
176
177#define cl_khr_terminate_context 1
178extern CL_API_ENTRY cl_int CL_API_CALL
179clTerminateContextKHR(cl_context context) CL_EXT_SUFFIX__VERSION_1_2;
180
181typedef CL_API_ENTRY cl_int
182(CL_API_CALL *clTerminateContextKHR_fn)(cl_context context) CL_EXT_SUFFIX__VERSION_1_2;
183
184
185/*
186 * Extension: cl_khr_spir
187 *
188 * This extension adds support to create an OpenCL program object from a
189 * Standard Portable Intermediate Representation (SPIR) instance
190 */
191
192#define CL_DEVICE_SPIR_VERSIONS                     0x40E0
193#define CL_PROGRAM_BINARY_TYPE_INTERMEDIATE         0x40E1
194
195
196/*****************************************
197 * cl_khr_create_command_queue extension *
198 *****************************************/
199#define cl_khr_create_command_queue 1
200
201typedef cl_properties cl_queue_properties_khr;
202
203extern CL_API_ENTRY cl_command_queue CL_API_CALL
204clCreateCommandQueueWithPropertiesKHR(cl_context context,
205                                      cl_device_id device,
206                                      const cl_queue_properties_khr* properties,
207                                      cl_int* errcode_ret) CL_EXT_SUFFIX__VERSION_1_2;
208
209typedef CL_API_ENTRY cl_command_queue
210(CL_API_CALL *clCreateCommandQueueWithPropertiesKHR_fn)(cl_context context,
211                                                        cl_device_id device,
212                                                        const cl_queue_properties_khr* properties,
213                                                        cl_int* errcode_ret) CL_EXT_SUFFIX__VERSION_1_2;
214
215
216/******************************************
217* cl_nv_device_attribute_query extension *
218******************************************/
219
220/* cl_nv_device_attribute_query extension - no extension #define since it has no functions */
221#define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV       0x4000
222#define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV       0x4001
223#define CL_DEVICE_REGISTERS_PER_BLOCK_NV            0x4002
224#define CL_DEVICE_WARP_SIZE_NV                      0x4003
225#define CL_DEVICE_GPU_OVERLAP_NV                    0x4004
226#define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV            0x4005
227#define CL_DEVICE_INTEGRATED_MEMORY_NV              0x4006
228
229
230/*********************************
231* cl_amd_device_attribute_query *
232*********************************/
233
234#define CL_DEVICE_PROFILING_TIMER_OFFSET_AMD            0x4036
235#define CL_DEVICE_TOPOLOGY_AMD                          0x4037
236#define CL_DEVICE_BOARD_NAME_AMD                        0x4038
237#define CL_DEVICE_GLOBAL_FREE_MEMORY_AMD                0x4039
238#define CL_DEVICE_SIMD_PER_COMPUTE_UNIT_AMD             0x4040
239#define CL_DEVICE_SIMD_WIDTH_AMD                        0x4041
240#define CL_DEVICE_SIMD_INSTRUCTION_WIDTH_AMD            0x4042
241#define CL_DEVICE_WAVEFRONT_WIDTH_AMD                   0x4043
242#define CL_DEVICE_GLOBAL_MEM_CHANNELS_AMD               0x4044
243#define CL_DEVICE_GLOBAL_MEM_CHANNEL_BANKS_AMD          0x4045
244#define CL_DEVICE_GLOBAL_MEM_CHANNEL_BANK_WIDTH_AMD     0x4046
245#define CL_DEVICE_LOCAL_MEM_SIZE_PER_COMPUTE_UNIT_AMD   0x4047
246#define CL_DEVICE_LOCAL_MEM_BANKS_AMD                   0x4048
247#define CL_DEVICE_THREAD_TRACE_SUPPORTED_AMD            0x4049
248#define CL_DEVICE_GFXIP_MAJOR_AMD                       0x404A
249#define CL_DEVICE_GFXIP_MINOR_AMD                       0x404B
250#define CL_DEVICE_AVAILABLE_ASYNC_QUEUES_AMD            0x404C
251#define CL_DEVICE_PREFERRED_WORK_GROUP_SIZE_AMD         0x4030
252#define CL_DEVICE_MAX_WORK_GROUP_SIZE_AMD               0x4031
253#define CL_DEVICE_PREFERRED_CONSTANT_BUFFER_SIZE_AMD    0x4033
254#define CL_DEVICE_PCIE_ID_AMD                           0x4034
255
256
257/*********************************
258* cl_arm_printf extension
259*********************************/
260
261#define CL_PRINTF_CALLBACK_ARM                      0x40B0
262#define CL_PRINTF_BUFFERSIZE_ARM                    0x40B1
263
264
265/***********************************
266* cl_ext_device_fission extension
267***********************************/
268#define cl_ext_device_fission   1
269
270extern CL_API_ENTRY cl_int CL_API_CALL
271clReleaseDeviceEXT(cl_device_id device) CL_EXT_SUFFIX__VERSION_1_1;
272
273typedef CL_API_ENTRY cl_int
274(CL_API_CALL *clReleaseDeviceEXT_fn)(cl_device_id device) CL_EXT_SUFFIX__VERSION_1_1;
275
276extern CL_API_ENTRY cl_int CL_API_CALL
277clRetainDeviceEXT(cl_device_id device) CL_EXT_SUFFIX__VERSION_1_1;
278
279typedef CL_API_ENTRY cl_int
280(CL_API_CALL *clRetainDeviceEXT_fn)(cl_device_id device) CL_EXT_SUFFIX__VERSION_1_1;
281
282typedef cl_ulong  cl_device_partition_property_ext;
283extern CL_API_ENTRY cl_int CL_API_CALL
284clCreateSubDevicesEXT(cl_device_id   in_device,
285                      const cl_device_partition_property_ext * properties,
286                      cl_uint        num_entries,
287                      cl_device_id * out_devices,
288                      cl_uint *      num_devices) CL_EXT_SUFFIX__VERSION_1_1;
289
290typedef CL_API_ENTRY cl_int
291(CL_API_CALL * clCreateSubDevicesEXT_fn)(cl_device_id   in_device,
292                                         const cl_device_partition_property_ext * properties,
293                                         cl_uint        num_entries,
294                                         cl_device_id * out_devices,
295                                         cl_uint *      num_devices) CL_EXT_SUFFIX__VERSION_1_1;
296
297/* cl_device_partition_property_ext */
298#define CL_DEVICE_PARTITION_EQUALLY_EXT             0x4050
299#define CL_DEVICE_PARTITION_BY_COUNTS_EXT           0x4051
300#define CL_DEVICE_PARTITION_BY_NAMES_EXT            0x4052
301#define CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN_EXT  0x4053
302
303/* clDeviceGetInfo selectors */
304#define CL_DEVICE_PARENT_DEVICE_EXT                 0x4054
305#define CL_DEVICE_PARTITION_TYPES_EXT               0x4055
306#define CL_DEVICE_AFFINITY_DOMAINS_EXT              0x4056
307#define CL_DEVICE_REFERENCE_COUNT_EXT               0x4057
308#define CL_DEVICE_PARTITION_STYLE_EXT               0x4058
309
310/* error codes */
311#define CL_DEVICE_PARTITION_FAILED_EXT              -1057
312#define CL_INVALID_PARTITION_COUNT_EXT              -1058
313#define CL_INVALID_PARTITION_NAME_EXT               -1059
314
315/* CL_AFFINITY_DOMAINs */
316#define CL_AFFINITY_DOMAIN_L1_CACHE_EXT             0x1
317#define CL_AFFINITY_DOMAIN_L2_CACHE_EXT             0x2
318#define CL_AFFINITY_DOMAIN_L3_CACHE_EXT             0x3
319#define CL_AFFINITY_DOMAIN_L4_CACHE_EXT             0x4
320#define CL_AFFINITY_DOMAIN_NUMA_EXT                 0x10
321#define CL_AFFINITY_DOMAIN_NEXT_FISSIONABLE_EXT     0x100
322
323/* cl_device_partition_property_ext list terminators */
324#define CL_PROPERTIES_LIST_END_EXT                  ((cl_device_partition_property_ext) 0)
325#define CL_PARTITION_BY_COUNTS_LIST_END_EXT         ((cl_device_partition_property_ext) 0)
326#define CL_PARTITION_BY_NAMES_LIST_END_EXT          ((cl_device_partition_property_ext) 0 - 1)
327
328
329/***********************************
330 * cl_ext_migrate_memobject extension definitions
331 ***********************************/
332#define cl_ext_migrate_memobject 1
333
334typedef cl_bitfield cl_mem_migration_flags_ext;
335
336#define CL_MIGRATE_MEM_OBJECT_HOST_EXT              0x1
337
338#define CL_COMMAND_MIGRATE_MEM_OBJECT_EXT           0x4040
339
340extern CL_API_ENTRY cl_int CL_API_CALL
341clEnqueueMigrateMemObjectEXT(cl_command_queue command_queue,
342                             cl_uint          num_mem_objects,
343                             const cl_mem *   mem_objects,
344                             cl_mem_migration_flags_ext flags,
345                             cl_uint          num_events_in_wait_list,
346                             const cl_event * event_wait_list,
347                             cl_event *       event);
348
349typedef CL_API_ENTRY cl_int
350(CL_API_CALL *clEnqueueMigrateMemObjectEXT_fn)(cl_command_queue command_queue,
351                                               cl_uint          num_mem_objects,
352                                               const cl_mem *   mem_objects,
353                                               cl_mem_migration_flags_ext flags,
354                                               cl_uint          num_events_in_wait_list,
355                                               const cl_event * event_wait_list,
356                                               cl_event *       event);
357
358
359/*********************************
360* cl_ext_cxx_for_opencl extension
361*********************************/
362#define cl_ext_cxx_for_opencl 1
363
364#define CL_DEVICE_CXX_FOR_OPENCL_NUMERIC_VERSION_EXT 0x4230
365
366/*********************************
367* cl_qcom_ext_host_ptr extension
368*********************************/
369#define cl_qcom_ext_host_ptr 1
370
371#define CL_MEM_EXT_HOST_PTR_QCOM                  (1 << 29)
372
373#define CL_DEVICE_EXT_MEM_PADDING_IN_BYTES_QCOM   0x40A0
374#define CL_DEVICE_PAGE_SIZE_QCOM                  0x40A1
375#define CL_IMAGE_ROW_ALIGNMENT_QCOM               0x40A2
376#define CL_IMAGE_SLICE_ALIGNMENT_QCOM             0x40A3
377#define CL_MEM_HOST_UNCACHED_QCOM                 0x40A4
378#define CL_MEM_HOST_WRITEBACK_QCOM                0x40A5
379#define CL_MEM_HOST_WRITETHROUGH_QCOM             0x40A6
380#define CL_MEM_HOST_WRITE_COMBINING_QCOM          0x40A7
381
382typedef cl_uint                                   cl_image_pitch_info_qcom;
383
384extern CL_API_ENTRY cl_int CL_API_CALL
385clGetDeviceImageInfoQCOM(cl_device_id             device,
386                         size_t                   image_width,
387                         size_t                   image_height,
388                         const cl_image_format   *image_format,
389                         cl_image_pitch_info_qcom param_name,
390                         size_t                   param_value_size,
391                         void                    *param_value,
392                         size_t                  *param_value_size_ret);
393
394typedef struct _cl_mem_ext_host_ptr
395{
396    /* Type of external memory allocation. */
397    /* Legal values will be defined in layered extensions. */
398    cl_uint  allocation_type;
399
400    /* Host cache policy for this external memory allocation. */
401    cl_uint  host_cache_policy;
402
403} cl_mem_ext_host_ptr;
404
405
406/*******************************************
407* cl_qcom_ext_host_ptr_iocoherent extension
408********************************************/
409
410/* Cache policy specifying io-coherence */
411#define CL_MEM_HOST_IOCOHERENT_QCOM               0x40A9
412
413
414/*********************************
415* cl_qcom_ion_host_ptr extension
416*********************************/
417
418#define CL_MEM_ION_HOST_PTR_QCOM                  0x40A8
419
420typedef struct _cl_mem_ion_host_ptr
421{
422    /* Type of external memory allocation. */
423    /* Must be CL_MEM_ION_HOST_PTR_QCOM for ION allocations. */
424    cl_mem_ext_host_ptr  ext_host_ptr;
425
426    /* ION file descriptor */
427    int                  ion_filedesc;
428
429    /* Host pointer to the ION allocated memory */
430    void*                ion_hostptr;
431
432} cl_mem_ion_host_ptr;
433
434
435/*********************************
436* cl_qcom_android_native_buffer_host_ptr extension
437*********************************/
438
439#define CL_MEM_ANDROID_NATIVE_BUFFER_HOST_PTR_QCOM                  0x40C6
440
441typedef struct _cl_mem_android_native_buffer_host_ptr
442{
443    /* Type of external memory allocation. */
444    /* Must be CL_MEM_ANDROID_NATIVE_BUFFER_HOST_PTR_QCOM for Android native buffers. */
445    cl_mem_ext_host_ptr  ext_host_ptr;
446
447    /* Virtual pointer to the android native buffer */
448    void*                anb_ptr;
449
450} cl_mem_android_native_buffer_host_ptr;
451
452
453/******************************************
454 * cl_img_yuv_image extension *
455 ******************************************/
456
457/* Image formats used in clCreateImage */
458#define CL_NV21_IMG                                 0x40D0
459#define CL_YV12_IMG                                 0x40D1
460
461
462/******************************************
463 * cl_img_cached_allocations extension *
464 ******************************************/
465
466/* Flag values used by clCreateBuffer */
467#define CL_MEM_USE_UNCACHED_CPU_MEMORY_IMG          (1 << 26)
468#define CL_MEM_USE_CACHED_CPU_MEMORY_IMG            (1 << 27)
469
470
471/******************************************
472 * cl_img_use_gralloc_ptr extension *
473 ******************************************/
474#define cl_img_use_gralloc_ptr 1
475
476/* Flag values used by clCreateBuffer */
477#define CL_MEM_USE_GRALLOC_PTR_IMG                  (1 << 28)
478
479/* To be used by clGetEventInfo: */
480#define CL_COMMAND_ACQUIRE_GRALLOC_OBJECTS_IMG      0x40D2
481#define CL_COMMAND_RELEASE_GRALLOC_OBJECTS_IMG      0x40D3
482
483/* Error code from clEnqueueReleaseGrallocObjectsIMG */
484#define CL_GRALLOC_RESOURCE_NOT_ACQUIRED_IMG        0x40D4
485
486extern CL_API_ENTRY cl_int CL_API_CALL
487clEnqueueAcquireGrallocObjectsIMG(cl_command_queue      command_queue,
488                                  cl_uint               num_objects,
489                                  const cl_mem *        mem_objects,
490                                  cl_uint               num_events_in_wait_list,
491                                  const cl_event *      event_wait_list,
492                                  cl_event *            event) CL_EXT_SUFFIX__VERSION_1_2;
493
494extern CL_API_ENTRY cl_int CL_API_CALL
495clEnqueueReleaseGrallocObjectsIMG(cl_command_queue      command_queue,
496                                  cl_uint               num_objects,
497                                  const cl_mem *        mem_objects,
498                                  cl_uint               num_events_in_wait_list,
499                                  const cl_event *      event_wait_list,
500                                  cl_event *            event) CL_EXT_SUFFIX__VERSION_1_2;
501
502
503/*********************************
504* cl_khr_subgroups extension
505*********************************/
506#define cl_khr_subgroups 1
507
508#if !defined(CL_VERSION_2_1)
509/* For OpenCL 2.1 and newer, cl_kernel_sub_group_info is declared in CL.h.
510   In hindsight, there should have been a khr suffix on this type for
511   the extension, but keeping it un-suffixed to maintain backwards
512   compatibility. */
513typedef cl_uint             cl_kernel_sub_group_info;
514#endif
515
516/* cl_kernel_sub_group_info */
517#define CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE_KHR    0x2033
518#define CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE_KHR       0x2034
519
520extern CL_API_ENTRY cl_int CL_API_CALL
521clGetKernelSubGroupInfoKHR(cl_kernel    in_kernel,
522                           cl_device_id in_device,
523                           cl_kernel_sub_group_info param_name,
524                           size_t       input_value_size,
525                           const void * input_value,
526                           size_t       param_value_size,
527                           void *       param_value,
528                           size_t *     param_value_size_ret) CL_EXT_SUFFIX__VERSION_2_0_DEPRECATED;
529
530typedef CL_API_ENTRY cl_int
531(CL_API_CALL * clGetKernelSubGroupInfoKHR_fn)(cl_kernel    in_kernel,
532                                              cl_device_id in_device,
533                                              cl_kernel_sub_group_info param_name,
534                                              size_t       input_value_size,
535                                              const void * input_value,
536                                              size_t       param_value_size,
537                                              void *       param_value,
538                                              size_t *     param_value_size_ret) CL_EXT_SUFFIX__VERSION_2_0_DEPRECATED;
539
540
541/*********************************
542* cl_khr_mipmap_image extension
543*********************************/
544
545/* cl_sampler_properties */
546#define CL_SAMPLER_MIP_FILTER_MODE_KHR              0x1155
547#define CL_SAMPLER_LOD_MIN_KHR                      0x1156
548#define CL_SAMPLER_LOD_MAX_KHR                      0x1157
549
550
551/*********************************
552* cl_khr_priority_hints extension
553*********************************/
554/* This extension define is for backwards compatibility.
555   It shouldn't be required since this extension has no new functions. */
556#define cl_khr_priority_hints 1
557
558typedef cl_uint  cl_queue_priority_khr;
559
560/* cl_command_queue_properties */
561#define CL_QUEUE_PRIORITY_KHR 0x1096
562
563/* cl_queue_priority_khr */
564#define CL_QUEUE_PRIORITY_HIGH_KHR (1<<0)
565#define CL_QUEUE_PRIORITY_MED_KHR (1<<1)
566#define CL_QUEUE_PRIORITY_LOW_KHR (1<<2)
567
568
569/*********************************
570* cl_khr_throttle_hints extension
571*********************************/
572/* This extension define is for backwards compatibility.
573   It shouldn't be required since this extension has no new functions. */
574#define cl_khr_throttle_hints 1
575
576typedef cl_uint  cl_queue_throttle_khr;
577
578/* cl_command_queue_properties */
579#define CL_QUEUE_THROTTLE_KHR 0x1097
580
581/* cl_queue_throttle_khr */
582#define CL_QUEUE_THROTTLE_HIGH_KHR (1<<0)
583#define CL_QUEUE_THROTTLE_MED_KHR (1<<1)
584#define CL_QUEUE_THROTTLE_LOW_KHR (1<<2)
585
586
587/*********************************
588* cl_khr_subgroup_named_barrier
589*********************************/
590/* This extension define is for backwards compatibility.
591   It shouldn't be required since this extension has no new functions. */
592#define cl_khr_subgroup_named_barrier 1
593
594/* cl_device_info */
595#define CL_DEVICE_MAX_NAMED_BARRIER_COUNT_KHR       0x2035
596
597
598/*********************************
599* cl_khr_extended_versioning
600*********************************/
601
602#define cl_khr_extended_versioning 1
603
604#define CL_VERSION_MAJOR_BITS_KHR (10)
605#define CL_VERSION_MINOR_BITS_KHR (10)
606#define CL_VERSION_PATCH_BITS_KHR (12)
607
608#define CL_VERSION_MAJOR_MASK_KHR ((1 << CL_VERSION_MAJOR_BITS_KHR) - 1)
609#define CL_VERSION_MINOR_MASK_KHR ((1 << CL_VERSION_MINOR_BITS_KHR) - 1)
610#define CL_VERSION_PATCH_MASK_KHR ((1 << CL_VERSION_PATCH_BITS_KHR) - 1)
611
612#define CL_VERSION_MAJOR_KHR(version) ((version) >> (CL_VERSION_MINOR_BITS_KHR + CL_VERSION_PATCH_BITS_KHR))
613#define CL_VERSION_MINOR_KHR(version) (((version) >> CL_VERSION_PATCH_BITS_KHR) & CL_VERSION_MINOR_MASK_KHR)
614#define CL_VERSION_PATCH_KHR(version) ((version) & CL_VERSION_PATCH_MASK_KHR)
615
616#define CL_MAKE_VERSION_KHR(major, minor, patch) \
617    ((((major) & CL_VERSION_MAJOR_MASK_KHR) << (CL_VERSION_MINOR_BITS_KHR + CL_VERSION_PATCH_BITS_KHR)) | \
618    (((minor) &  CL_VERSION_MINOR_MASK_KHR) << CL_VERSION_PATCH_BITS_KHR) | \
619    ((patch) & CL_VERSION_PATCH_MASK_KHR))
620
621typedef cl_uint cl_version_khr;
622
623#define CL_NAME_VERSION_MAX_NAME_SIZE_KHR 64
624
625typedef struct _cl_name_version_khr
626{
627    cl_version_khr version;
628    char name[CL_NAME_VERSION_MAX_NAME_SIZE_KHR];
629} cl_name_version_khr;
630
631/* cl_platform_info */
632#define CL_PLATFORM_NUMERIC_VERSION_KHR                  0x0906
633#define CL_PLATFORM_EXTENSIONS_WITH_VERSION_KHR          0x0907
634
635/* cl_device_info */
636#define CL_DEVICE_NUMERIC_VERSION_KHR                    0x105E
637#define CL_DEVICE_OPENCL_C_NUMERIC_VERSION_KHR           0x105F
638#define CL_DEVICE_EXTENSIONS_WITH_VERSION_KHR            0x1060
639#define CL_DEVICE_ILS_WITH_VERSION_KHR                   0x1061
640#define CL_DEVICE_BUILT_IN_KERNELS_WITH_VERSION_KHR      0x1062
641
642
643/*********************************
644* cl_khr_device_uuid extension
645*********************************/
646#define cl_khr_device_uuid 1
647
648#define CL_UUID_SIZE_KHR 16
649#define CL_LUID_SIZE_KHR 8
650
651#define CL_DEVICE_UUID_KHR          0x106A
652#define CL_DRIVER_UUID_KHR          0x106B
653#define CL_DEVICE_LUID_VALID_KHR    0x106C
654#define CL_DEVICE_LUID_KHR          0x106D
655#define CL_DEVICE_NODE_MASK_KHR     0x106E
656
657
658/**********************************
659 * cl_arm_import_memory extension *
660 **********************************/
661#define cl_arm_import_memory 1
662
663typedef intptr_t cl_import_properties_arm;
664
665/* Default and valid proporties name for cl_arm_import_memory */
666#define CL_IMPORT_TYPE_ARM                        0x40B2
667
668/* Host process memory type default value for CL_IMPORT_TYPE_ARM property */
669#define CL_IMPORT_TYPE_HOST_ARM                   0x40B3
670
671/* DMA BUF memory type value for CL_IMPORT_TYPE_ARM property */
672#define CL_IMPORT_TYPE_DMA_BUF_ARM                0x40B4
673
674/* Protected memory property */
675#define CL_IMPORT_TYPE_PROTECTED_ARM              0x40B5
676
677/* Android hardware buffer type value for CL_IMPORT_TYPE_ARM property */
678#define CL_IMPORT_TYPE_ANDROID_HARDWARE_BUFFER_ARM 0x41E2
679
680/* Data consistency with host property */
681#define CL_IMPORT_DMA_BUF_DATA_CONSISTENCY_WITH_HOST_ARM 0x41E3
682
683/* Import memory size value to indicate a size for the whole buffer */
684#define CL_IMPORT_MEMORY_WHOLE_ALLOCATION_ARM SIZE_MAX
685
686/* This extension adds a new function that allows for direct memory import into
687 * OpenCL via the clImportMemoryARM function.
688 *
689 * Memory imported through this interface will be mapped into the device's page
690 * tables directly, providing zero copy access. It will never fall back to copy
691 * operations and aliased buffers.
692 *
693 * Types of memory supported for import are specified as additional extension
694 * strings.
695 *
696 * This extension produces cl_mem allocations which are compatible with all other
697 * users of cl_mem in the standard API.
698 *
699 * This extension maps pages with the same properties as the normal buffer creation
700 * function clCreateBuffer.
701 */
702extern CL_API_ENTRY cl_mem CL_API_CALL
703clImportMemoryARM( cl_context context,
704                   cl_mem_flags flags,
705                   const cl_import_properties_arm *properties,
706                   void *memory,
707                   size_t size,
708                   cl_int *errcode_ret) CL_EXT_SUFFIX__VERSION_1_0;
709
710
711/******************************************
712 * cl_arm_shared_virtual_memory extension *
713 ******************************************/
714#define cl_arm_shared_virtual_memory 1
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
743typedef cl_bitfield cl_svm_mem_flags_arm;
744typedef cl_uint     cl_kernel_exec_info_arm;
745typedef cl_bitfield cl_device_svm_capabilities_arm;
746
747extern CL_API_ENTRY void * CL_API_CALL
748clSVMAllocARM(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
753extern CL_API_ENTRY void CL_API_CALL
754clSVMFreeARM(cl_context        context,
755             void *            svm_pointer) CL_EXT_SUFFIX__VERSION_1_2;
756
757extern CL_API_ENTRY cl_int CL_API_CALL
758clEnqueueSVMFreeARM(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
770extern CL_API_ENTRY cl_int CL_API_CALL
771clEnqueueSVMMemcpyARM(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
780extern CL_API_ENTRY cl_int CL_API_CALL
781clEnqueueSVMMemFillARM(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
790extern CL_API_ENTRY cl_int CL_API_CALL
791clEnqueueSVMMapARM(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
800extern CL_API_ENTRY cl_int CL_API_CALL
801clEnqueueSVMUnmapARM(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
807extern CL_API_ENTRY cl_int CL_API_CALL
808clSetKernelArgSVMPointerARM(cl_kernel    kernel,
809                            cl_uint      arg_index,
810                            const void * arg_value) CL_EXT_SUFFIX__VERSION_1_2;
811
812extern CL_API_ENTRY cl_int CL_API_CALL
813clSetKernelExecInfoARM(cl_kernel            kernel,
814                       cl_kernel_exec_info_arm  param_name,
815                       size_t               param_value_size,
816                       const void *         param_value) CL_EXT_SUFFIX__VERSION_1_2;
817
818/********************************
819 * cl_arm_get_core_id extension *
820 ********************************/
821
822#ifdef CL_VERSION_1_2
823
824#define cl_arm_get_core_id 1
825
826/* Device info property for bitfield of cores present */
827#define CL_DEVICE_COMPUTE_UNITS_BITFIELD_ARM      0x40BF
828
829#endif  /* CL_VERSION_1_2 */
830
831/*********************************
832* cl_arm_job_slot_selection
833*********************************/
834
835#define cl_arm_job_slot_selection 1
836
837/* cl_device_info */
838#define CL_DEVICE_JOB_SLOTS_ARM                   0x41E0
839
840/* cl_command_queue_properties */
841#define CL_QUEUE_JOB_SLOT_ARM                     0x41E1
842
843/*********************************
844* cl_arm_scheduling_controls
845*********************************/
846
847#define cl_arm_scheduling_controls 1
848
849/* cl_device_info */
850#define CL_DEVICE_SCHEDULING_CONTROLS_CAPABILITIES_ARM          0x41E4
851
852#define CL_DEVICE_SCHEDULING_KERNEL_BATCHING_ARM               (1 << 0)
853#define CL_DEVICE_SCHEDULING_WORKGROUP_BATCH_SIZE_ARM          (1 << 1)
854#define CL_DEVICE_SCHEDULING_WORKGROUP_BATCH_SIZE_MODIFIER_ARM (1 << 2)
855
856/* cl_kernel_info */
857#define CL_KERNEL_EXEC_INFO_WORKGROUP_BATCH_SIZE_ARM            0x41E5
858#define CL_KERNEL_EXEC_INFO_WORKGROUP_BATCH_SIZE_MODIFIER_ARM   0x41E6
859
860/* cl_queue_properties */
861#define CL_QUEUE_KERNEL_BATCHING_ARM                            0x41E7
862
863#ifdef __cplusplus
864}
865#endif
866
867
868#endif /* __CL_EXT_H */
869