cl_ext.h revision 53c12917
1af69d88dSmrg/*******************************************************************************
253c12917Smaya * Copyright (c) 2008-2019 The Khronos Group Inc.
3af69d88dSmrg *
4af69d88dSmrg * Permission is hereby granted, free of charge, to any person obtaining a
5af69d88dSmrg * copy of this software and/or associated documentation files (the
6af69d88dSmrg * "Materials"), to deal in the Materials without restriction, including
7af69d88dSmrg * without limitation the rights to use, copy, modify, merge, publish,
8af69d88dSmrg * distribute, sublicense, and/or sell copies of the Materials, and to
9af69d88dSmrg * permit persons to whom the Materials are furnished to do so, subject to
10af69d88dSmrg * the following conditions:
11af69d88dSmrg *
12af69d88dSmrg * The above copyright notice and this permission notice shall be included
13af69d88dSmrg * in all copies or substantial portions of the Materials.
14af69d88dSmrg *
1553c12917Smaya * MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
1653c12917Smaya * KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
1753c12917Smaya * SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
1853c12917Smaya *    https://www.khronos.org/registry/
1953c12917Smaya *
20af69d88dSmrg * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21af69d88dSmrg * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22af69d88dSmrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23af69d88dSmrg * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24af69d88dSmrg * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25af69d88dSmrg * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26af69d88dSmrg * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
27af69d88dSmrg ******************************************************************************/
28af69d88dSmrg
29af69d88dSmrg/* cl_ext.h contains OpenCL extensions which don't have external */
30af69d88dSmrg/* (OpenGL, D3D) dependencies.                                   */
31af69d88dSmrg
32af69d88dSmrg#ifndef __CL_EXT_H
33af69d88dSmrg#define __CL_EXT_H
34af69d88dSmrg
35af69d88dSmrg#ifdef __cplusplus
36af69d88dSmrgextern "C" {
37af69d88dSmrg#endif
38af69d88dSmrg
3953c12917Smaya#include <CL/cl.h>
4053c12917Smaya
4153c12917Smaya/* cl_khr_fp64 extension - no extension #define since it has no functions  */
4253c12917Smaya/* CL_DEVICE_DOUBLE_FP_CONFIG is defined in CL.h for OpenCL >= 120 */
4353c12917Smaya
4453c12917Smaya#if CL_TARGET_OPENCL_VERSION <= 110
4553c12917Smaya#define CL_DEVICE_DOUBLE_FP_CONFIG                       0x1032
46af69d88dSmrg#endif
47af69d88dSmrg
48af69d88dSmrg/* cl_khr_fp16 extension - no extension #define since it has no functions  */
49af69d88dSmrg#define CL_DEVICE_HALF_FP_CONFIG                    0x1033
50af69d88dSmrg
51af69d88dSmrg/* Memory object destruction
52af69d88dSmrg *
53af69d88dSmrg * Apple extension for use to manage externally allocated buffers used with cl_mem objects with CL_MEM_USE_HOST_PTR
54af69d88dSmrg *
5553c12917Smaya * Registers a user callback function that will be called when the memory object is deleted and its resources
5653c12917Smaya * freed. Each call to clSetMemObjectCallbackFn registers the specified user callback function on a callback
5753c12917Smaya * stack associated with memobj. The registered user callback functions are called in the reverse order in
5853c12917Smaya * which they were registered. The user callback functions are called and then the memory object is deleted
5953c12917Smaya * and its resources freed. This provides a mechanism for the application (and libraries) using memobj to be
6053c12917Smaya * notified when the memory referenced by host_ptr, specified when the memory object is created and used as
61af69d88dSmrg * the storage bits for the memory object, can be reused or freed.
62af69d88dSmrg *
63af69d88dSmrg * The application may not call CL api's with the cl_mem object passed to the pfn_notify.
64af69d88dSmrg *
65af69d88dSmrg * Please check for the "cl_APPLE_SetMemObjectDestructor" extension using clGetDeviceInfo(CL_DEVICE_EXTENSIONS)
66af69d88dSmrg * before using.
67af69d88dSmrg */
68af69d88dSmrg#define cl_APPLE_SetMemObjectDestructor 1
6953c12917Smayacl_int  CL_API_ENTRY clSetMemObjectDestructorAPPLE(  cl_mem memobj,
7053c12917Smaya                                        void (* pfn_notify)(cl_mem memobj, void * user_data),
7153c12917Smaya                                        void * user_data)             CL_EXT_SUFFIX__VERSION_1_0;
72af69d88dSmrg
73af69d88dSmrg
74af69d88dSmrg/* Context Logging Functions
75af69d88dSmrg *
76af69d88dSmrg * The next three convenience functions are intended to be used as the pfn_notify parameter to clCreateContext().
77af69d88dSmrg * Please check for the "cl_APPLE_ContextLoggingFunctions" extension using clGetDeviceInfo(CL_DEVICE_EXTENSIONS)
78af69d88dSmrg * before using.
79af69d88dSmrg *
8053c12917Smaya * clLogMessagesToSystemLog forwards on all log messages to the Apple System Logger
81af69d88dSmrg */
82af69d88dSmrg#define cl_APPLE_ContextLoggingFunctions 1
8353c12917Smayaextern void CL_API_ENTRY clLogMessagesToSystemLogAPPLE(  const char * errstr,
8453c12917Smaya                                            const void * private_info,
8553c12917Smaya                                            size_t       cb,
8653c12917Smaya                                            void *       user_data)  CL_EXT_SUFFIX__VERSION_1_0;
87af69d88dSmrg
88af69d88dSmrg/* clLogMessagesToStdout sends all log messages to the file descriptor stdout */
8953c12917Smayaextern void CL_API_ENTRY clLogMessagesToStdoutAPPLE(   const char * errstr,
9053c12917Smaya                                          const void * private_info,
9153c12917Smaya                                          size_t       cb,
9253c12917Smaya                                          void *       user_data)    CL_EXT_SUFFIX__VERSION_1_0;
93af69d88dSmrg
94af69d88dSmrg/* clLogMessagesToStderr sends all log messages to the file descriptor stderr */
9553c12917Smayaextern void CL_API_ENTRY clLogMessagesToStderrAPPLE(   const char * errstr,
9653c12917Smaya                                          const void * private_info,
9753c12917Smaya                                          size_t       cb,
9853c12917Smaya                                          void *       user_data)    CL_EXT_SUFFIX__VERSION_1_0;
99af69d88dSmrg
100af69d88dSmrg
10153c12917Smaya/************************
10253c12917Smaya* cl_khr_icd extension *
103af69d88dSmrg************************/
104af69d88dSmrg#define cl_khr_icd 1
105af69d88dSmrg
106af69d88dSmrg/* cl_platform_info                                                        */
107af69d88dSmrg#define CL_PLATFORM_ICD_SUFFIX_KHR                  0x0920
108af69d88dSmrg
109af69d88dSmrg/* Additional Error Codes                                                  */
110af69d88dSmrg#define CL_PLATFORM_NOT_FOUND_KHR                   -1001
111af69d88dSmrg
112af69d88dSmrgextern CL_API_ENTRY cl_int CL_API_CALL
11353c12917SmayaclIcdGetPlatformIDsKHR(cl_uint          num_entries,
11453c12917Smaya                       cl_platform_id * platforms,
11553c12917Smaya                       cl_uint *        num_platforms);
11653c12917Smaya
11753c12917Smayatypedef CL_API_ENTRY cl_int
11853c12917Smaya(CL_API_CALL *clIcdGetPlatformIDsKHR_fn)(cl_uint          num_entries,
11953c12917Smaya                                         cl_platform_id * platforms,
12053c12917Smaya                                         cl_uint *        num_platforms);
12153c12917Smaya
12253c12917Smaya
12353c12917Smaya/*******************************
12453c12917Smaya * cl_khr_il_program extension *
12553c12917Smaya *******************************/
12653c12917Smaya#define cl_khr_il_program 1
12753c12917Smaya
12853c12917Smaya/* New property to clGetDeviceInfo for retrieving supported intermediate
12953c12917Smaya * languages
13053c12917Smaya */
13153c12917Smaya#define CL_DEVICE_IL_VERSION_KHR                    0x105B
132af69d88dSmrg
13353c12917Smaya/* New property to clGetProgramInfo for retrieving for retrieving the IL of a
13453c12917Smaya * program
13553c12917Smaya */
13653c12917Smaya#define CL_PROGRAM_IL_KHR                           0x1169
13753c12917Smaya
13853c12917Smayaextern CL_API_ENTRY cl_program CL_API_CALL
13953c12917SmayaclCreateProgramWithILKHR(cl_context   context,
14053c12917Smaya                         const void * il,
14153c12917Smaya                         size_t       length,
14253c12917Smaya                         cl_int *     errcode_ret);
143af69d88dSmrg
14453c12917Smayatypedef CL_API_ENTRY cl_program
14553c12917Smaya(CL_API_CALL *clCreateProgramWithILKHR_fn)(cl_context   context,
14653c12917Smaya                                           const void * il,
14753c12917Smaya                                           size_t       length,
14853c12917Smaya                                           cl_int *     errcode_ret) CL_EXT_SUFFIX__VERSION_1_2;
149af69d88dSmrg
150af69d88dSmrg/* Extension: cl_khr_image2D_buffer
151af69d88dSmrg *
152af69d88dSmrg * This extension allows a 2D image to be created from a cl_mem buffer without a copy.
153af69d88dSmrg * The type associated with a 2D image created from a buffer in an OpenCL program is image2d_t.
154af69d88dSmrg * Both the sampler and sampler-less read_image built-in functions are supported for 2D images
155af69d88dSmrg * and 2D images created from a buffer.  Similarly, the write_image built-ins are also supported
156af69d88dSmrg * for 2D images created from a buffer.
157af69d88dSmrg *
158af69d88dSmrg * When the 2D image from buffer is created, the client must specify the width,
159af69d88dSmrg * height, image format (i.e. channel order and channel data type) and optionally the row pitch
160af69d88dSmrg *
161af69d88dSmrg * The pitch specified must be a multiple of CL_DEVICE_IMAGE_PITCH_ALIGNMENT pixels.
162af69d88dSmrg * The base address of the buffer must be aligned to CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT pixels.
163af69d88dSmrg */
16453c12917Smaya
16553c12917Smaya/**************************************
16653c12917Smaya * cl_khr_initialize_memory extension *
16753c12917Smaya **************************************/
16853c12917Smaya
16953c12917Smaya#define CL_CONTEXT_MEMORY_INITIALIZE_KHR            0x2030
17053c12917Smaya
17153c12917Smaya
172af69d88dSmrg/**************************************
173af69d88dSmrg * cl_khr_terminate_context extension *
174af69d88dSmrg **************************************/
17553c12917Smaya
17653c12917Smaya#define CL_DEVICE_TERMINATE_CAPABILITY_KHR          0x2031
17753c12917Smaya#define CL_CONTEXT_TERMINATE_KHR                    0x2032
178af69d88dSmrg
179af69d88dSmrg#define cl_khr_terminate_context 1
18053c12917Smayaextern CL_API_ENTRY cl_int CL_API_CALL
18153c12917SmayaclTerminateContextKHR(cl_context context) CL_EXT_SUFFIX__VERSION_1_2;
18253c12917Smaya
18353c12917Smayatypedef CL_API_ENTRY cl_int
18453c12917Smaya(CL_API_CALL *clTerminateContextKHR_fn)(cl_context context) CL_EXT_SUFFIX__VERSION_1_2;
18553c12917Smaya
186af69d88dSmrg
187af69d88dSmrg/*
188af69d88dSmrg * Extension: cl_khr_spir
189af69d88dSmrg *
19053c12917Smaya * This extension adds support to create an OpenCL program object from a
191af69d88dSmrg * Standard Portable Intermediate Representation (SPIR) instance
192af69d88dSmrg */
193af69d88dSmrg
194af69d88dSmrg#define CL_DEVICE_SPIR_VERSIONS                     0x40E0
195af69d88dSmrg#define CL_PROGRAM_BINARY_TYPE_INTERMEDIATE         0x40E1
196af69d88dSmrg
197af69d88dSmrg
19853c12917Smaya/*****************************************
19953c12917Smaya * cl_khr_create_command_queue extension *
20053c12917Smaya *****************************************/
20153c12917Smaya#define cl_khr_create_command_queue 1
20253c12917Smaya
20353c12917Smayatypedef cl_bitfield cl_queue_properties_khr;
20453c12917Smaya
20553c12917Smayaextern CL_API_ENTRY cl_command_queue CL_API_CALL
20653c12917SmayaclCreateCommandQueueWithPropertiesKHR(cl_context context,
20753c12917Smaya                                      cl_device_id device,
20853c12917Smaya                                      const cl_queue_properties_khr* properties,
20953c12917Smaya                                      cl_int* errcode_ret) CL_EXT_SUFFIX__VERSION_1_2;
21053c12917Smaya
21153c12917Smayatypedef CL_API_ENTRY cl_command_queue
21253c12917Smaya(CL_API_CALL *clCreateCommandQueueWithPropertiesKHR_fn)(cl_context context,
21353c12917Smaya                                                        cl_device_id device,
21453c12917Smaya                                                        const cl_queue_properties_khr* properties,
21553c12917Smaya                                                        cl_int* errcode_ret) CL_EXT_SUFFIX__VERSION_1_2;
21653c12917Smaya
21753c12917Smaya
218af69d88dSmrg/******************************************
219af69d88dSmrg* cl_nv_device_attribute_query extension *
220af69d88dSmrg******************************************/
22153c12917Smaya
222af69d88dSmrg/* cl_nv_device_attribute_query extension - no extension #define since it has no functions */
223af69d88dSmrg#define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV       0x4000
224af69d88dSmrg#define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV       0x4001
225af69d88dSmrg#define CL_DEVICE_REGISTERS_PER_BLOCK_NV            0x4002
226af69d88dSmrg#define CL_DEVICE_WARP_SIZE_NV                      0x4003
227af69d88dSmrg#define CL_DEVICE_GPU_OVERLAP_NV                    0x4004
228af69d88dSmrg#define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV            0x4005
229af69d88dSmrg#define CL_DEVICE_INTEGRATED_MEMORY_NV              0x4006
230af69d88dSmrg
23153c12917Smaya
232af69d88dSmrg/*********************************
233af69d88dSmrg* cl_amd_device_attribute_query *
234af69d88dSmrg*********************************/
23553c12917Smaya
236af69d88dSmrg#define CL_DEVICE_PROFILING_TIMER_OFFSET_AMD        0x4036
237af69d88dSmrg
23853c12917Smaya
239af69d88dSmrg/*********************************
240af69d88dSmrg* cl_arm_printf extension
241af69d88dSmrg*********************************/
24253c12917Smaya
243af69d88dSmrg#define CL_PRINTF_CALLBACK_ARM                      0x40B0
244af69d88dSmrg#define CL_PRINTF_BUFFERSIZE_ARM                    0x40B1
245af69d88dSmrg
24653c12917Smaya
24753c12917Smaya/***********************************
24853c12917Smaya* cl_ext_device_fission extension
24953c12917Smaya***********************************/
25053c12917Smaya#define cl_ext_device_fission   1
25153c12917Smaya
25253c12917Smayaextern CL_API_ENTRY cl_int CL_API_CALL
25353c12917SmayaclReleaseDeviceEXT(cl_device_id device) CL_EXT_SUFFIX__VERSION_1_1;
25453c12917Smaya
25553c12917Smayatypedef CL_API_ENTRY cl_int
25653c12917Smaya(CL_API_CALL *clReleaseDeviceEXT_fn)(cl_device_id device) CL_EXT_SUFFIX__VERSION_1_1;
25753c12917Smaya
25853c12917Smayaextern CL_API_ENTRY cl_int CL_API_CALL
25953c12917SmayaclRetainDeviceEXT(cl_device_id device) CL_EXT_SUFFIX__VERSION_1_1;
26053c12917Smaya
26153c12917Smayatypedef CL_API_ENTRY cl_int
26253c12917Smaya(CL_API_CALL *clRetainDeviceEXT_fn)(cl_device_id device) CL_EXT_SUFFIX__VERSION_1_1;
26353c12917Smaya
26453c12917Smayatypedef cl_ulong  cl_device_partition_property_ext;
26553c12917Smayaextern CL_API_ENTRY cl_int CL_API_CALL
26653c12917SmayaclCreateSubDevicesEXT(cl_device_id   in_device,
26753c12917Smaya                      const cl_device_partition_property_ext * properties,
26853c12917Smaya                      cl_uint        num_entries,
26953c12917Smaya                      cl_device_id * out_devices,
27053c12917Smaya                      cl_uint *      num_devices) CL_EXT_SUFFIX__VERSION_1_1;
27153c12917Smaya
27253c12917Smayatypedef CL_API_ENTRY cl_int
27353c12917Smaya(CL_API_CALL * clCreateSubDevicesEXT_fn)(cl_device_id   in_device,
27453c12917Smaya                                         const cl_device_partition_property_ext * properties,
27553c12917Smaya                                         cl_uint        num_entries,
27653c12917Smaya                                         cl_device_id * out_devices,
27753c12917Smaya                                         cl_uint *      num_devices) CL_EXT_SUFFIX__VERSION_1_1;
27853c12917Smaya
27953c12917Smaya/* cl_device_partition_property_ext */
28053c12917Smaya#define CL_DEVICE_PARTITION_EQUALLY_EXT             0x4050
28153c12917Smaya#define CL_DEVICE_PARTITION_BY_COUNTS_EXT           0x4051
28253c12917Smaya#define CL_DEVICE_PARTITION_BY_NAMES_EXT            0x4052
28353c12917Smaya#define CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN_EXT  0x4053
28453c12917Smaya
28553c12917Smaya/* clDeviceGetInfo selectors */
28653c12917Smaya#define CL_DEVICE_PARENT_DEVICE_EXT                 0x4054
28753c12917Smaya#define CL_DEVICE_PARTITION_TYPES_EXT               0x4055
28853c12917Smaya#define CL_DEVICE_AFFINITY_DOMAINS_EXT              0x4056
28953c12917Smaya#define CL_DEVICE_REFERENCE_COUNT_EXT               0x4057
29053c12917Smaya#define CL_DEVICE_PARTITION_STYLE_EXT               0x4058
29153c12917Smaya
29253c12917Smaya/* error codes */
29353c12917Smaya#define CL_DEVICE_PARTITION_FAILED_EXT              -1057
29453c12917Smaya#define CL_INVALID_PARTITION_COUNT_EXT              -1058
29553c12917Smaya#define CL_INVALID_PARTITION_NAME_EXT               -1059
29653c12917Smaya
29753c12917Smaya/* CL_AFFINITY_DOMAINs */
29853c12917Smaya#define CL_AFFINITY_DOMAIN_L1_CACHE_EXT             0x1
29953c12917Smaya#define CL_AFFINITY_DOMAIN_L2_CACHE_EXT             0x2
30053c12917Smaya#define CL_AFFINITY_DOMAIN_L3_CACHE_EXT             0x3
30153c12917Smaya#define CL_AFFINITY_DOMAIN_L4_CACHE_EXT             0x4
30253c12917Smaya#define CL_AFFINITY_DOMAIN_NUMA_EXT                 0x10
30353c12917Smaya#define CL_AFFINITY_DOMAIN_NEXT_FISSIONABLE_EXT     0x100
30453c12917Smaya
30553c12917Smaya/* cl_device_partition_property_ext list terminators */
30653c12917Smaya#define CL_PROPERTIES_LIST_END_EXT                  ((cl_device_partition_property_ext) 0)
30753c12917Smaya#define CL_PARTITION_BY_COUNTS_LIST_END_EXT         ((cl_device_partition_property_ext) 0)
30853c12917Smaya#define CL_PARTITION_BY_NAMES_LIST_END_EXT          ((cl_device_partition_property_ext) 0 - 1)
30953c12917Smaya
31053c12917Smaya
31153c12917Smaya/***********************************
31253c12917Smaya * cl_ext_migrate_memobject extension definitions
31353c12917Smaya ***********************************/
31453c12917Smaya#define cl_ext_migrate_memobject 1
31553c12917Smaya
31653c12917Smayatypedef cl_bitfield cl_mem_migration_flags_ext;
31753c12917Smaya
31853c12917Smaya#define CL_MIGRATE_MEM_OBJECT_HOST_EXT              0x1
31953c12917Smaya
32053c12917Smaya#define CL_COMMAND_MIGRATE_MEM_OBJECT_EXT           0x4040
32153c12917Smaya
32253c12917Smayaextern CL_API_ENTRY cl_int CL_API_CALL
32353c12917SmayaclEnqueueMigrateMemObjectEXT(cl_command_queue command_queue,
32453c12917Smaya                             cl_uint          num_mem_objects,
32553c12917Smaya                             const cl_mem *   mem_objects,
32653c12917Smaya                             cl_mem_migration_flags_ext flags,
32753c12917Smaya                             cl_uint          num_events_in_wait_list,
32853c12917Smaya                             const cl_event * event_wait_list,
32953c12917Smaya                             cl_event *       event);
33053c12917Smaya
33153c12917Smayatypedef CL_API_ENTRY cl_int
33253c12917Smaya(CL_API_CALL *clEnqueueMigrateMemObjectEXT_fn)(cl_command_queue command_queue,
33353c12917Smaya                                               cl_uint          num_mem_objects,
33453c12917Smaya                                               const cl_mem *   mem_objects,
33553c12917Smaya                                               cl_mem_migration_flags_ext flags,
33653c12917Smaya                                               cl_uint          num_events_in_wait_list,
33753c12917Smaya                                               const cl_event * event_wait_list,
33853c12917Smaya                                               cl_event *       event);
33953c12917Smaya
340af69d88dSmrg
341af69d88dSmrg/*********************************
342af69d88dSmrg* cl_qcom_ext_host_ptr extension
343af69d88dSmrg*********************************/
34453c12917Smaya#define cl_qcom_ext_host_ptr 1
345af69d88dSmrg
346af69d88dSmrg#define CL_MEM_EXT_HOST_PTR_QCOM                  (1 << 29)
347af69d88dSmrg
34853c12917Smaya#define CL_DEVICE_EXT_MEM_PADDING_IN_BYTES_QCOM   0x40A0
349af69d88dSmrg#define CL_DEVICE_PAGE_SIZE_QCOM                  0x40A1
350af69d88dSmrg#define CL_IMAGE_ROW_ALIGNMENT_QCOM               0x40A2
351af69d88dSmrg#define CL_IMAGE_SLICE_ALIGNMENT_QCOM             0x40A3
352af69d88dSmrg#define CL_MEM_HOST_UNCACHED_QCOM                 0x40A4
353af69d88dSmrg#define CL_MEM_HOST_WRITEBACK_QCOM                0x40A5
354af69d88dSmrg#define CL_MEM_HOST_WRITETHROUGH_QCOM             0x40A6
355af69d88dSmrg#define CL_MEM_HOST_WRITE_COMBINING_QCOM          0x40A7
356af69d88dSmrg
357af69d88dSmrgtypedef cl_uint                                   cl_image_pitch_info_qcom;
358af69d88dSmrg
359af69d88dSmrgextern CL_API_ENTRY cl_int CL_API_CALL
360af69d88dSmrgclGetDeviceImageInfoQCOM(cl_device_id             device,
361af69d88dSmrg                         size_t                   image_width,
362af69d88dSmrg                         size_t                   image_height,
363af69d88dSmrg                         const cl_image_format   *image_format,
364af69d88dSmrg                         cl_image_pitch_info_qcom param_name,
365af69d88dSmrg                         size_t                   param_value_size,
366af69d88dSmrg                         void                    *param_value,
367af69d88dSmrg                         size_t                  *param_value_size_ret);
368af69d88dSmrg
369af69d88dSmrgtypedef struct _cl_mem_ext_host_ptr
370af69d88dSmrg{
371af69d88dSmrg    /* Type of external memory allocation. */
372af69d88dSmrg    /* Legal values will be defined in layered extensions. */
373af69d88dSmrg    cl_uint  allocation_type;
37453c12917Smaya
37553c12917Smaya    /* Host cache policy for this external memory allocation. */
376af69d88dSmrg    cl_uint  host_cache_policy;
377af69d88dSmrg
378af69d88dSmrg} cl_mem_ext_host_ptr;
379af69d88dSmrg
38053c12917Smaya
38153c12917Smaya/*******************************************
38253c12917Smaya* cl_qcom_ext_host_ptr_iocoherent extension
38353c12917Smaya********************************************/
38453c12917Smaya
38553c12917Smaya/* Cache policy specifying io-coherence */
38653c12917Smaya#define CL_MEM_HOST_IOCOHERENT_QCOM               0x40A9
38753c12917Smaya
38853c12917Smaya
389af69d88dSmrg/*********************************
390af69d88dSmrg* cl_qcom_ion_host_ptr extension
391af69d88dSmrg*********************************/
392af69d88dSmrg
393af69d88dSmrg#define CL_MEM_ION_HOST_PTR_QCOM                  0x40A8
394af69d88dSmrg
395af69d88dSmrgtypedef struct _cl_mem_ion_host_ptr
396af69d88dSmrg{
397af69d88dSmrg    /* Type of external memory allocation. */
398af69d88dSmrg    /* Must be CL_MEM_ION_HOST_PTR_QCOM for ION allocations. */
399af69d88dSmrg    cl_mem_ext_host_ptr  ext_host_ptr;
400af69d88dSmrg
401af69d88dSmrg    /* ION file descriptor */
402af69d88dSmrg    int                  ion_filedesc;
40353c12917Smaya
404af69d88dSmrg    /* Host pointer to the ION allocated memory */
405af69d88dSmrg    void*                ion_hostptr;
406af69d88dSmrg
407af69d88dSmrg} cl_mem_ion_host_ptr;
408af69d88dSmrg
40953c12917Smaya
41053c12917Smaya/*********************************
41153c12917Smaya* cl_qcom_android_native_buffer_host_ptr extension
41253c12917Smaya*********************************/
41353c12917Smaya
41453c12917Smaya#define CL_MEM_ANDROID_NATIVE_BUFFER_HOST_PTR_QCOM                  0x40C6
41553c12917Smaya
41653c12917Smayatypedef struct _cl_mem_android_native_buffer_host_ptr
41753c12917Smaya{
41853c12917Smaya    /* Type of external memory allocation. */
41953c12917Smaya    /* Must be CL_MEM_ANDROID_NATIVE_BUFFER_HOST_PTR_QCOM for Android native buffers. */
42053c12917Smaya    cl_mem_ext_host_ptr  ext_host_ptr;
42153c12917Smaya
42253c12917Smaya    /* Virtual pointer to the android native buffer */
42353c12917Smaya    void*                anb_ptr;
42453c12917Smaya
42553c12917Smaya} cl_mem_android_native_buffer_host_ptr;
42653c12917Smaya
42753c12917Smaya
42853c12917Smaya/******************************************
42953c12917Smaya * cl_img_yuv_image extension *
43053c12917Smaya ******************************************/
43153c12917Smaya
43253c12917Smaya/* Image formats used in clCreateImage */
43353c12917Smaya#define CL_NV21_IMG                                 0x40D0
43453c12917Smaya#define CL_YV12_IMG                                 0x40D1
43553c12917Smaya
43653c12917Smaya
43753c12917Smaya/******************************************
43853c12917Smaya * cl_img_cached_allocations extension *
43953c12917Smaya ******************************************/
44053c12917Smaya
44153c12917Smaya/* Flag values used by clCreateBuffer */
44253c12917Smaya#define CL_MEM_USE_UNCACHED_CPU_MEMORY_IMG          (1 << 26)
44353c12917Smaya#define CL_MEM_USE_CACHED_CPU_MEMORY_IMG            (1 << 27)
44453c12917Smaya
44553c12917Smaya
44653c12917Smaya/******************************************
44753c12917Smaya * cl_img_use_gralloc_ptr extension *
44853c12917Smaya ******************************************/
44953c12917Smaya#define cl_img_use_gralloc_ptr 1
45053c12917Smaya
45153c12917Smaya/* Flag values used by clCreateBuffer */
45253c12917Smaya#define CL_MEM_USE_GRALLOC_PTR_IMG                  (1 << 28)
45353c12917Smaya
45453c12917Smaya/* To be used by clGetEventInfo: */
45553c12917Smaya#define CL_COMMAND_ACQUIRE_GRALLOC_OBJECTS_IMG      0x40D2
45653c12917Smaya#define CL_COMMAND_RELEASE_GRALLOC_OBJECTS_IMG      0x40D3
45753c12917Smaya
45853c12917Smaya/* Error code from clEnqueueReleaseGrallocObjectsIMG */
45953c12917Smaya#define CL_GRALLOC_RESOURCE_NOT_ACQUIRED_IMG        0x40D4
46053c12917Smaya
46153c12917Smayaextern CL_API_ENTRY cl_int CL_API_CALL
46253c12917SmayaclEnqueueAcquireGrallocObjectsIMG(cl_command_queue      command_queue,
46353c12917Smaya                                  cl_uint               num_objects,
46453c12917Smaya                                  const cl_mem *        mem_objects,
46553c12917Smaya                                  cl_uint               num_events_in_wait_list,
46653c12917Smaya                                  const cl_event *      event_wait_list,
46753c12917Smaya                                  cl_event *            event) CL_EXT_SUFFIX__VERSION_1_2;
46853c12917Smaya
46953c12917Smayaextern CL_API_ENTRY cl_int CL_API_CALL
47053c12917SmayaclEnqueueReleaseGrallocObjectsIMG(cl_command_queue      command_queue,
47153c12917Smaya                                  cl_uint               num_objects,
47253c12917Smaya                                  const cl_mem *        mem_objects,
47353c12917Smaya                                  cl_uint               num_events_in_wait_list,
47453c12917Smaya                                  const cl_event *      event_wait_list,
47553c12917Smaya                                  cl_event *            event) CL_EXT_SUFFIX__VERSION_1_2;
47653c12917Smaya
47753c12917Smaya
47853c12917Smaya/*********************************
47953c12917Smaya* cl_khr_subgroups extension
48053c12917Smaya*********************************/
48153c12917Smaya#define cl_khr_subgroups 1
48253c12917Smaya
48353c12917Smaya#if !defined(CL_VERSION_2_1)
48453c12917Smaya/* For OpenCL 2.1 and newer, cl_kernel_sub_group_info is declared in CL.h.
48553c12917Smaya   In hindsight, there should have been a khr suffix on this type for
48653c12917Smaya   the extension, but keeping it un-suffixed to maintain backwards
48753c12917Smaya   compatibility. */
48853c12917Smayatypedef cl_uint             cl_kernel_sub_group_info;
48953c12917Smaya#endif
49053c12917Smaya
49153c12917Smaya/* cl_kernel_sub_group_info */
49253c12917Smaya#define CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE_KHR    0x2033
49353c12917Smaya#define CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE_KHR       0x2034
49453c12917Smaya
49553c12917Smayaextern CL_API_ENTRY cl_int CL_API_CALL
49653c12917SmayaclGetKernelSubGroupInfoKHR(cl_kernel    in_kernel,
49753c12917Smaya                           cl_device_id in_device,
49853c12917Smaya                           cl_kernel_sub_group_info param_name,
49953c12917Smaya                           size_t       input_value_size,
50053c12917Smaya                           const void * input_value,
50153c12917Smaya                           size_t       param_value_size,
50253c12917Smaya                           void *       param_value,
50353c12917Smaya                           size_t *     param_value_size_ret) CL_EXT_SUFFIX__VERSION_2_0_DEPRECATED;
50453c12917Smaya
50553c12917Smayatypedef CL_API_ENTRY cl_int
50653c12917Smaya(CL_API_CALL * clGetKernelSubGroupInfoKHR_fn)(cl_kernel    in_kernel,
50753c12917Smaya                                              cl_device_id in_device,
50853c12917Smaya                                              cl_kernel_sub_group_info param_name,
50953c12917Smaya                                              size_t       input_value_size,
51053c12917Smaya                                              const void * input_value,
51153c12917Smaya                                              size_t       param_value_size,
51253c12917Smaya                                              void *       param_value,
51353c12917Smaya                                              size_t *     param_value_size_ret) CL_EXT_SUFFIX__VERSION_2_0_DEPRECATED;
51453c12917Smaya
51553c12917Smaya
51653c12917Smaya/*********************************
51753c12917Smaya* cl_khr_mipmap_image extension
51853c12917Smaya*********************************/
51953c12917Smaya
52053c12917Smaya/* cl_sampler_properties */
52153c12917Smaya#define CL_SAMPLER_MIP_FILTER_MODE_KHR              0x1155
52253c12917Smaya#define CL_SAMPLER_LOD_MIN_KHR                      0x1156
52353c12917Smaya#define CL_SAMPLER_LOD_MAX_KHR                      0x1157
52453c12917Smaya
52553c12917Smaya
52653c12917Smaya/*********************************
52753c12917Smaya* cl_khr_priority_hints extension
52853c12917Smaya*********************************/
52953c12917Smaya/* This extension define is for backwards compatibility.
53053c12917Smaya   It shouldn't be required since this extension has no new functions. */
53153c12917Smaya#define cl_khr_priority_hints 1
53253c12917Smaya
53353c12917Smayatypedef cl_uint  cl_queue_priority_khr;
53453c12917Smaya
53553c12917Smaya/* cl_command_queue_properties */
53653c12917Smaya#define CL_QUEUE_PRIORITY_KHR 0x1096
53753c12917Smaya
53853c12917Smaya/* cl_queue_priority_khr */
53953c12917Smaya#define CL_QUEUE_PRIORITY_HIGH_KHR (1<<0)
54053c12917Smaya#define CL_QUEUE_PRIORITY_MED_KHR (1<<1)
54153c12917Smaya#define CL_QUEUE_PRIORITY_LOW_KHR (1<<2)
54253c12917Smaya
54353c12917Smaya
54453c12917Smaya/*********************************
54553c12917Smaya* cl_khr_throttle_hints extension
54653c12917Smaya*********************************/
54753c12917Smaya/* This extension define is for backwards compatibility.
54853c12917Smaya   It shouldn't be required since this extension has no new functions. */
54953c12917Smaya#define cl_khr_throttle_hints 1
55053c12917Smaya
55153c12917Smayatypedef cl_uint  cl_queue_throttle_khr;
55253c12917Smaya
55353c12917Smaya/* cl_command_queue_properties */
55453c12917Smaya#define CL_QUEUE_THROTTLE_KHR 0x1097
55553c12917Smaya
55653c12917Smaya/* cl_queue_throttle_khr */
55753c12917Smaya#define CL_QUEUE_THROTTLE_HIGH_KHR (1<<0)
55853c12917Smaya#define CL_QUEUE_THROTTLE_MED_KHR (1<<1)
55953c12917Smaya#define CL_QUEUE_THROTTLE_LOW_KHR (1<<2)
56053c12917Smaya
56153c12917Smaya
56253c12917Smaya/*********************************
56353c12917Smaya* cl_khr_subgroup_named_barrier
56453c12917Smaya*********************************/
56553c12917Smaya/* This extension define is for backwards compatibility.
56653c12917Smaya   It shouldn't be required since this extension has no new functions. */
56753c12917Smaya#define cl_khr_subgroup_named_barrier 1
56853c12917Smaya
56953c12917Smaya/* cl_device_info */
57053c12917Smaya#define CL_DEVICE_MAX_NAMED_BARRIER_COUNT_KHR       0x2035
57153c12917Smaya
57253c12917Smaya
57353c12917Smaya/**********************************
57453c12917Smaya * cl_arm_import_memory extension *
57553c12917Smaya **********************************/
57653c12917Smaya#define cl_arm_import_memory 1
57753c12917Smaya
57853c12917Smayatypedef intptr_t cl_import_properties_arm;
57953c12917Smaya
58053c12917Smaya/* Default and valid proporties name for cl_arm_import_memory */
58153c12917Smaya#define CL_IMPORT_TYPE_ARM                        0x40B2
58253c12917Smaya
58353c12917Smaya/* Host process memory type default value for CL_IMPORT_TYPE_ARM property */
58453c12917Smaya#define CL_IMPORT_TYPE_HOST_ARM                   0x40B3
58553c12917Smaya
58653c12917Smaya/* DMA BUF memory type value for CL_IMPORT_TYPE_ARM property */
58753c12917Smaya#define CL_IMPORT_TYPE_DMA_BUF_ARM                0x40B4
58853c12917Smaya
58953c12917Smaya/* Protected DMA BUF memory type value for CL_IMPORT_TYPE_ARM property */
59053c12917Smaya#define CL_IMPORT_TYPE_PROTECTED_ARM              0x40B5
59153c12917Smaya
59253c12917Smaya/* This extension adds a new function that allows for direct memory import into
59353c12917Smaya * OpenCL via the clImportMemoryARM function.
59453c12917Smaya *
59553c12917Smaya * Memory imported through this interface will be mapped into the device's page
59653c12917Smaya * tables directly, providing zero copy access. It will never fall back to copy
59753c12917Smaya * operations and aliased buffers.
59853c12917Smaya *
59953c12917Smaya * Types of memory supported for import are specified as additional extension
60053c12917Smaya * strings.
60153c12917Smaya *
60253c12917Smaya * This extension produces cl_mem allocations which are compatible with all other
60353c12917Smaya * users of cl_mem in the standard API.
60453c12917Smaya *
60553c12917Smaya * This extension maps pages with the same properties as the normal buffer creation
60653c12917Smaya * function clCreateBuffer.
60753c12917Smaya */
60853c12917Smayaextern CL_API_ENTRY cl_mem CL_API_CALL
60953c12917SmayaclImportMemoryARM( cl_context context,
61053c12917Smaya                   cl_mem_flags flags,
61153c12917Smaya                   const cl_import_properties_arm *properties,
61253c12917Smaya                   void *memory,
61353c12917Smaya                   size_t size,
61453c12917Smaya                   cl_int *errcode_ret) CL_EXT_SUFFIX__VERSION_1_0;
61553c12917Smaya
61653c12917Smaya
61753c12917Smaya/******************************************
61853c12917Smaya * cl_arm_shared_virtual_memory extension *
61953c12917Smaya ******************************************/
62053c12917Smaya#define cl_arm_shared_virtual_memory 1
62153c12917Smaya
62253c12917Smaya/* Used by clGetDeviceInfo */
62353c12917Smaya#define CL_DEVICE_SVM_CAPABILITIES_ARM                  0x40B6
62453c12917Smaya
62553c12917Smaya/* Used by clGetMemObjectInfo */
62653c12917Smaya#define CL_MEM_USES_SVM_POINTER_ARM                     0x40B7
62753c12917Smaya
62853c12917Smaya/* Used by clSetKernelExecInfoARM: */
62953c12917Smaya#define CL_KERNEL_EXEC_INFO_SVM_PTRS_ARM                0x40B8
63053c12917Smaya#define CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM_ARM   0x40B9
63153c12917Smaya
63253c12917Smaya/* To be used by clGetEventInfo: */
63353c12917Smaya#define CL_COMMAND_SVM_FREE_ARM                         0x40BA
63453c12917Smaya#define CL_COMMAND_SVM_MEMCPY_ARM                       0x40BB
63553c12917Smaya#define CL_COMMAND_SVM_MEMFILL_ARM                      0x40BC
63653c12917Smaya#define CL_COMMAND_SVM_MAP_ARM                          0x40BD
63753c12917Smaya#define CL_COMMAND_SVM_UNMAP_ARM                        0x40BE
63853c12917Smaya
63953c12917Smaya/* Flag values returned by clGetDeviceInfo with CL_DEVICE_SVM_CAPABILITIES_ARM as the param_name. */
64053c12917Smaya#define CL_DEVICE_SVM_COARSE_GRAIN_BUFFER_ARM           (1 << 0)
64153c12917Smaya#define CL_DEVICE_SVM_FINE_GRAIN_BUFFER_ARM             (1 << 1)
64253c12917Smaya#define CL_DEVICE_SVM_FINE_GRAIN_SYSTEM_ARM             (1 << 2)
64353c12917Smaya#define CL_DEVICE_SVM_ATOMICS_ARM                       (1 << 3)
64453c12917Smaya
64553c12917Smaya/* Flag values used by clSVMAllocARM: */
64653c12917Smaya#define CL_MEM_SVM_FINE_GRAIN_BUFFER_ARM                (1 << 10)
64753c12917Smaya#define CL_MEM_SVM_ATOMICS_ARM                          (1 << 11)
64853c12917Smaya
64953c12917Smayatypedef cl_bitfield cl_svm_mem_flags_arm;
65053c12917Smayatypedef cl_uint     cl_kernel_exec_info_arm;
65153c12917Smayatypedef cl_bitfield cl_device_svm_capabilities_arm;
65253c12917Smaya
65353c12917Smayaextern CL_API_ENTRY void * CL_API_CALL
65453c12917SmayaclSVMAllocARM(cl_context       context,
65553c12917Smaya              cl_svm_mem_flags_arm flags,
65653c12917Smaya              size_t           size,
65753c12917Smaya              cl_uint          alignment) CL_EXT_SUFFIX__VERSION_1_2;
65853c12917Smaya
65953c12917Smayaextern CL_API_ENTRY void CL_API_CALL
66053c12917SmayaclSVMFreeARM(cl_context        context,
66153c12917Smaya             void *            svm_pointer) CL_EXT_SUFFIX__VERSION_1_2;
66253c12917Smaya
66353c12917Smayaextern CL_API_ENTRY cl_int CL_API_CALL
66453c12917SmayaclEnqueueSVMFreeARM(cl_command_queue  command_queue,
66553c12917Smaya                    cl_uint           num_svm_pointers,
66653c12917Smaya                    void *            svm_pointers[],
66753c12917Smaya                    void (CL_CALLBACK * pfn_free_func)(cl_command_queue queue,
66853c12917Smaya                                                       cl_uint          num_svm_pointers,
66953c12917Smaya                                                       void *           svm_pointers[],
67053c12917Smaya                                                       void *           user_data),
67153c12917Smaya                    void *            user_data,
67253c12917Smaya                    cl_uint           num_events_in_wait_list,
67353c12917Smaya                    const cl_event *  event_wait_list,
67453c12917Smaya                    cl_event *        event) CL_EXT_SUFFIX__VERSION_1_2;
67553c12917Smaya
67653c12917Smayaextern CL_API_ENTRY cl_int CL_API_CALL
67753c12917SmayaclEnqueueSVMMemcpyARM(cl_command_queue  command_queue,
67853c12917Smaya                      cl_bool           blocking_copy,
67953c12917Smaya                      void *            dst_ptr,
68053c12917Smaya                      const void *      src_ptr,
68153c12917Smaya                      size_t            size,
68253c12917Smaya                      cl_uint           num_events_in_wait_list,
68353c12917Smaya                      const cl_event *  event_wait_list,
68453c12917Smaya                      cl_event *        event) CL_EXT_SUFFIX__VERSION_1_2;
68553c12917Smaya
68653c12917Smayaextern CL_API_ENTRY cl_int CL_API_CALL
68753c12917SmayaclEnqueueSVMMemFillARM(cl_command_queue  command_queue,
68853c12917Smaya                       void *            svm_ptr,
68953c12917Smaya                       const void *      pattern,
69053c12917Smaya                       size_t            pattern_size,
69153c12917Smaya                       size_t            size,
69253c12917Smaya                       cl_uint           num_events_in_wait_list,
69353c12917Smaya                       const cl_event *  event_wait_list,
69453c12917Smaya                       cl_event *        event) CL_EXT_SUFFIX__VERSION_1_2;
69553c12917Smaya
69653c12917Smayaextern CL_API_ENTRY cl_int CL_API_CALL
69753c12917SmayaclEnqueueSVMMapARM(cl_command_queue  command_queue,
69853c12917Smaya                   cl_bool           blocking_map,
69953c12917Smaya                   cl_map_flags      flags,
70053c12917Smaya                   void *            svm_ptr,
70153c12917Smaya                   size_t            size,
70253c12917Smaya                   cl_uint           num_events_in_wait_list,
70353c12917Smaya                   const cl_event *  event_wait_list,
70453c12917Smaya                   cl_event *        event) CL_EXT_SUFFIX__VERSION_1_2;
70553c12917Smaya
70653c12917Smayaextern CL_API_ENTRY cl_int CL_API_CALL
70753c12917SmayaclEnqueueSVMUnmapARM(cl_command_queue  command_queue,
70853c12917Smaya                     void *            svm_ptr,
70953c12917Smaya                     cl_uint           num_events_in_wait_list,
71053c12917Smaya                     const cl_event *  event_wait_list,
71153c12917Smaya                     cl_event *        event) CL_EXT_SUFFIX__VERSION_1_2;
71253c12917Smaya
71353c12917Smayaextern CL_API_ENTRY cl_int CL_API_CALL
71453c12917SmayaclSetKernelArgSVMPointerARM(cl_kernel    kernel,
71553c12917Smaya                            cl_uint      arg_index,
71653c12917Smaya                            const void * arg_value) CL_EXT_SUFFIX__VERSION_1_2;
71753c12917Smaya
71853c12917Smayaextern CL_API_ENTRY cl_int CL_API_CALL
71953c12917SmayaclSetKernelExecInfoARM(cl_kernel            kernel,
72053c12917Smaya                       cl_kernel_exec_info_arm  param_name,
72153c12917Smaya                       size_t               param_value_size,
72253c12917Smaya                       const void *         param_value) CL_EXT_SUFFIX__VERSION_1_2;
72353c12917Smaya
72453c12917Smaya/********************************
72553c12917Smaya * cl_arm_get_core_id extension *
72653c12917Smaya ********************************/
72753c12917Smaya
72853c12917Smaya#ifdef CL_VERSION_1_2
72953c12917Smaya
73053c12917Smaya#define cl_arm_get_core_id 1
73153c12917Smaya
73253c12917Smaya/* Device info property for bitfield of cores present */
73353c12917Smaya#define CL_DEVICE_COMPUTE_UNITS_BITFIELD_ARM      0x40BF
73453c12917Smaya
73553c12917Smaya#endif  /* CL_VERSION_1_2 */
736af69d88dSmrg
737af69d88dSmrg#ifdef __cplusplus
738af69d88dSmrg}
739af69d88dSmrg#endif
740af69d88dSmrg
741af69d88dSmrg
742af69d88dSmrg#endif /* __CL_EXT_H */
743