blob: 7b101d7372b4a682e7ccb45d4a23709be5619324 [file] [log] [blame]
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001/*******************************************************************************
Anthony Barbier8b2fdc92018-08-09 11:42:38 +01002 * Copyright (c) 2008-2018 The Khronos Group Inc.
Anthony Barbier6ff3b192017-09-04 18:44:23 +01003 *
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 *
Pablo Telloe86a09f2018-01-11 15:44:48 +000015 * 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 *
Anthony Barbier6ff3b192017-09-04 18:44:23 +010020 * 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
Anthony Barbier6ff3b192017-09-04 18:44:23 +010029/* cl_ext.h contains OpenCL extensions which don't have external */
30/* (OpenGL, D3D) dependencies. */
31
32#ifndef __CL_EXT_H
33#define __CL_EXT_H
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39#ifdef __APPLE__
Anthony Barbier8b2fdc92018-08-09 11:42:38 +010040 #include <OpenCL/cl.h>
Anthony Barbier6ff3b192017-09-04 18:44:23 +010041 #include <AvailabilityMacros.h>
42#else
Anthony Barbier8b2fdc92018-08-09 11:42:38 +010043 #include <CL/cl.h>
44#endif
45
46/* cl_khr_fp64 extension - no extension #define since it has no functions */
47/* CL_DEVICE_DOUBLE_FP_CONFIG is defined in CL.h for OpenCL >= 120 */
48
49#if CL_TARGET_OPENCL_VERSION <= 110
50#define CL_DEVICE_DOUBLE_FP_CONFIG 0x1032
Anthony Barbier6ff3b192017-09-04 18:44:23 +010051#endif
52
53/* cl_khr_fp16 extension - no extension #define since it has no functions */
54#define CL_DEVICE_HALF_FP_CONFIG 0x1033
55
56/* Memory object destruction
57 *
58 * Apple extension for use to manage externally allocated buffers used with cl_mem objects with CL_MEM_USE_HOST_PTR
59 *
Anthony Barbier8b2fdc92018-08-09 11:42:38 +010060 * Registers a user callback function that will be called when the memory object is deleted and its resources
61 * freed. Each call to clSetMemObjectCallbackFn registers the specified user callback function on a callback
62 * stack associated with memobj. The registered user callback functions are called in the reverse order in
63 * which they were registered. The user callback functions are called and then the memory object is deleted
64 * and its resources freed. This provides a mechanism for the application (and libraries) using memobj to be
65 * notified when the memory referenced by host_ptr, specified when the memory object is created and used as
Anthony Barbier6ff3b192017-09-04 18:44:23 +010066 * the storage bits for the memory object, can be reused or freed.
67 *
68 * The application may not call CL api's with the cl_mem object passed to the pfn_notify.
69 *
70 * Please check for the "cl_APPLE_SetMemObjectDestructor" extension using clGetDeviceInfo(CL_DEVICE_EXTENSIONS)
71 * before using.
72 */
73#define cl_APPLE_SetMemObjectDestructor 1
Anthony Barbier8b2fdc92018-08-09 11:42:38 +010074cl_int CL_API_ENTRY clSetMemObjectDestructorAPPLE( cl_mem /* memobj */,
75 void (* /*pfn_notify*/)( cl_mem /* memobj */, void* /*user_data*/),
76 void * /*user_data */ ) CL_EXT_SUFFIX__VERSION_1_0;
Anthony Barbier6ff3b192017-09-04 18:44:23 +010077
78
79/* Context Logging Functions
80 *
81 * The next three convenience functions are intended to be used as the pfn_notify parameter to clCreateContext().
82 * Please check for the "cl_APPLE_ContextLoggingFunctions" extension using clGetDeviceInfo(CL_DEVICE_EXTENSIONS)
83 * before using.
84 *
Anthony Barbier8b2fdc92018-08-09 11:42:38 +010085 * clLogMessagesToSystemLog fowards on all log messages to the Apple System Logger
Anthony Barbier6ff3b192017-09-04 18:44:23 +010086 */
87#define cl_APPLE_ContextLoggingFunctions 1
Anthony Barbier8b2fdc92018-08-09 11:42:38 +010088extern void CL_API_ENTRY clLogMessagesToSystemLogAPPLE( const char * /* errstr */,
89 const void * /* private_info */,
90 size_t /* cb */,
Anthony Barbier6ff3b192017-09-04 18:44:23 +010091 void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0;
92
93/* clLogMessagesToStdout sends all log messages to the file descriptor stdout */
Anthony Barbier8b2fdc92018-08-09 11:42:38 +010094extern void CL_API_ENTRY clLogMessagesToStdoutAPPLE( const char * /* errstr */,
95 const void * /* private_info */,
96 size_t /* cb */,
Anthony Barbier6ff3b192017-09-04 18:44:23 +010097 void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0;
98
99/* clLogMessagesToStderr sends all log messages to the file descriptor stderr */
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100100extern void CL_API_ENTRY clLogMessagesToStderrAPPLE( const char * /* errstr */,
101 const void * /* private_info */,
102 size_t /* cb */,
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100103 void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0;
104
105
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100106/************************
107* cl_khr_icd extension *
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100108************************/
109#define cl_khr_icd 1
110
111/* cl_platform_info */
112#define CL_PLATFORM_ICD_SUFFIX_KHR 0x0920
113
114/* Additional Error Codes */
115#define CL_PLATFORM_NOT_FOUND_KHR -1001
116
117extern CL_API_ENTRY cl_int CL_API_CALL
118clIcdGetPlatformIDsKHR(cl_uint /* num_entries */,
119 cl_platform_id * /* platforms */,
120 cl_uint * /* num_platforms */);
121
122typedef CL_API_ENTRY cl_int (CL_API_CALL *clIcdGetPlatformIDsKHR_fn)(
123 cl_uint /* num_entries */,
124 cl_platform_id * /* platforms */,
125 cl_uint * /* num_platforms */);
126
127
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100128
129/*******************************
130 * cl_khr_il_program extension *
131 *******************************/
132#define cl_khr_il_program 1
133
134/* New property to clGetDeviceInfo for retrieving supported intermediate
135 * languages
136 */
137#define CL_DEVICE_IL_VERSION_KHR 0x105B
138
139/* New property to clGetProgramInfo for retrieving for retrieving the IL of a
140 * program
141 */
142#define CL_PROGRAM_IL_KHR 0x1169
143
144extern CL_API_ENTRY cl_program
145 CL_API_CALL clCreateProgramWithILKHR(
146 cl_context /* context */,
147 const void * /* il */,
148 size_t /* length */,
149 cl_int * /* errcode_ret */);
150
151typedef CL_API_ENTRY cl_program
152 (CL_API_CALL *clCreateProgramWithILKHR_fn)(
153 cl_context /* context */,
154 const void * /* il */,
155 size_t /* length */,
156 cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_2;
157
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100158/* Extension: cl_khr_image2D_buffer
159 *
160 * This extension allows a 2D image to be created from a cl_mem buffer without a copy.
161 * The type associated with a 2D image created from a buffer in an OpenCL program is image2d_t.
162 * Both the sampler and sampler-less read_image built-in functions are supported for 2D images
163 * and 2D images created from a buffer. Similarly, the write_image built-ins are also supported
164 * for 2D images created from a buffer.
165 *
166 * When the 2D image from buffer is created, the client must specify the width,
167 * height, image format (i.e. channel order and channel data type) and optionally the row pitch
168 *
169 * The pitch specified must be a multiple of CL_DEVICE_IMAGE_PITCH_ALIGNMENT pixels.
170 * The base address of the buffer must be aligned to CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT pixels.
171 */
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100172
173/**************************************
174 * cl_khr_initialize_memory extension *
175 **************************************/
176
Pablo Telloe86a09f2018-01-11 15:44:48 +0000177#define CL_CONTEXT_MEMORY_INITIALIZE_KHR 0x2030
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100178
179
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100180/**************************************
181 * cl_khr_terminate_context extension *
182 **************************************/
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100183
Pablo Telloe86a09f2018-01-11 15:44:48 +0000184#define CL_DEVICE_TERMINATE_CAPABILITY_KHR 0x2031
185#define CL_CONTEXT_TERMINATE_KHR 0x2032
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100186
187#define cl_khr_terminate_context 1
188extern CL_API_ENTRY cl_int CL_API_CALL clTerminateContextKHR(cl_context /* context */) CL_EXT_SUFFIX__VERSION_1_2;
189
190typedef CL_API_ENTRY cl_int (CL_API_CALL *clTerminateContextKHR_fn)(cl_context /* context */) CL_EXT_SUFFIX__VERSION_1_2;
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100191
192
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100193/*
194 * Extension: cl_khr_spir
195 *
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100196 * This extension adds support to create an OpenCL program object from a
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100197 * Standard Portable Intermediate Representation (SPIR) instance
198 */
199
200#define CL_DEVICE_SPIR_VERSIONS 0x40E0
201#define CL_PROGRAM_BINARY_TYPE_INTERMEDIATE 0x40E1
202
203
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100204/*****************************************
205 * cl_khr_create_command_queue extension *
206 *****************************************/
207#define cl_khr_create_command_queue 1
208
209typedef cl_bitfield cl_queue_properties_khr;
210
211extern CL_API_ENTRY cl_command_queue CL_API_CALL
212clCreateCommandQueueWithPropertiesKHR( cl_context /* context */,
213 cl_device_id /* device */,
214 const cl_queue_properties_khr* /* properties */,
215 cl_int* /* errcode_ret */ ) CL_EXT_SUFFIX__VERSION_1_2;
216typedef CL_API_ENTRY cl_command_queue
217(CL_API_CALL *clCreateCommandQueueWithPropertiesKHR_fn)( cl_context /* context */,
218 cl_device_id /* device */,
219 const cl_queue_properties_khr* /* properties */,
220 cl_int* /* errcode_ret */ ) CL_EXT_SUFFIX__VERSION_1_2;
221
222
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100223/******************************************
224* cl_nv_device_attribute_query extension *
225******************************************/
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100226
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100227/* cl_nv_device_attribute_query extension - no extension #define since it has no functions */
228#define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000
229#define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001
230#define CL_DEVICE_REGISTERS_PER_BLOCK_NV 0x4002
231#define CL_DEVICE_WARP_SIZE_NV 0x4003
232#define CL_DEVICE_GPU_OVERLAP_NV 0x4004
233#define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV 0x4005
234#define CL_DEVICE_INTEGRATED_MEMORY_NV 0x4006
235
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100236
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100237/*********************************
238* cl_amd_device_attribute_query *
239*********************************/
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100240
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100241#define CL_DEVICE_PROFILING_TIMER_OFFSET_AMD 0x4036
242
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100243
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100244/*********************************
245* cl_arm_printf extension
246*********************************/
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100247
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100248#define CL_PRINTF_CALLBACK_ARM 0x40B0
249#define CL_PRINTF_BUFFERSIZE_ARM 0x40B1
250
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100251
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100252/***********************************
253* cl_ext_device_fission extension
254***********************************/
255#define cl_ext_device_fission 1
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100256
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100257extern CL_API_ENTRY cl_int CL_API_CALL
258clReleaseDeviceEXT( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100259
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100260typedef CL_API_ENTRY cl_int
261(CL_API_CALL *clReleaseDeviceEXT_fn)( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100262
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100263extern CL_API_ENTRY cl_int CL_API_CALL
264clRetainDeviceEXT( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
265
266typedef CL_API_ENTRY cl_int
267(CL_API_CALL *clRetainDeviceEXT_fn)( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
268
269typedef cl_ulong cl_device_partition_property_ext;
270extern CL_API_ENTRY cl_int CL_API_CALL
271clCreateSubDevicesEXT( cl_device_id /*in_device*/,
272 const cl_device_partition_property_ext * /* properties */,
273 cl_uint /*num_entries*/,
274 cl_device_id * /*out_devices*/,
275 cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__VERSION_1_1;
276
277typedef CL_API_ENTRY cl_int
278( CL_API_CALL * clCreateSubDevicesEXT_fn)( cl_device_id /*in_device*/,
279 const cl_device_partition_property_ext * /* properties */,
280 cl_uint /*num_entries*/,
281 cl_device_id * /*out_devices*/,
282 cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__VERSION_1_1;
283
284/* cl_device_partition_property_ext */
285#define CL_DEVICE_PARTITION_EQUALLY_EXT 0x4050
286#define CL_DEVICE_PARTITION_BY_COUNTS_EXT 0x4051
287#define CL_DEVICE_PARTITION_BY_NAMES_EXT 0x4052
288#define CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN_EXT 0x4053
289
290/* clDeviceGetInfo selectors */
291#define CL_DEVICE_PARENT_DEVICE_EXT 0x4054
292#define CL_DEVICE_PARTITION_TYPES_EXT 0x4055
293#define CL_DEVICE_AFFINITY_DOMAINS_EXT 0x4056
294#define CL_DEVICE_REFERENCE_COUNT_EXT 0x4057
295#define CL_DEVICE_PARTITION_STYLE_EXT 0x4058
296
297/* error codes */
298#define CL_DEVICE_PARTITION_FAILED_EXT -1057
299#define CL_INVALID_PARTITION_COUNT_EXT -1058
300#define CL_INVALID_PARTITION_NAME_EXT -1059
301
302/* CL_AFFINITY_DOMAINs */
303#define CL_AFFINITY_DOMAIN_L1_CACHE_EXT 0x1
304#define CL_AFFINITY_DOMAIN_L2_CACHE_EXT 0x2
305#define CL_AFFINITY_DOMAIN_L3_CACHE_EXT 0x3
306#define CL_AFFINITY_DOMAIN_L4_CACHE_EXT 0x4
307#define CL_AFFINITY_DOMAIN_NUMA_EXT 0x10
308#define CL_AFFINITY_DOMAIN_NEXT_FISSIONABLE_EXT 0x100
309
310/* cl_device_partition_property_ext list terminators */
311#define CL_PROPERTIES_LIST_END_EXT ((cl_device_partition_property_ext) 0)
312#define CL_PARTITION_BY_COUNTS_LIST_END_EXT ((cl_device_partition_property_ext) 0)
313#define CL_PARTITION_BY_NAMES_LIST_END_EXT ((cl_device_partition_property_ext) 0 - 1)
314
315
316/***********************************
317 * cl_ext_migrate_memobject extension definitions
318 ***********************************/
319#define cl_ext_migrate_memobject 1
320
321typedef cl_bitfield cl_mem_migration_flags_ext;
322
323#define CL_MIGRATE_MEM_OBJECT_HOST_EXT 0x1
324
325#define CL_COMMAND_MIGRATE_MEM_OBJECT_EXT 0x4040
326
327extern CL_API_ENTRY cl_int CL_API_CALL
328clEnqueueMigrateMemObjectEXT( cl_command_queue /* command_queue */,
329 cl_uint /* num_mem_objects */,
330 const cl_mem * /* mem_objects */,
331 cl_mem_migration_flags_ext /* flags */,
332 cl_uint /* num_events_in_wait_list */,
333 const cl_event * /* event_wait_list */,
334 cl_event * /* event */ );
335
336typedef CL_API_ENTRY cl_int
337(CL_API_CALL *clEnqueueMigrateMemObjectEXT_fn)( cl_command_queue /* command_queue */,
338 cl_uint /* num_mem_objects */,
339 const cl_mem * /* mem_objects */,
340 cl_mem_migration_flags_ext /* flags */,
341 cl_uint /* num_events_in_wait_list */,
342 const cl_event * /* event_wait_list */,
343 cl_event * /* event */ );
344
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100345
346/*********************************
347* cl_qcom_ext_host_ptr extension
348*********************************/
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100349#define cl_qcom_ext_host_ptr 1
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100350
351#define CL_MEM_EXT_HOST_PTR_QCOM (1 << 29)
352
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100353#define CL_DEVICE_EXT_MEM_PADDING_IN_BYTES_QCOM 0x40A0
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100354#define CL_DEVICE_PAGE_SIZE_QCOM 0x40A1
355#define CL_IMAGE_ROW_ALIGNMENT_QCOM 0x40A2
356#define CL_IMAGE_SLICE_ALIGNMENT_QCOM 0x40A3
357#define CL_MEM_HOST_UNCACHED_QCOM 0x40A4
358#define CL_MEM_HOST_WRITEBACK_QCOM 0x40A5
359#define CL_MEM_HOST_WRITETHROUGH_QCOM 0x40A6
360#define CL_MEM_HOST_WRITE_COMBINING_QCOM 0x40A7
361
362typedef cl_uint cl_image_pitch_info_qcom;
363
364extern CL_API_ENTRY cl_int CL_API_CALL
365clGetDeviceImageInfoQCOM(cl_device_id device,
366 size_t image_width,
367 size_t image_height,
368 const cl_image_format *image_format,
369 cl_image_pitch_info_qcom param_name,
370 size_t param_value_size,
371 void *param_value,
372 size_t *param_value_size_ret);
373
374typedef struct _cl_mem_ext_host_ptr
375{
376 /* Type of external memory allocation. */
377 /* Legal values will be defined in layered extensions. */
378 cl_uint allocation_type;
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100379
Pablo Telloe86a09f2018-01-11 15:44:48 +0000380 /* Host cache policy for this external memory allocation. */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100381 cl_uint host_cache_policy;
382
383} cl_mem_ext_host_ptr;
384
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100385
386/*******************************************
387* cl_qcom_ext_host_ptr_iocoherent extension
388********************************************/
389
390/* Cache policy specifying io-coherence */
391#define CL_MEM_HOST_IOCOHERENT_QCOM 0x40A9
392
393
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100394/*********************************
395* cl_qcom_ion_host_ptr extension
396*********************************/
397
398#define CL_MEM_ION_HOST_PTR_QCOM 0x40A8
399
400typedef struct _cl_mem_ion_host_ptr
401{
402 /* Type of external memory allocation. */
403 /* Must be CL_MEM_ION_HOST_PTR_QCOM for ION allocations. */
404 cl_mem_ext_host_ptr ext_host_ptr;
405
406 /* ION file descriptor */
407 int ion_filedesc;
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100408
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100409 /* Host pointer to the ION allocated memory */
410 void* ion_hostptr;
411
412} cl_mem_ion_host_ptr;
413
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100414
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100415/*********************************
416* cl_qcom_android_native_buffer_host_ptr extension
417*********************************/
418
419#define CL_MEM_ANDROID_NATIVE_BUFFER_HOST_PTR_QCOM 0x40C6
420
421typedef struct _cl_mem_android_native_buffer_host_ptr
422{
423 /* Type of external memory allocation. */
424 /* Must be CL_MEM_ANDROID_NATIVE_BUFFER_HOST_PTR_QCOM for Android native buffers. */
425 cl_mem_ext_host_ptr ext_host_ptr;
426
427 /* Virtual pointer to the android native buffer */
428 void* anb_ptr;
429
430} cl_mem_android_native_buffer_host_ptr;
431
Pablo Telloe86a09f2018-01-11 15:44:48 +0000432
433/******************************************
434 * cl_img_yuv_image extension *
435 ******************************************/
436
437/* Image formats used in clCreateImage */
438#define CL_NV21_IMG 0x40D0
439#define CL_YV12_IMG 0x40D1
440
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100441
Pablo Telloe86a09f2018-01-11 15:44:48 +0000442/******************************************
443 * cl_img_cached_allocations extension *
444 ******************************************/
445
446/* Flag values used by clCreteBuffer */
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100447#define CL_MEM_USE_UNCACHED_CPU_MEMORY_IMG (1 << 26)
448#define CL_MEM_USE_CACHED_CPU_MEMORY_IMG (1 << 27)
449
Pablo Telloe86a09f2018-01-11 15:44:48 +0000450
451/******************************************
452 * cl_img_use_gralloc_ptr extension *
453 ******************************************/
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100454#define cl_img_use_gralloc_ptr 1
Pablo Telloe86a09f2018-01-11 15:44:48 +0000455
456/* Flag values used by clCreteBuffer */
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100457#define CL_MEM_USE_GRALLOC_PTR_IMG (1 << 28)
Pablo Telloe86a09f2018-01-11 15:44:48 +0000458
459/* To be used by clGetEventInfo: */
460#define CL_COMMAND_ACQUIRE_GRALLOC_OBJECTS_IMG 0x40D2
461#define CL_COMMAND_RELEASE_GRALLOC_OBJECTS_IMG 0x40D3
462
463/* Error code from clEnqueueReleaseGrallocObjectsIMG */
464#define CL_GRALLOC_RESOURCE_NOT_ACQUIRED_IMG 0x40D4
465
466extern CL_API_ENTRY cl_int CL_API_CALL
467clEnqueueAcquireGrallocObjectsIMG(cl_command_queue /* command_queue */,
468 cl_uint /* num_objects */,
469 const cl_mem * /* mem_objects */,
470 cl_uint /* num_events_in_wait_list */,
471 const cl_event * /* event_wait_list */,
472 cl_event * /* event */) CL_EXT_SUFFIX__VERSION_1_2;
473
474extern CL_API_ENTRY cl_int CL_API_CALL
475clEnqueueReleaseGrallocObjectsIMG(cl_command_queue /* command_queue */,
476 cl_uint /* num_objects */,
477 const cl_mem * /* mem_objects */,
478 cl_uint /* num_events_in_wait_list */,
479 const cl_event * /* event_wait_list */,
480 cl_event * /* event */) CL_EXT_SUFFIX__VERSION_1_2;
481
Pablo Telloe86a09f2018-01-11 15:44:48 +0000482
Pablo Telloe86a09f2018-01-11 15:44:48 +0000483/*********************************
484* cl_khr_subgroups extension
485*********************************/
486#define cl_khr_subgroups 1
487
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100488#if !defined(CL_VERSION_2_1)
489/* For OpenCL 2.1 and newer, cl_kernel_sub_group_info is declared in CL.h.
490 In hindsight, there should have been a khr suffix on this type for
491 the extension, but keeping it un-suffixed to maintain backwards
492 compatibility. */
493typedef cl_uint cl_kernel_sub_group_info;
494#endif
Pablo Telloe86a09f2018-01-11 15:44:48 +0000495
496/* cl_kernel_sub_group_info */
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100497#define CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE_KHR 0x2033
498#define CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE_KHR 0x2034
Pablo Telloe86a09f2018-01-11 15:44:48 +0000499
500extern CL_API_ENTRY cl_int CL_API_CALL
501clGetKernelSubGroupInfoKHR(cl_kernel /* in_kernel */,
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100502 cl_device_id /*in_device*/,
503 cl_kernel_sub_group_info /* param_name */,
504 size_t /*input_value_size*/,
505 const void * /*input_value*/,
506 size_t /*param_value_size*/,
507 void* /*param_value*/,
508 size_t* /*param_value_size_ret*/ ) CL_EXT_SUFFIX__VERSION_2_0_DEPRECATED;
Pablo Telloe86a09f2018-01-11 15:44:48 +0000509
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100510typedef CL_API_ENTRY cl_int
511(CL_API_CALL * clGetKernelSubGroupInfoKHR_fn)(cl_kernel /* in_kernel */,
512 cl_device_id /*in_device*/,
513 cl_kernel_sub_group_info /* param_name */,
514 size_t /*input_value_size*/,
515 const void * /*input_value*/,
516 size_t /*param_value_size*/,
517 void* /*param_value*/,
518 size_t* /*param_value_size_ret*/ ) CL_EXT_SUFFIX__VERSION_2_0_DEPRECATED;
519
520
Pablo Telloe86a09f2018-01-11 15:44:48 +0000521/*********************************
522* cl_khr_priority_hints extension
523*********************************/
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100524/* This extension define is for backwards compatibility.
525 It shouldn't be required since this extension has no new functions. */
Pablo Telloe86a09f2018-01-11 15:44:48 +0000526#define cl_khr_priority_hints 1
527
528typedef cl_uint cl_queue_priority_khr;
529
530/* cl_command_queue_properties */
531#define CL_QUEUE_PRIORITY_KHR 0x1096
532
533/* cl_queue_priority_khr */
534#define CL_QUEUE_PRIORITY_HIGH_KHR (1<<0)
535#define CL_QUEUE_PRIORITY_MED_KHR (1<<1)
536#define CL_QUEUE_PRIORITY_LOW_KHR (1<<2)
537
Pablo Telloe86a09f2018-01-11 15:44:48 +0000538
Pablo Telloe86a09f2018-01-11 15:44:48 +0000539/*********************************
540* cl_khr_throttle_hints extension
541*********************************/
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100542/* This extension define is for backwards compatibility.
543 It shouldn't be required since this extension has no new functions. */
Pablo Telloe86a09f2018-01-11 15:44:48 +0000544#define cl_khr_throttle_hints 1
545
546typedef cl_uint cl_queue_throttle_khr;
547
548/* cl_command_queue_properties */
549#define CL_QUEUE_THROTTLE_KHR 0x1097
550
551/* cl_queue_throttle_khr */
552#define CL_QUEUE_THROTTLE_HIGH_KHR (1<<0)
553#define CL_QUEUE_THROTTLE_MED_KHR (1<<1)
554#define CL_QUEUE_THROTTLE_LOW_KHR (1<<2)
555
Pablo Telloe86a09f2018-01-11 15:44:48 +0000556
Pablo Telloe86a09f2018-01-11 15:44:48 +0000557/*********************************
558* cl_khr_subgroup_named_barrier
559*********************************/
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100560/* This extension define is for backwards compatibility.
561 It shouldn't be required since this extension has no new functions. */
Pablo Telloe86a09f2018-01-11 15:44:48 +0000562#define cl_khr_subgroup_named_barrier 1
563
564/* cl_device_info */
565#define CL_DEVICE_MAX_NAMED_BARRIER_COUNT_KHR 0x2035
566
Pablo Telloe86a09f2018-01-11 15:44:48 +0000567
568/**********************************
569 * cl_arm_import_memory extension *
570 **********************************/
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100571#define cl_arm_import_memory 1
Pablo Telloe86a09f2018-01-11 15:44:48 +0000572
573typedef intptr_t cl_import_properties_arm;
574
575/* Default and valid proporties name for cl_arm_import_memory */
576#define CL_IMPORT_TYPE_ARM 0x40B2
577
578/* Host process memory type default value for CL_IMPORT_TYPE_ARM property */
579#define CL_IMPORT_TYPE_HOST_ARM 0x40B3
580
581/* DMA BUF memory type value for CL_IMPORT_TYPE_ARM property */
582#define CL_IMPORT_TYPE_DMA_BUF_ARM 0x40B4
583
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100584/* Protected DMA BUF memory type value for CL_IMPORT_TYPE_ARM property */
585#define CL_IMPORT_TYPE_PROTECTED_ARM 0x40B5
Pablo Telloe86a09f2018-01-11 15:44:48 +0000586
587/* This extension adds a new function that allows for direct memory import into
588 * OpenCL via the clImportMemoryARM function.
589 *
590 * Memory imported through this interface will be mapped into the device's page
591 * tables directly, providing zero copy access. It will never fall back to copy
592 * operations and aliased buffers.
593 *
594 * Types of memory supported for import are specified as additional extension
595 * strings.
596 *
597 * This extension produces cl_mem allocations which are compatible with all other
598 * users of cl_mem in the standard API.
599 *
600 * This extension maps pages with the same properties as the normal buffer creation
601 * function clCreateBuffer.
602 */
603extern CL_API_ENTRY cl_mem CL_API_CALL
604clImportMemoryARM( cl_context context,
605 cl_mem_flags flags,
606 const cl_import_properties_arm *properties,
607 void *memory,
608 size_t size,
609 cl_int *errcode_ret) CL_EXT_SUFFIX__VERSION_1_0;
610
611
Pablo Telloe86a09f2018-01-11 15:44:48 +0000612/******************************************
613 * cl_arm_shared_virtual_memory extension *
614 ******************************************/
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100615#define cl_arm_shared_virtual_memory 1
Pablo Telloe86a09f2018-01-11 15:44:48 +0000616
617/* Used by clGetDeviceInfo */
618#define CL_DEVICE_SVM_CAPABILITIES_ARM 0x40B6
619
620/* Used by clGetMemObjectInfo */
621#define CL_MEM_USES_SVM_POINTER_ARM 0x40B7
622
623/* Used by clSetKernelExecInfoARM: */
624#define CL_KERNEL_EXEC_INFO_SVM_PTRS_ARM 0x40B8
625#define CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM_ARM 0x40B9
626
627/* To be used by clGetEventInfo: */
628#define CL_COMMAND_SVM_FREE_ARM 0x40BA
629#define CL_COMMAND_SVM_MEMCPY_ARM 0x40BB
630#define CL_COMMAND_SVM_MEMFILL_ARM 0x40BC
631#define CL_COMMAND_SVM_MAP_ARM 0x40BD
632#define CL_COMMAND_SVM_UNMAP_ARM 0x40BE
633
634/* Flag values returned by clGetDeviceInfo with CL_DEVICE_SVM_CAPABILITIES_ARM as the param_name. */
635#define CL_DEVICE_SVM_COARSE_GRAIN_BUFFER_ARM (1 << 0)
636#define CL_DEVICE_SVM_FINE_GRAIN_BUFFER_ARM (1 << 1)
637#define CL_DEVICE_SVM_FINE_GRAIN_SYSTEM_ARM (1 << 2)
638#define CL_DEVICE_SVM_ATOMICS_ARM (1 << 3)
639
640/* Flag values used by clSVMAllocARM: */
641#define CL_MEM_SVM_FINE_GRAIN_BUFFER_ARM (1 << 10)
642#define CL_MEM_SVM_ATOMICS_ARM (1 << 11)
643
644typedef cl_bitfield cl_svm_mem_flags_arm;
645typedef cl_uint cl_kernel_exec_info_arm;
646typedef cl_bitfield cl_device_svm_capabilities_arm;
647
648extern CL_API_ENTRY void * CL_API_CALL
649clSVMAllocARM(cl_context /* context */,
650 cl_svm_mem_flags_arm /* flags */,
651 size_t /* size */,
652 cl_uint /* alignment */) CL_EXT_SUFFIX__VERSION_1_2;
653
654extern CL_API_ENTRY void CL_API_CALL
655clSVMFreeARM(cl_context /* context */,
656 void * /* svm_pointer */) CL_EXT_SUFFIX__VERSION_1_2;
657
658extern CL_API_ENTRY cl_int CL_API_CALL
659clEnqueueSVMFreeARM(cl_command_queue /* command_queue */,
660 cl_uint /* num_svm_pointers */,
661 void *[] /* svm_pointers[] */,
662 void (CL_CALLBACK * /*pfn_free_func*/)(cl_command_queue /* queue */,
663 cl_uint /* num_svm_pointers */,
664 void *[] /* svm_pointers[] */,
665 void * /* user_data */),
666 void * /* user_data */,
667 cl_uint /* num_events_in_wait_list */,
668 const cl_event * /* event_wait_list */,
669 cl_event * /* event */) CL_EXT_SUFFIX__VERSION_1_2;
670
671extern CL_API_ENTRY cl_int CL_API_CALL
672clEnqueueSVMMemcpyARM(cl_command_queue /* command_queue */,
673 cl_bool /* blocking_copy */,
674 void * /* dst_ptr */,
675 const void * /* src_ptr */,
676 size_t /* size */,
677 cl_uint /* num_events_in_wait_list */,
678 const cl_event * /* event_wait_list */,
679 cl_event * /* event */) CL_EXT_SUFFIX__VERSION_1_2;
680
681extern CL_API_ENTRY cl_int CL_API_CALL
682clEnqueueSVMMemFillARM(cl_command_queue /* command_queue */,
683 void * /* svm_ptr */,
684 const void * /* pattern */,
685 size_t /* pattern_size */,
686 size_t /* size */,
687 cl_uint /* num_events_in_wait_list */,
688 const cl_event * /* event_wait_list */,
689 cl_event * /* event */) CL_EXT_SUFFIX__VERSION_1_2;
690
691extern CL_API_ENTRY cl_int CL_API_CALL
692clEnqueueSVMMapARM(cl_command_queue /* command_queue */,
693 cl_bool /* blocking_map */,
694 cl_map_flags /* flags */,
695 void * /* svm_ptr */,
696 size_t /* size */,
697 cl_uint /* num_events_in_wait_list */,
698 const cl_event * /* event_wait_list */,
699 cl_event * /* event */) CL_EXT_SUFFIX__VERSION_1_2;
700
701extern CL_API_ENTRY cl_int CL_API_CALL
702clEnqueueSVMUnmapARM(cl_command_queue /* command_queue */,
703 void * /* svm_ptr */,
704 cl_uint /* num_events_in_wait_list */,
705 const cl_event * /* event_wait_list */,
706 cl_event * /* event */) CL_EXT_SUFFIX__VERSION_1_2;
707
708extern CL_API_ENTRY cl_int CL_API_CALL
709clSetKernelArgSVMPointerARM(cl_kernel /* kernel */,
710 cl_uint /* arg_index */,
711 const void * /* arg_value */) CL_EXT_SUFFIX__VERSION_1_2;
712extern CL_API_ENTRY cl_int CL_API_CALL
713clSetKernelExecInfoARM(cl_kernel /* kernel */,
714 cl_kernel_exec_info_arm /* param_name */,
715 size_t /* param_value_size */,
716 const void * /* param_value */) CL_EXT_SUFFIX__VERSION_1_2;
717
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100718#ifdef __cplusplus
719}
720#endif
721
722
723#endif /* __CL_EXT_H */