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 24 extern "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 57 cl_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 71 extern 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 */ 77 extern 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 */ 83 extern 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 100 extern CL_API_ENTRY cl_int CL_API_CALL 101 clIcdGetPlatformIDsKHR(cl_uint num_entries, 102 cl_platform_id * platforms, 103 cl_uint * num_platforms); 104 105 typedef 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 126 extern CL_API_ENTRY cl_program CL_API_CALL 127 clCreateProgramWithILKHR(cl_context context, 128 const void * il, 129 size_t length, 130 cl_int * errcode_ret); 131 132 typedef 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 178 extern CL_API_ENTRY cl_int CL_API_CALL 179 clTerminateContextKHR(cl_context context) CL_EXT_SUFFIX__VERSION_1_2; 180 181 typedef 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 201 typedef cl_properties cl_queue_properties_khr; 202 203 extern CL_API_ENTRY cl_command_queue CL_API_CALL 204 clCreateCommandQueueWithPropertiesKHR(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 209 typedef 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 270 extern CL_API_ENTRY cl_int CL_API_CALL 271 clReleaseDeviceEXT(cl_device_id device) CL_EXT_SUFFIX__VERSION_1_1; 272 273 typedef CL_API_ENTRY cl_int 274 (CL_API_CALL *clReleaseDeviceEXT_fn)(cl_device_id device) CL_EXT_SUFFIX__VERSION_1_1; 275 276 extern CL_API_ENTRY cl_int CL_API_CALL 277 clRetainDeviceEXT(cl_device_id device) CL_EXT_SUFFIX__VERSION_1_1; 278 279 typedef CL_API_ENTRY cl_int 280 (CL_API_CALL *clRetainDeviceEXT_fn)(cl_device_id device) CL_EXT_SUFFIX__VERSION_1_1; 281 282 typedef cl_ulong cl_device_partition_property_ext; 283 extern CL_API_ENTRY cl_int CL_API_CALL 284 clCreateSubDevicesEXT(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 290 typedef 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 334 typedef 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 340 extern CL_API_ENTRY cl_int CL_API_CALL 341 clEnqueueMigrateMemObjectEXT(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 349 typedef 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 382 typedef cl_uint cl_image_pitch_info_qcom; 383 384 extern CL_API_ENTRY cl_int CL_API_CALL 385 clGetDeviceImageInfoQCOM(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 394 typedef 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 420 typedef 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 441 typedef 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 codes from clEnqueueAcquireGrallocObjectsIMG and clEnqueueReleaseGrallocObjectsIMG */ 484 #define CL_GRALLOC_RESOURCE_NOT_ACQUIRED_IMG 0x40D4 485 #define CL_INVALID_GRALLOC_OBJECT_IMG 0x40D5 486 487 extern CL_API_ENTRY cl_int CL_API_CALL 488 clEnqueueAcquireGrallocObjectsIMG(cl_command_queue command_queue, 489 cl_uint num_objects, 490 const cl_mem * mem_objects, 491 cl_uint num_events_in_wait_list, 492 const cl_event * event_wait_list, 493 cl_event * event) CL_EXT_SUFFIX__VERSION_1_2; 494 495 extern CL_API_ENTRY cl_int CL_API_CALL 496 clEnqueueReleaseGrallocObjectsIMG(cl_command_queue command_queue, 497 cl_uint num_objects, 498 const cl_mem * mem_objects, 499 cl_uint num_events_in_wait_list, 500 const cl_event * event_wait_list, 501 cl_event * event) CL_EXT_SUFFIX__VERSION_1_2; 502 503 /****************************************** 504 * cl_img_generate_mipmap extension * 505 ******************************************/ 506 #define cl_img_generate_mipmap 1 507 508 typedef cl_uint cl_mipmap_filter_mode_img; 509 510 /* To be used by clEnqueueGenerateMipmapIMG */ 511 #define CL_MIPMAP_FILTER_ANY_IMG 0x0 512 #define CL_MIPMAP_FILTER_BOX_IMG 0x1 513 514 /* To be used by clGetEventInfo */ 515 #define CL_COMMAND_GENERATE_MIPMAP_IMG 0x40D6 516 517 extern CL_API_ENTRY cl_int CL_API_CALL 518 clEnqueueGenerateMipmapIMG(cl_command_queue command_queue, 519 cl_mem src_image, 520 cl_mem dst_image, 521 cl_mipmap_filter_mode_img mipmap_filter_mode, 522 const size_t *array_region, 523 const size_t *mip_region, 524 cl_uint num_events_in_wait_list, 525 const cl_event *event_wait_list, 526 cl_event *event) CL_EXT_SUFFIX__VERSION_1_2; 527 528 /****************************************** 529 * cl_img_mem_properties extension * 530 ******************************************/ 531 #define cl_img_mem_properties 1 532 533 /* To be used by clCreateBufferWithProperties */ 534 #define CL_MEM_ALLOC_FLAGS_IMG 0x40D7 535 536 /* To be used wiith the CL_MEM_ALLOC_FLAGS_IMG property */ 537 typedef cl_bitfield cl_mem_alloc_flags_img; 538 539 /* To be used with cl_mem_alloc_flags_img */ 540 #define CL_MEM_ALLOC_RELAX_REQUIREMENTS_IMG (1 << 0) 541 542 /********************************* 543 * cl_khr_subgroups extension 544 *********************************/ 545 #define cl_khr_subgroups 1 546 547 #if !defined(CL_VERSION_2_1) 548 /* For OpenCL 2.1 and newer, cl_kernel_sub_group_info is declared in CL.h. 549 In hindsight, there should have been a khr suffix on this type for 550 the extension, but keeping it un-suffixed to maintain backwards 551 compatibility. */ 552 typedef cl_uint cl_kernel_sub_group_info; 553 #endif 554 555 /* cl_kernel_sub_group_info */ 556 #define CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE_KHR 0x2033 557 #define CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE_KHR 0x2034 558 559 extern CL_API_ENTRY cl_int CL_API_CALL 560 clGetKernelSubGroupInfoKHR(cl_kernel in_kernel, 561 cl_device_id in_device, 562 cl_kernel_sub_group_info param_name, 563 size_t input_value_size, 564 const void * input_value, 565 size_t param_value_size, 566 void * param_value, 567 size_t * param_value_size_ret) CL_EXT_SUFFIX__VERSION_2_0_DEPRECATED; 568 569 typedef CL_API_ENTRY cl_int 570 (CL_API_CALL * clGetKernelSubGroupInfoKHR_fn)(cl_kernel in_kernel, 571 cl_device_id in_device, 572 cl_kernel_sub_group_info param_name, 573 size_t input_value_size, 574 const void * input_value, 575 size_t param_value_size, 576 void * param_value, 577 size_t * param_value_size_ret) CL_EXT_SUFFIX__VERSION_2_0_DEPRECATED; 578 579 580 /********************************* 581 * cl_khr_mipmap_image extension 582 *********************************/ 583 584 /* cl_sampler_properties */ 585 #define CL_SAMPLER_MIP_FILTER_MODE_KHR 0x1155 586 #define CL_SAMPLER_LOD_MIN_KHR 0x1156 587 #define CL_SAMPLER_LOD_MAX_KHR 0x1157 588 589 590 /********************************* 591 * cl_khr_priority_hints extension 592 *********************************/ 593 /* This extension define is for backwards compatibility. 594 It shouldn't be required since this extension has no new functions. */ 595 #define cl_khr_priority_hints 1 596 597 typedef cl_uint cl_queue_priority_khr; 598 599 /* cl_command_queue_properties */ 600 #define CL_QUEUE_PRIORITY_KHR 0x1096 601 602 /* cl_queue_priority_khr */ 603 #define CL_QUEUE_PRIORITY_HIGH_KHR (1<<0) 604 #define CL_QUEUE_PRIORITY_MED_KHR (1<<1) 605 #define CL_QUEUE_PRIORITY_LOW_KHR (1<<2) 606 607 608 /********************************* 609 * cl_khr_throttle_hints extension 610 *********************************/ 611 /* This extension define is for backwards compatibility. 612 It shouldn't be required since this extension has no new functions. */ 613 #define cl_khr_throttle_hints 1 614 615 typedef cl_uint cl_queue_throttle_khr; 616 617 /* cl_command_queue_properties */ 618 #define CL_QUEUE_THROTTLE_KHR 0x1097 619 620 /* cl_queue_throttle_khr */ 621 #define CL_QUEUE_THROTTLE_HIGH_KHR (1<<0) 622 #define CL_QUEUE_THROTTLE_MED_KHR (1<<1) 623 #define CL_QUEUE_THROTTLE_LOW_KHR (1<<2) 624 625 626 /********************************* 627 * cl_khr_subgroup_named_barrier 628 *********************************/ 629 /* This extension define is for backwards compatibility. 630 It shouldn't be required since this extension has no new functions. */ 631 #define cl_khr_subgroup_named_barrier 1 632 633 /* cl_device_info */ 634 #define CL_DEVICE_MAX_NAMED_BARRIER_COUNT_KHR 0x2035 635 636 637 /********************************* 638 * cl_khr_extended_versioning 639 *********************************/ 640 641 #define cl_khr_extended_versioning 1 642 643 #define CL_VERSION_MAJOR_BITS_KHR (10) 644 #define CL_VERSION_MINOR_BITS_KHR (10) 645 #define CL_VERSION_PATCH_BITS_KHR (12) 646 647 #define CL_VERSION_MAJOR_MASK_KHR ((1 << CL_VERSION_MAJOR_BITS_KHR) - 1) 648 #define CL_VERSION_MINOR_MASK_KHR ((1 << CL_VERSION_MINOR_BITS_KHR) - 1) 649 #define CL_VERSION_PATCH_MASK_KHR ((1 << CL_VERSION_PATCH_BITS_KHR) - 1) 650 651 #define CL_VERSION_MAJOR_KHR(version) ((version) >> (CL_VERSION_MINOR_BITS_KHR + CL_VERSION_PATCH_BITS_KHR)) 652 #define CL_VERSION_MINOR_KHR(version) (((version) >> CL_VERSION_PATCH_BITS_KHR) & CL_VERSION_MINOR_MASK_KHR) 653 #define CL_VERSION_PATCH_KHR(version) ((version) & CL_VERSION_PATCH_MASK_KHR) 654 655 #define CL_MAKE_VERSION_KHR(major, minor, patch) \ 656 ((((major) & CL_VERSION_MAJOR_MASK_KHR) << (CL_VERSION_MINOR_BITS_KHR + CL_VERSION_PATCH_BITS_KHR)) | \ 657 (((minor) & CL_VERSION_MINOR_MASK_KHR) << CL_VERSION_PATCH_BITS_KHR) | \ 658 ((patch) & CL_VERSION_PATCH_MASK_KHR)) 659 660 typedef cl_uint cl_version_khr; 661 662 #define CL_NAME_VERSION_MAX_NAME_SIZE_KHR 64 663 664 typedef struct _cl_name_version_khr 665 { 666 cl_version_khr version; 667 char name[CL_NAME_VERSION_MAX_NAME_SIZE_KHR]; 668 } cl_name_version_khr; 669 670 /* cl_platform_info */ 671 #define CL_PLATFORM_NUMERIC_VERSION_KHR 0x0906 672 #define CL_PLATFORM_EXTENSIONS_WITH_VERSION_KHR 0x0907 673 674 /* cl_device_info */ 675 #define CL_DEVICE_NUMERIC_VERSION_KHR 0x105E 676 #define CL_DEVICE_OPENCL_C_NUMERIC_VERSION_KHR 0x105F 677 #define CL_DEVICE_EXTENSIONS_WITH_VERSION_KHR 0x1060 678 #define CL_DEVICE_ILS_WITH_VERSION_KHR 0x1061 679 #define CL_DEVICE_BUILT_IN_KERNELS_WITH_VERSION_KHR 0x1062 680 681 682 /********************************* 683 * cl_khr_device_uuid extension 684 *********************************/ 685 #define cl_khr_device_uuid 1 686 687 #define CL_UUID_SIZE_KHR 16 688 #define CL_LUID_SIZE_KHR 8 689 690 #define CL_DEVICE_UUID_KHR 0x106A 691 #define CL_DRIVER_UUID_KHR 0x106B 692 #define CL_DEVICE_LUID_VALID_KHR 0x106C 693 #define CL_DEVICE_LUID_KHR 0x106D 694 #define CL_DEVICE_NODE_MASK_KHR 0x106E 695 696 697 /********************************** 698 * cl_arm_import_memory extension * 699 **********************************/ 700 #define cl_arm_import_memory 1 701 702 typedef intptr_t cl_import_properties_arm; 703 704 /* Default and valid proporties name for cl_arm_import_memory */ 705 #define CL_IMPORT_TYPE_ARM 0x40B2 706 707 /* Host process memory type default value for CL_IMPORT_TYPE_ARM property */ 708 #define CL_IMPORT_TYPE_HOST_ARM 0x40B3 709 710 /* DMA BUF memory type value for CL_IMPORT_TYPE_ARM property */ 711 #define CL_IMPORT_TYPE_DMA_BUF_ARM 0x40B4 712 713 /* Protected memory property */ 714 #define CL_IMPORT_TYPE_PROTECTED_ARM 0x40B5 715 716 /* Android hardware buffer type value for CL_IMPORT_TYPE_ARM property */ 717 #define CL_IMPORT_TYPE_ANDROID_HARDWARE_BUFFER_ARM 0x41E2 718 719 /* Data consistency with host property */ 720 #define CL_IMPORT_DMA_BUF_DATA_CONSISTENCY_WITH_HOST_ARM 0x41E3 721 722 /* Import memory size value to indicate a size for the whole buffer */ 723 #define CL_IMPORT_MEMORY_WHOLE_ALLOCATION_ARM SIZE_MAX 724 725 /* This extension adds a new function that allows for direct memory import into 726 * OpenCL via the clImportMemoryARM function. 727 * 728 * Memory imported through this interface will be mapped into the device's page 729 * tables directly, providing zero copy access. It will never fall back to copy 730 * operations and aliased buffers. 731 * 732 * Types of memory supported for import are specified as additional extension 733 * strings. 734 * 735 * This extension produces cl_mem allocations which are compatible with all other 736 * users of cl_mem in the standard API. 737 * 738 * This extension maps pages with the same properties as the normal buffer creation 739 * function clCreateBuffer. 740 */ 741 extern CL_API_ENTRY cl_mem CL_API_CALL 742 clImportMemoryARM( cl_context context, 743 cl_mem_flags flags, 744 const cl_import_properties_arm *properties, 745 void *memory, 746 size_t size, 747 cl_int *errcode_ret) CL_EXT_SUFFIX__VERSION_1_0; 748 749 750 /****************************************** 751 * cl_arm_shared_virtual_memory extension * 752 ******************************************/ 753 #define cl_arm_shared_virtual_memory 1 754 755 /* Used by clGetDeviceInfo */ 756 #define CL_DEVICE_SVM_CAPABILITIES_ARM 0x40B6 757 758 /* Used by clGetMemObjectInfo */ 759 #define CL_MEM_USES_SVM_POINTER_ARM 0x40B7 760 761 /* Used by clSetKernelExecInfoARM: */ 762 #define CL_KERNEL_EXEC_INFO_SVM_PTRS_ARM 0x40B8 763 #define CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM_ARM 0x40B9 764 765 /* To be used by clGetEventInfo: */ 766 #define CL_COMMAND_SVM_FREE_ARM 0x40BA 767 #define CL_COMMAND_SVM_MEMCPY_ARM 0x40BB 768 #define CL_COMMAND_SVM_MEMFILL_ARM 0x40BC 769 #define CL_COMMAND_SVM_MAP_ARM 0x40BD 770 #define CL_COMMAND_SVM_UNMAP_ARM 0x40BE 771 772 /* Flag values returned by clGetDeviceInfo with CL_DEVICE_SVM_CAPABILITIES_ARM as the param_name. */ 773 #define CL_DEVICE_SVM_COARSE_GRAIN_BUFFER_ARM (1 << 0) 774 #define CL_DEVICE_SVM_FINE_GRAIN_BUFFER_ARM (1 << 1) 775 #define CL_DEVICE_SVM_FINE_GRAIN_SYSTEM_ARM (1 << 2) 776 #define CL_DEVICE_SVM_ATOMICS_ARM (1 << 3) 777 778 /* Flag values used by clSVMAllocARM: */ 779 #define CL_MEM_SVM_FINE_GRAIN_BUFFER_ARM (1 << 10) 780 #define CL_MEM_SVM_ATOMICS_ARM (1 << 11) 781 782 typedef cl_bitfield cl_svm_mem_flags_arm; 783 typedef cl_uint cl_kernel_exec_info_arm; 784 typedef cl_bitfield cl_device_svm_capabilities_arm; 785 786 extern CL_API_ENTRY void * CL_API_CALL 787 clSVMAllocARM(cl_context context, 788 cl_svm_mem_flags_arm flags, 789 size_t size, 790 cl_uint alignment) CL_EXT_SUFFIX__VERSION_1_2; 791 792 extern CL_API_ENTRY void CL_API_CALL 793 clSVMFreeARM(cl_context context, 794 void * svm_pointer) CL_EXT_SUFFIX__VERSION_1_2; 795 796 extern CL_API_ENTRY cl_int CL_API_CALL 797 clEnqueueSVMFreeARM(cl_command_queue command_queue, 798 cl_uint num_svm_pointers, 799 void * svm_pointers[], 800 void (CL_CALLBACK * pfn_free_func)(cl_command_queue queue, 801 cl_uint num_svm_pointers, 802 void * svm_pointers[], 803 void * user_data), 804 void * user_data, 805 cl_uint num_events_in_wait_list, 806 const cl_event * event_wait_list, 807 cl_event * event) CL_EXT_SUFFIX__VERSION_1_2; 808 809 extern CL_API_ENTRY cl_int CL_API_CALL 810 clEnqueueSVMMemcpyARM(cl_command_queue command_queue, 811 cl_bool blocking_copy, 812 void * dst_ptr, 813 const void * src_ptr, 814 size_t size, 815 cl_uint num_events_in_wait_list, 816 const cl_event * event_wait_list, 817 cl_event * event) CL_EXT_SUFFIX__VERSION_1_2; 818 819 extern CL_API_ENTRY cl_int CL_API_CALL 820 clEnqueueSVMMemFillARM(cl_command_queue command_queue, 821 void * svm_ptr, 822 const void * pattern, 823 size_t pattern_size, 824 size_t size, 825 cl_uint num_events_in_wait_list, 826 const cl_event * event_wait_list, 827 cl_event * event) CL_EXT_SUFFIX__VERSION_1_2; 828 829 extern CL_API_ENTRY cl_int CL_API_CALL 830 clEnqueueSVMMapARM(cl_command_queue command_queue, 831 cl_bool blocking_map, 832 cl_map_flags flags, 833 void * svm_ptr, 834 size_t size, 835 cl_uint num_events_in_wait_list, 836 const cl_event * event_wait_list, 837 cl_event * event) CL_EXT_SUFFIX__VERSION_1_2; 838 839 extern CL_API_ENTRY cl_int CL_API_CALL 840 clEnqueueSVMUnmapARM(cl_command_queue command_queue, 841 void * svm_ptr, 842 cl_uint num_events_in_wait_list, 843 const cl_event * event_wait_list, 844 cl_event * event) CL_EXT_SUFFIX__VERSION_1_2; 845 846 extern CL_API_ENTRY cl_int CL_API_CALL 847 clSetKernelArgSVMPointerARM(cl_kernel kernel, 848 cl_uint arg_index, 849 const void * arg_value) CL_EXT_SUFFIX__VERSION_1_2; 850 851 extern CL_API_ENTRY cl_int CL_API_CALL 852 clSetKernelExecInfoARM(cl_kernel kernel, 853 cl_kernel_exec_info_arm param_name, 854 size_t param_value_size, 855 const void * param_value) CL_EXT_SUFFIX__VERSION_1_2; 856 857 /******************************** 858 * cl_arm_get_core_id extension * 859 ********************************/ 860 861 #ifdef CL_VERSION_1_2 862 863 #define cl_arm_get_core_id 1 864 865 /* Device info property for bitfield of cores present */ 866 #define CL_DEVICE_COMPUTE_UNITS_BITFIELD_ARM 0x40BF 867 868 #endif /* CL_VERSION_1_2 */ 869 870 /********************************* 871 * cl_arm_job_slot_selection 872 *********************************/ 873 874 #define cl_arm_job_slot_selection 1 875 876 /* cl_device_info */ 877 #define CL_DEVICE_JOB_SLOTS_ARM 0x41E0 878 879 /* cl_command_queue_properties */ 880 #define CL_QUEUE_JOB_SLOT_ARM 0x41E1 881 882 /********************************* 883 * cl_arm_scheduling_controls 884 *********************************/ 885 886 #define cl_arm_scheduling_controls 1 887 888 /* cl_device_info */ 889 #define CL_DEVICE_SCHEDULING_CONTROLS_CAPABILITIES_ARM 0x41E4 890 891 #define CL_DEVICE_SCHEDULING_KERNEL_BATCHING_ARM (1 << 0) 892 #define CL_DEVICE_SCHEDULING_WORKGROUP_BATCH_SIZE_ARM (1 << 1) 893 #define CL_DEVICE_SCHEDULING_WORKGROUP_BATCH_SIZE_MODIFIER_ARM (1 << 2) 894 895 /* cl_kernel_info */ 896 #define CL_KERNEL_EXEC_INFO_WORKGROUP_BATCH_SIZE_ARM 0x41E5 897 #define CL_KERNEL_EXEC_INFO_WORKGROUP_BATCH_SIZE_MODIFIER_ARM 0x41E6 898 899 /* cl_queue_properties */ 900 #define CL_QUEUE_KERNEL_BATCHING_ARM 0x41E7 901 902 #ifdef __cplusplus 903 } 904 #endif 905 906 907 #endif /* __CL_EXT_H */ 908