1848b8605Smrg/******************************************************************************* 2b8e80941Smrg * Copyright (c) 2008-2019 The Khronos Group Inc. 3848b8605Smrg * 4848b8605Smrg * Permission is hereby granted, free of charge, to any person obtaining a 5848b8605Smrg * copy of this software and/or associated documentation files (the 6848b8605Smrg * "Materials"), to deal in the Materials without restriction, including 7848b8605Smrg * without limitation the rights to use, copy, modify, merge, publish, 8848b8605Smrg * distribute, sublicense, and/or sell copies of the Materials, and to 9848b8605Smrg * permit persons to whom the Materials are furnished to do so, subject to 10848b8605Smrg * the following conditions: 11848b8605Smrg * 12848b8605Smrg * The above copyright notice and this permission notice shall be included 13848b8605Smrg * in all copies or substantial portions of the Materials. 14848b8605Smrg * 15b8e80941Smrg * MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS 16b8e80941Smrg * KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS 17b8e80941Smrg * SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT 18b8e80941Smrg * https://www.khronos.org/registry/ 19b8e80941Smrg * 20848b8605Smrg * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21848b8605Smrg * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22848b8605Smrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 23848b8605Smrg * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 24848b8605Smrg * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 25848b8605Smrg * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 26848b8605Smrg * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. 27848b8605Smrg ******************************************************************************/ 28848b8605Smrg 29848b8605Smrg/* cl_ext.h contains OpenCL extensions which don't have external */ 30848b8605Smrg/* (OpenGL, D3D) dependencies. */ 31848b8605Smrg 32848b8605Smrg#ifndef __CL_EXT_H 33848b8605Smrg#define __CL_EXT_H 34848b8605Smrg 35848b8605Smrg#ifdef __cplusplus 36848b8605Smrgextern "C" { 37848b8605Smrg#endif 38848b8605Smrg 39b8e80941Smrg#include <CL/cl.h> 40b8e80941Smrg 41b8e80941Smrg/* cl_khr_fp64 extension - no extension #define since it has no functions */ 42b8e80941Smrg/* CL_DEVICE_DOUBLE_FP_CONFIG is defined in CL.h for OpenCL >= 120 */ 43b8e80941Smrg 44b8e80941Smrg#if CL_TARGET_OPENCL_VERSION <= 110 45b8e80941Smrg#define CL_DEVICE_DOUBLE_FP_CONFIG 0x1032 46848b8605Smrg#endif 47848b8605Smrg 48848b8605Smrg/* cl_khr_fp16 extension - no extension #define since it has no functions */ 49848b8605Smrg#define CL_DEVICE_HALF_FP_CONFIG 0x1033 50848b8605Smrg 51848b8605Smrg/* Memory object destruction 52848b8605Smrg * 53848b8605Smrg * Apple extension for use to manage externally allocated buffers used with cl_mem objects with CL_MEM_USE_HOST_PTR 54848b8605Smrg * 55b8e80941Smrg * Registers a user callback function that will be called when the memory object is deleted and its resources 56b8e80941Smrg * freed. Each call to clSetMemObjectCallbackFn registers the specified user callback function on a callback 57b8e80941Smrg * stack associated with memobj. The registered user callback functions are called in the reverse order in 58b8e80941Smrg * which they were registered. The user callback functions are called and then the memory object is deleted 59b8e80941Smrg * and its resources freed. This provides a mechanism for the application (and libraries) using memobj to be 60b8e80941Smrg * notified when the memory referenced by host_ptr, specified when the memory object is created and used as 61848b8605Smrg * the storage bits for the memory object, can be reused or freed. 62848b8605Smrg * 63848b8605Smrg * The application may not call CL api's with the cl_mem object passed to the pfn_notify. 64848b8605Smrg * 65848b8605Smrg * Please check for the "cl_APPLE_SetMemObjectDestructor" extension using clGetDeviceInfo(CL_DEVICE_EXTENSIONS) 66848b8605Smrg * before using. 67848b8605Smrg */ 68848b8605Smrg#define cl_APPLE_SetMemObjectDestructor 1 69b8e80941Smrgcl_int CL_API_ENTRY clSetMemObjectDestructorAPPLE( cl_mem memobj, 70b8e80941Smrg void (* pfn_notify)(cl_mem memobj, void * user_data), 71b8e80941Smrg void * user_data) CL_EXT_SUFFIX__VERSION_1_0; 72848b8605Smrg 73848b8605Smrg 74848b8605Smrg/* Context Logging Functions 75848b8605Smrg * 76848b8605Smrg * The next three convenience functions are intended to be used as the pfn_notify parameter to clCreateContext(). 77848b8605Smrg * Please check for the "cl_APPLE_ContextLoggingFunctions" extension using clGetDeviceInfo(CL_DEVICE_EXTENSIONS) 78848b8605Smrg * before using. 79848b8605Smrg * 80b8e80941Smrg * clLogMessagesToSystemLog forwards on all log messages to the Apple System Logger 81848b8605Smrg */ 82848b8605Smrg#define cl_APPLE_ContextLoggingFunctions 1 83b8e80941Smrgextern void CL_API_ENTRY clLogMessagesToSystemLogAPPLE( const char * errstr, 84b8e80941Smrg const void * private_info, 85b8e80941Smrg size_t cb, 86b8e80941Smrg void * user_data) CL_EXT_SUFFIX__VERSION_1_0; 87848b8605Smrg 88848b8605Smrg/* clLogMessagesToStdout sends all log messages to the file descriptor stdout */ 89b8e80941Smrgextern void CL_API_ENTRY clLogMessagesToStdoutAPPLE( const char * errstr, 90b8e80941Smrg const void * private_info, 91b8e80941Smrg size_t cb, 92b8e80941Smrg void * user_data) CL_EXT_SUFFIX__VERSION_1_0; 93848b8605Smrg 94848b8605Smrg/* clLogMessagesToStderr sends all log messages to the file descriptor stderr */ 95b8e80941Smrgextern void CL_API_ENTRY clLogMessagesToStderrAPPLE( const char * errstr, 96b8e80941Smrg const void * private_info, 97b8e80941Smrg size_t cb, 98b8e80941Smrg void * user_data) CL_EXT_SUFFIX__VERSION_1_0; 99848b8605Smrg 100848b8605Smrg 101b8e80941Smrg/************************ 102b8e80941Smrg* cl_khr_icd extension * 103848b8605Smrg************************/ 104848b8605Smrg#define cl_khr_icd 1 105848b8605Smrg 106848b8605Smrg/* cl_platform_info */ 107848b8605Smrg#define CL_PLATFORM_ICD_SUFFIX_KHR 0x0920 108848b8605Smrg 109848b8605Smrg/* Additional Error Codes */ 110848b8605Smrg#define CL_PLATFORM_NOT_FOUND_KHR -1001 111848b8605Smrg 112848b8605Smrgextern CL_API_ENTRY cl_int CL_API_CALL 113b8e80941SmrgclIcdGetPlatformIDsKHR(cl_uint num_entries, 114b8e80941Smrg cl_platform_id * platforms, 115b8e80941Smrg cl_uint * num_platforms); 116b8e80941Smrg 117b8e80941Smrgtypedef CL_API_ENTRY cl_int 118b8e80941Smrg(CL_API_CALL *clIcdGetPlatformIDsKHR_fn)(cl_uint num_entries, 119b8e80941Smrg cl_platform_id * platforms, 120b8e80941Smrg cl_uint * num_platforms); 121b8e80941Smrg 122b8e80941Smrg 123b8e80941Smrg/******************************* 124b8e80941Smrg * cl_khr_il_program extension * 125b8e80941Smrg *******************************/ 126b8e80941Smrg#define cl_khr_il_program 1 127b8e80941Smrg 128b8e80941Smrg/* New property to clGetDeviceInfo for retrieving supported intermediate 129b8e80941Smrg * languages 130b8e80941Smrg */ 131b8e80941Smrg#define CL_DEVICE_IL_VERSION_KHR 0x105B 132848b8605Smrg 133b8e80941Smrg/* New property to clGetProgramInfo for retrieving for retrieving the IL of a 134b8e80941Smrg * program 135b8e80941Smrg */ 136b8e80941Smrg#define CL_PROGRAM_IL_KHR 0x1169 137b8e80941Smrg 138b8e80941Smrgextern CL_API_ENTRY cl_program CL_API_CALL 139b8e80941SmrgclCreateProgramWithILKHR(cl_context context, 140b8e80941Smrg const void * il, 141b8e80941Smrg size_t length, 142b8e80941Smrg cl_int * errcode_ret); 143848b8605Smrg 144b8e80941Smrgtypedef CL_API_ENTRY cl_program 145b8e80941Smrg(CL_API_CALL *clCreateProgramWithILKHR_fn)(cl_context context, 146b8e80941Smrg const void * il, 147b8e80941Smrg size_t length, 148b8e80941Smrg cl_int * errcode_ret) CL_EXT_SUFFIX__VERSION_1_2; 149848b8605Smrg 150848b8605Smrg/* Extension: cl_khr_image2D_buffer 151848b8605Smrg * 152848b8605Smrg * This extension allows a 2D image to be created from a cl_mem buffer without a copy. 153848b8605Smrg * The type associated with a 2D image created from a buffer in an OpenCL program is image2d_t. 154848b8605Smrg * Both the sampler and sampler-less read_image built-in functions are supported for 2D images 155848b8605Smrg * and 2D images created from a buffer. Similarly, the write_image built-ins are also supported 156848b8605Smrg * for 2D images created from a buffer. 157848b8605Smrg * 158848b8605Smrg * When the 2D image from buffer is created, the client must specify the width, 159848b8605Smrg * height, image format (i.e. channel order and channel data type) and optionally the row pitch 160848b8605Smrg * 161848b8605Smrg * The pitch specified must be a multiple of CL_DEVICE_IMAGE_PITCH_ALIGNMENT pixels. 162848b8605Smrg * The base address of the buffer must be aligned to CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT pixels. 163848b8605Smrg */ 164b8e80941Smrg 165b8e80941Smrg/************************************** 166b8e80941Smrg * cl_khr_initialize_memory extension * 167b8e80941Smrg **************************************/ 168b8e80941Smrg 169b8e80941Smrg#define CL_CONTEXT_MEMORY_INITIALIZE_KHR 0x2030 170b8e80941Smrg 171b8e80941Smrg 172848b8605Smrg/************************************** 173848b8605Smrg * cl_khr_terminate_context extension * 174848b8605Smrg **************************************/ 175b8e80941Smrg 176b8e80941Smrg#define CL_DEVICE_TERMINATE_CAPABILITY_KHR 0x2031 177b8e80941Smrg#define CL_CONTEXT_TERMINATE_KHR 0x2032 178848b8605Smrg 179848b8605Smrg#define cl_khr_terminate_context 1 180b8e80941Smrgextern CL_API_ENTRY cl_int CL_API_CALL 181b8e80941SmrgclTerminateContextKHR(cl_context context) CL_EXT_SUFFIX__VERSION_1_2; 182b8e80941Smrg 183b8e80941Smrgtypedef CL_API_ENTRY cl_int 184b8e80941Smrg(CL_API_CALL *clTerminateContextKHR_fn)(cl_context context) CL_EXT_SUFFIX__VERSION_1_2; 185b8e80941Smrg 186848b8605Smrg 187848b8605Smrg/* 188848b8605Smrg * Extension: cl_khr_spir 189848b8605Smrg * 190b8e80941Smrg * This extension adds support to create an OpenCL program object from a 191848b8605Smrg * Standard Portable Intermediate Representation (SPIR) instance 192848b8605Smrg */ 193848b8605Smrg 194848b8605Smrg#define CL_DEVICE_SPIR_VERSIONS 0x40E0 195848b8605Smrg#define CL_PROGRAM_BINARY_TYPE_INTERMEDIATE 0x40E1 196848b8605Smrg 197848b8605Smrg 198b8e80941Smrg/***************************************** 199b8e80941Smrg * cl_khr_create_command_queue extension * 200b8e80941Smrg *****************************************/ 201b8e80941Smrg#define cl_khr_create_command_queue 1 202b8e80941Smrg 203b8e80941Smrgtypedef cl_bitfield cl_queue_properties_khr; 204b8e80941Smrg 205b8e80941Smrgextern CL_API_ENTRY cl_command_queue CL_API_CALL 206b8e80941SmrgclCreateCommandQueueWithPropertiesKHR(cl_context context, 207b8e80941Smrg cl_device_id device, 208b8e80941Smrg const cl_queue_properties_khr* properties, 209b8e80941Smrg cl_int* errcode_ret) CL_EXT_SUFFIX__VERSION_1_2; 210b8e80941Smrg 211b8e80941Smrgtypedef CL_API_ENTRY cl_command_queue 212b8e80941Smrg(CL_API_CALL *clCreateCommandQueueWithPropertiesKHR_fn)(cl_context context, 213b8e80941Smrg cl_device_id device, 214b8e80941Smrg const cl_queue_properties_khr* properties, 215b8e80941Smrg cl_int* errcode_ret) CL_EXT_SUFFIX__VERSION_1_2; 216b8e80941Smrg 217b8e80941Smrg 218848b8605Smrg/****************************************** 219848b8605Smrg* cl_nv_device_attribute_query extension * 220848b8605Smrg******************************************/ 221b8e80941Smrg 222848b8605Smrg/* cl_nv_device_attribute_query extension - no extension #define since it has no functions */ 223848b8605Smrg#define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000 224848b8605Smrg#define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001 225848b8605Smrg#define CL_DEVICE_REGISTERS_PER_BLOCK_NV 0x4002 226848b8605Smrg#define CL_DEVICE_WARP_SIZE_NV 0x4003 227848b8605Smrg#define CL_DEVICE_GPU_OVERLAP_NV 0x4004 228848b8605Smrg#define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV 0x4005 229848b8605Smrg#define CL_DEVICE_INTEGRATED_MEMORY_NV 0x4006 230848b8605Smrg 231b8e80941Smrg 232848b8605Smrg/********************************* 233848b8605Smrg* cl_amd_device_attribute_query * 234848b8605Smrg*********************************/ 235b8e80941Smrg 236848b8605Smrg#define CL_DEVICE_PROFILING_TIMER_OFFSET_AMD 0x4036 237848b8605Smrg 238b8e80941Smrg 239848b8605Smrg/********************************* 240848b8605Smrg* cl_arm_printf extension 241848b8605Smrg*********************************/ 242b8e80941Smrg 243848b8605Smrg#define CL_PRINTF_CALLBACK_ARM 0x40B0 244848b8605Smrg#define CL_PRINTF_BUFFERSIZE_ARM 0x40B1 245848b8605Smrg 246b8e80941Smrg 247b8e80941Smrg/*********************************** 248b8e80941Smrg* cl_ext_device_fission extension 249b8e80941Smrg***********************************/ 250b8e80941Smrg#define cl_ext_device_fission 1 251b8e80941Smrg 252b8e80941Smrgextern CL_API_ENTRY cl_int CL_API_CALL 253b8e80941SmrgclReleaseDeviceEXT(cl_device_id device) CL_EXT_SUFFIX__VERSION_1_1; 254b8e80941Smrg 255b8e80941Smrgtypedef CL_API_ENTRY cl_int 256b8e80941Smrg(CL_API_CALL *clReleaseDeviceEXT_fn)(cl_device_id device) CL_EXT_SUFFIX__VERSION_1_1; 257b8e80941Smrg 258b8e80941Smrgextern CL_API_ENTRY cl_int CL_API_CALL 259b8e80941SmrgclRetainDeviceEXT(cl_device_id device) CL_EXT_SUFFIX__VERSION_1_1; 260b8e80941Smrg 261b8e80941Smrgtypedef CL_API_ENTRY cl_int 262b8e80941Smrg(CL_API_CALL *clRetainDeviceEXT_fn)(cl_device_id device) CL_EXT_SUFFIX__VERSION_1_1; 263b8e80941Smrg 264b8e80941Smrgtypedef cl_ulong cl_device_partition_property_ext; 265b8e80941Smrgextern CL_API_ENTRY cl_int CL_API_CALL 266b8e80941SmrgclCreateSubDevicesEXT(cl_device_id in_device, 267b8e80941Smrg const cl_device_partition_property_ext * properties, 268b8e80941Smrg cl_uint num_entries, 269b8e80941Smrg cl_device_id * out_devices, 270b8e80941Smrg cl_uint * num_devices) CL_EXT_SUFFIX__VERSION_1_1; 271b8e80941Smrg 272b8e80941Smrgtypedef CL_API_ENTRY cl_int 273b8e80941Smrg(CL_API_CALL * clCreateSubDevicesEXT_fn)(cl_device_id in_device, 274b8e80941Smrg const cl_device_partition_property_ext * properties, 275b8e80941Smrg cl_uint num_entries, 276b8e80941Smrg cl_device_id * out_devices, 277b8e80941Smrg cl_uint * num_devices) CL_EXT_SUFFIX__VERSION_1_1; 278b8e80941Smrg 279b8e80941Smrg/* cl_device_partition_property_ext */ 280b8e80941Smrg#define CL_DEVICE_PARTITION_EQUALLY_EXT 0x4050 281b8e80941Smrg#define CL_DEVICE_PARTITION_BY_COUNTS_EXT 0x4051 282b8e80941Smrg#define CL_DEVICE_PARTITION_BY_NAMES_EXT 0x4052 283b8e80941Smrg#define CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN_EXT 0x4053 284b8e80941Smrg 285b8e80941Smrg/* clDeviceGetInfo selectors */ 286b8e80941Smrg#define CL_DEVICE_PARENT_DEVICE_EXT 0x4054 287b8e80941Smrg#define CL_DEVICE_PARTITION_TYPES_EXT 0x4055 288b8e80941Smrg#define CL_DEVICE_AFFINITY_DOMAINS_EXT 0x4056 289b8e80941Smrg#define CL_DEVICE_REFERENCE_COUNT_EXT 0x4057 290b8e80941Smrg#define CL_DEVICE_PARTITION_STYLE_EXT 0x4058 291b8e80941Smrg 292b8e80941Smrg/* error codes */ 293b8e80941Smrg#define CL_DEVICE_PARTITION_FAILED_EXT -1057 294b8e80941Smrg#define CL_INVALID_PARTITION_COUNT_EXT -1058 295b8e80941Smrg#define CL_INVALID_PARTITION_NAME_EXT -1059 296b8e80941Smrg 297b8e80941Smrg/* CL_AFFINITY_DOMAINs */ 298b8e80941Smrg#define CL_AFFINITY_DOMAIN_L1_CACHE_EXT 0x1 299b8e80941Smrg#define CL_AFFINITY_DOMAIN_L2_CACHE_EXT 0x2 300b8e80941Smrg#define CL_AFFINITY_DOMAIN_L3_CACHE_EXT 0x3 301b8e80941Smrg#define CL_AFFINITY_DOMAIN_L4_CACHE_EXT 0x4 302b8e80941Smrg#define CL_AFFINITY_DOMAIN_NUMA_EXT 0x10 303b8e80941Smrg#define CL_AFFINITY_DOMAIN_NEXT_FISSIONABLE_EXT 0x100 304b8e80941Smrg 305b8e80941Smrg/* cl_device_partition_property_ext list terminators */ 306b8e80941Smrg#define CL_PROPERTIES_LIST_END_EXT ((cl_device_partition_property_ext) 0) 307b8e80941Smrg#define CL_PARTITION_BY_COUNTS_LIST_END_EXT ((cl_device_partition_property_ext) 0) 308b8e80941Smrg#define CL_PARTITION_BY_NAMES_LIST_END_EXT ((cl_device_partition_property_ext) 0 - 1) 309b8e80941Smrg 310b8e80941Smrg 311b8e80941Smrg/*********************************** 312b8e80941Smrg * cl_ext_migrate_memobject extension definitions 313b8e80941Smrg ***********************************/ 314b8e80941Smrg#define cl_ext_migrate_memobject 1 315b8e80941Smrg 316b8e80941Smrgtypedef cl_bitfield cl_mem_migration_flags_ext; 317b8e80941Smrg 318b8e80941Smrg#define CL_MIGRATE_MEM_OBJECT_HOST_EXT 0x1 319b8e80941Smrg 320b8e80941Smrg#define CL_COMMAND_MIGRATE_MEM_OBJECT_EXT 0x4040 321b8e80941Smrg 322b8e80941Smrgextern CL_API_ENTRY cl_int CL_API_CALL 323b8e80941SmrgclEnqueueMigrateMemObjectEXT(cl_command_queue command_queue, 324b8e80941Smrg cl_uint num_mem_objects, 325b8e80941Smrg const cl_mem * mem_objects, 326b8e80941Smrg cl_mem_migration_flags_ext flags, 327b8e80941Smrg cl_uint num_events_in_wait_list, 328b8e80941Smrg const cl_event * event_wait_list, 329b8e80941Smrg cl_event * event); 330b8e80941Smrg 331b8e80941Smrgtypedef CL_API_ENTRY cl_int 332b8e80941Smrg(CL_API_CALL *clEnqueueMigrateMemObjectEXT_fn)(cl_command_queue command_queue, 333b8e80941Smrg cl_uint num_mem_objects, 334b8e80941Smrg const cl_mem * mem_objects, 335b8e80941Smrg cl_mem_migration_flags_ext flags, 336b8e80941Smrg cl_uint num_events_in_wait_list, 337b8e80941Smrg const cl_event * event_wait_list, 338b8e80941Smrg cl_event * event); 339b8e80941Smrg 340848b8605Smrg 341848b8605Smrg/********************************* 342848b8605Smrg* cl_qcom_ext_host_ptr extension 343848b8605Smrg*********************************/ 344b8e80941Smrg#define cl_qcom_ext_host_ptr 1 345848b8605Smrg 346848b8605Smrg#define CL_MEM_EXT_HOST_PTR_QCOM (1 << 29) 347848b8605Smrg 348b8e80941Smrg#define CL_DEVICE_EXT_MEM_PADDING_IN_BYTES_QCOM 0x40A0 349848b8605Smrg#define CL_DEVICE_PAGE_SIZE_QCOM 0x40A1 350848b8605Smrg#define CL_IMAGE_ROW_ALIGNMENT_QCOM 0x40A2 351848b8605Smrg#define CL_IMAGE_SLICE_ALIGNMENT_QCOM 0x40A3 352848b8605Smrg#define CL_MEM_HOST_UNCACHED_QCOM 0x40A4 353848b8605Smrg#define CL_MEM_HOST_WRITEBACK_QCOM 0x40A5 354848b8605Smrg#define CL_MEM_HOST_WRITETHROUGH_QCOM 0x40A6 355848b8605Smrg#define CL_MEM_HOST_WRITE_COMBINING_QCOM 0x40A7 356848b8605Smrg 357848b8605Smrgtypedef cl_uint cl_image_pitch_info_qcom; 358848b8605Smrg 359848b8605Smrgextern CL_API_ENTRY cl_int CL_API_CALL 360848b8605SmrgclGetDeviceImageInfoQCOM(cl_device_id device, 361848b8605Smrg size_t image_width, 362848b8605Smrg size_t image_height, 363848b8605Smrg const cl_image_format *image_format, 364848b8605Smrg cl_image_pitch_info_qcom param_name, 365848b8605Smrg size_t param_value_size, 366848b8605Smrg void *param_value, 367848b8605Smrg size_t *param_value_size_ret); 368848b8605Smrg 369848b8605Smrgtypedef struct _cl_mem_ext_host_ptr 370848b8605Smrg{ 371848b8605Smrg /* Type of external memory allocation. */ 372848b8605Smrg /* Legal values will be defined in layered extensions. */ 373848b8605Smrg cl_uint allocation_type; 374b8e80941Smrg 375b8e80941Smrg /* Host cache policy for this external memory allocation. */ 376848b8605Smrg cl_uint host_cache_policy; 377848b8605Smrg 378848b8605Smrg} cl_mem_ext_host_ptr; 379848b8605Smrg 380b8e80941Smrg 381b8e80941Smrg/******************************************* 382b8e80941Smrg* cl_qcom_ext_host_ptr_iocoherent extension 383b8e80941Smrg********************************************/ 384b8e80941Smrg 385b8e80941Smrg/* Cache policy specifying io-coherence */ 386b8e80941Smrg#define CL_MEM_HOST_IOCOHERENT_QCOM 0x40A9 387b8e80941Smrg 388b8e80941Smrg 389848b8605Smrg/********************************* 390848b8605Smrg* cl_qcom_ion_host_ptr extension 391848b8605Smrg*********************************/ 392848b8605Smrg 393848b8605Smrg#define CL_MEM_ION_HOST_PTR_QCOM 0x40A8 394848b8605Smrg 395848b8605Smrgtypedef struct _cl_mem_ion_host_ptr 396848b8605Smrg{ 397848b8605Smrg /* Type of external memory allocation. */ 398848b8605Smrg /* Must be CL_MEM_ION_HOST_PTR_QCOM for ION allocations. */ 399848b8605Smrg cl_mem_ext_host_ptr ext_host_ptr; 400848b8605Smrg 401848b8605Smrg /* ION file descriptor */ 402848b8605Smrg int ion_filedesc; 403b8e80941Smrg 404848b8605Smrg /* Host pointer to the ION allocated memory */ 405848b8605Smrg void* ion_hostptr; 406848b8605Smrg 407848b8605Smrg} cl_mem_ion_host_ptr; 408848b8605Smrg 409b8e80941Smrg 410b8e80941Smrg/********************************* 411b8e80941Smrg* cl_qcom_android_native_buffer_host_ptr extension 412b8e80941Smrg*********************************/ 413b8e80941Smrg 414b8e80941Smrg#define CL_MEM_ANDROID_NATIVE_BUFFER_HOST_PTR_QCOM 0x40C6 415b8e80941Smrg 416b8e80941Smrgtypedef struct _cl_mem_android_native_buffer_host_ptr 417b8e80941Smrg{ 418b8e80941Smrg /* Type of external memory allocation. */ 419b8e80941Smrg /* Must be CL_MEM_ANDROID_NATIVE_BUFFER_HOST_PTR_QCOM for Android native buffers. */ 420b8e80941Smrg cl_mem_ext_host_ptr ext_host_ptr; 421b8e80941Smrg 422b8e80941Smrg /* Virtual pointer to the android native buffer */ 423b8e80941Smrg void* anb_ptr; 424b8e80941Smrg 425b8e80941Smrg} cl_mem_android_native_buffer_host_ptr; 426b8e80941Smrg 427b8e80941Smrg 428b8e80941Smrg/****************************************** 429b8e80941Smrg * cl_img_yuv_image extension * 430b8e80941Smrg ******************************************/ 431b8e80941Smrg 432b8e80941Smrg/* Image formats used in clCreateImage */ 433b8e80941Smrg#define CL_NV21_IMG 0x40D0 434b8e80941Smrg#define CL_YV12_IMG 0x40D1 435b8e80941Smrg 436b8e80941Smrg 437b8e80941Smrg/****************************************** 438b8e80941Smrg * cl_img_cached_allocations extension * 439b8e80941Smrg ******************************************/ 440b8e80941Smrg 441b8e80941Smrg/* Flag values used by clCreateBuffer */ 442b8e80941Smrg#define CL_MEM_USE_UNCACHED_CPU_MEMORY_IMG (1 << 26) 443b8e80941Smrg#define CL_MEM_USE_CACHED_CPU_MEMORY_IMG (1 << 27) 444b8e80941Smrg 445b8e80941Smrg 446b8e80941Smrg/****************************************** 447b8e80941Smrg * cl_img_use_gralloc_ptr extension * 448b8e80941Smrg ******************************************/ 449b8e80941Smrg#define cl_img_use_gralloc_ptr 1 450b8e80941Smrg 451b8e80941Smrg/* Flag values used by clCreateBuffer */ 452b8e80941Smrg#define CL_MEM_USE_GRALLOC_PTR_IMG (1 << 28) 453b8e80941Smrg 454b8e80941Smrg/* To be used by clGetEventInfo: */ 455b8e80941Smrg#define CL_COMMAND_ACQUIRE_GRALLOC_OBJECTS_IMG 0x40D2 456b8e80941Smrg#define CL_COMMAND_RELEASE_GRALLOC_OBJECTS_IMG 0x40D3 457b8e80941Smrg 458b8e80941Smrg/* Error code from clEnqueueReleaseGrallocObjectsIMG */ 459b8e80941Smrg#define CL_GRALLOC_RESOURCE_NOT_ACQUIRED_IMG 0x40D4 460b8e80941Smrg 461b8e80941Smrgextern CL_API_ENTRY cl_int CL_API_CALL 462b8e80941SmrgclEnqueueAcquireGrallocObjectsIMG(cl_command_queue command_queue, 463b8e80941Smrg cl_uint num_objects, 464b8e80941Smrg const cl_mem * mem_objects, 465b8e80941Smrg cl_uint num_events_in_wait_list, 466b8e80941Smrg const cl_event * event_wait_list, 467b8e80941Smrg cl_event * event) CL_EXT_SUFFIX__VERSION_1_2; 468b8e80941Smrg 469b8e80941Smrgextern CL_API_ENTRY cl_int CL_API_CALL 470b8e80941SmrgclEnqueueReleaseGrallocObjectsIMG(cl_command_queue command_queue, 471b8e80941Smrg cl_uint num_objects, 472b8e80941Smrg const cl_mem * mem_objects, 473b8e80941Smrg cl_uint num_events_in_wait_list, 474b8e80941Smrg const cl_event * event_wait_list, 475b8e80941Smrg cl_event * event) CL_EXT_SUFFIX__VERSION_1_2; 476b8e80941Smrg 477b8e80941Smrg 478b8e80941Smrg/********************************* 479b8e80941Smrg* cl_khr_subgroups extension 480b8e80941Smrg*********************************/ 481b8e80941Smrg#define cl_khr_subgroups 1 482b8e80941Smrg 483b8e80941Smrg#if !defined(CL_VERSION_2_1) 484b8e80941Smrg/* For OpenCL 2.1 and newer, cl_kernel_sub_group_info is declared in CL.h. 485b8e80941Smrg In hindsight, there should have been a khr suffix on this type for 486b8e80941Smrg the extension, but keeping it un-suffixed to maintain backwards 487b8e80941Smrg compatibility. */ 488b8e80941Smrgtypedef cl_uint cl_kernel_sub_group_info; 489b8e80941Smrg#endif 490b8e80941Smrg 491b8e80941Smrg/* cl_kernel_sub_group_info */ 492b8e80941Smrg#define CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE_KHR 0x2033 493b8e80941Smrg#define CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE_KHR 0x2034 494b8e80941Smrg 495b8e80941Smrgextern CL_API_ENTRY cl_int CL_API_CALL 496b8e80941SmrgclGetKernelSubGroupInfoKHR(cl_kernel in_kernel, 497b8e80941Smrg cl_device_id in_device, 498b8e80941Smrg cl_kernel_sub_group_info param_name, 499b8e80941Smrg size_t input_value_size, 500b8e80941Smrg const void * input_value, 501b8e80941Smrg size_t param_value_size, 502b8e80941Smrg void * param_value, 503b8e80941Smrg size_t * param_value_size_ret) CL_EXT_SUFFIX__VERSION_2_0_DEPRECATED; 504b8e80941Smrg 505b8e80941Smrgtypedef CL_API_ENTRY cl_int 506b8e80941Smrg(CL_API_CALL * clGetKernelSubGroupInfoKHR_fn)(cl_kernel in_kernel, 507b8e80941Smrg cl_device_id in_device, 508b8e80941Smrg cl_kernel_sub_group_info param_name, 509b8e80941Smrg size_t input_value_size, 510b8e80941Smrg const void * input_value, 511b8e80941Smrg size_t param_value_size, 512b8e80941Smrg void * param_value, 513b8e80941Smrg size_t * param_value_size_ret) CL_EXT_SUFFIX__VERSION_2_0_DEPRECATED; 514b8e80941Smrg 515b8e80941Smrg 516b8e80941Smrg/********************************* 517b8e80941Smrg* cl_khr_mipmap_image extension 518b8e80941Smrg*********************************/ 519b8e80941Smrg 520b8e80941Smrg/* cl_sampler_properties */ 521b8e80941Smrg#define CL_SAMPLER_MIP_FILTER_MODE_KHR 0x1155 522b8e80941Smrg#define CL_SAMPLER_LOD_MIN_KHR 0x1156 523b8e80941Smrg#define CL_SAMPLER_LOD_MAX_KHR 0x1157 524b8e80941Smrg 525b8e80941Smrg 526b8e80941Smrg/********************************* 527b8e80941Smrg* cl_khr_priority_hints extension 528b8e80941Smrg*********************************/ 529b8e80941Smrg/* This extension define is for backwards compatibility. 530b8e80941Smrg It shouldn't be required since this extension has no new functions. */ 531b8e80941Smrg#define cl_khr_priority_hints 1 532b8e80941Smrg 533b8e80941Smrgtypedef cl_uint cl_queue_priority_khr; 534b8e80941Smrg 535b8e80941Smrg/* cl_command_queue_properties */ 536b8e80941Smrg#define CL_QUEUE_PRIORITY_KHR 0x1096 537b8e80941Smrg 538b8e80941Smrg/* cl_queue_priority_khr */ 539b8e80941Smrg#define CL_QUEUE_PRIORITY_HIGH_KHR (1<<0) 540b8e80941Smrg#define CL_QUEUE_PRIORITY_MED_KHR (1<<1) 541b8e80941Smrg#define CL_QUEUE_PRIORITY_LOW_KHR (1<<2) 542b8e80941Smrg 543b8e80941Smrg 544b8e80941Smrg/********************************* 545b8e80941Smrg* cl_khr_throttle_hints extension 546b8e80941Smrg*********************************/ 547b8e80941Smrg/* This extension define is for backwards compatibility. 548b8e80941Smrg It shouldn't be required since this extension has no new functions. */ 549b8e80941Smrg#define cl_khr_throttle_hints 1 550b8e80941Smrg 551b8e80941Smrgtypedef cl_uint cl_queue_throttle_khr; 552b8e80941Smrg 553b8e80941Smrg/* cl_command_queue_properties */ 554b8e80941Smrg#define CL_QUEUE_THROTTLE_KHR 0x1097 555b8e80941Smrg 556b8e80941Smrg/* cl_queue_throttle_khr */ 557b8e80941Smrg#define CL_QUEUE_THROTTLE_HIGH_KHR (1<<0) 558b8e80941Smrg#define CL_QUEUE_THROTTLE_MED_KHR (1<<1) 559b8e80941Smrg#define CL_QUEUE_THROTTLE_LOW_KHR (1<<2) 560b8e80941Smrg 561b8e80941Smrg 562b8e80941Smrg/********************************* 563b8e80941Smrg* cl_khr_subgroup_named_barrier 564b8e80941Smrg*********************************/ 565b8e80941Smrg/* This extension define is for backwards compatibility. 566b8e80941Smrg It shouldn't be required since this extension has no new functions. */ 567b8e80941Smrg#define cl_khr_subgroup_named_barrier 1 568b8e80941Smrg 569b8e80941Smrg/* cl_device_info */ 570b8e80941Smrg#define CL_DEVICE_MAX_NAMED_BARRIER_COUNT_KHR 0x2035 571b8e80941Smrg 572b8e80941Smrg 573b8e80941Smrg/********************************** 574b8e80941Smrg * cl_arm_import_memory extension * 575b8e80941Smrg **********************************/ 576b8e80941Smrg#define cl_arm_import_memory 1 577b8e80941Smrg 578b8e80941Smrgtypedef intptr_t cl_import_properties_arm; 579b8e80941Smrg 580b8e80941Smrg/* Default and valid proporties name for cl_arm_import_memory */ 581b8e80941Smrg#define CL_IMPORT_TYPE_ARM 0x40B2 582b8e80941Smrg 583b8e80941Smrg/* Host process memory type default value for CL_IMPORT_TYPE_ARM property */ 584b8e80941Smrg#define CL_IMPORT_TYPE_HOST_ARM 0x40B3 585b8e80941Smrg 586b8e80941Smrg/* DMA BUF memory type value for CL_IMPORT_TYPE_ARM property */ 587b8e80941Smrg#define CL_IMPORT_TYPE_DMA_BUF_ARM 0x40B4 588b8e80941Smrg 589b8e80941Smrg/* Protected DMA BUF memory type value for CL_IMPORT_TYPE_ARM property */ 590b8e80941Smrg#define CL_IMPORT_TYPE_PROTECTED_ARM 0x40B5 591b8e80941Smrg 592b8e80941Smrg/* This extension adds a new function that allows for direct memory import into 593b8e80941Smrg * OpenCL via the clImportMemoryARM function. 594b8e80941Smrg * 595b8e80941Smrg * Memory imported through this interface will be mapped into the device's page 596b8e80941Smrg * tables directly, providing zero copy access. It will never fall back to copy 597b8e80941Smrg * operations and aliased buffers. 598b8e80941Smrg * 599b8e80941Smrg * Types of memory supported for import are specified as additional extension 600b8e80941Smrg * strings. 601b8e80941Smrg * 602b8e80941Smrg * This extension produces cl_mem allocations which are compatible with all other 603b8e80941Smrg * users of cl_mem in the standard API. 604b8e80941Smrg * 605b8e80941Smrg * This extension maps pages with the same properties as the normal buffer creation 606b8e80941Smrg * function clCreateBuffer. 607b8e80941Smrg */ 608b8e80941Smrgextern CL_API_ENTRY cl_mem CL_API_CALL 609b8e80941SmrgclImportMemoryARM( cl_context context, 610b8e80941Smrg cl_mem_flags flags, 611b8e80941Smrg const cl_import_properties_arm *properties, 612b8e80941Smrg void *memory, 613b8e80941Smrg size_t size, 614b8e80941Smrg cl_int *errcode_ret) CL_EXT_SUFFIX__VERSION_1_0; 615b8e80941Smrg 616b8e80941Smrg 617b8e80941Smrg/****************************************** 618b8e80941Smrg * cl_arm_shared_virtual_memory extension * 619b8e80941Smrg ******************************************/ 620b8e80941Smrg#define cl_arm_shared_virtual_memory 1 621b8e80941Smrg 622b8e80941Smrg/* Used by clGetDeviceInfo */ 623b8e80941Smrg#define CL_DEVICE_SVM_CAPABILITIES_ARM 0x40B6 624b8e80941Smrg 625b8e80941Smrg/* Used by clGetMemObjectInfo */ 626b8e80941Smrg#define CL_MEM_USES_SVM_POINTER_ARM 0x40B7 627b8e80941Smrg 628b8e80941Smrg/* Used by clSetKernelExecInfoARM: */ 629b8e80941Smrg#define CL_KERNEL_EXEC_INFO_SVM_PTRS_ARM 0x40B8 630b8e80941Smrg#define CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM_ARM 0x40B9 631b8e80941Smrg 632b8e80941Smrg/* To be used by clGetEventInfo: */ 633b8e80941Smrg#define CL_COMMAND_SVM_FREE_ARM 0x40BA 634b8e80941Smrg#define CL_COMMAND_SVM_MEMCPY_ARM 0x40BB 635b8e80941Smrg#define CL_COMMAND_SVM_MEMFILL_ARM 0x40BC 636b8e80941Smrg#define CL_COMMAND_SVM_MAP_ARM 0x40BD 637b8e80941Smrg#define CL_COMMAND_SVM_UNMAP_ARM 0x40BE 638b8e80941Smrg 639b8e80941Smrg/* Flag values returned by clGetDeviceInfo with CL_DEVICE_SVM_CAPABILITIES_ARM as the param_name. */ 640b8e80941Smrg#define CL_DEVICE_SVM_COARSE_GRAIN_BUFFER_ARM (1 << 0) 641b8e80941Smrg#define CL_DEVICE_SVM_FINE_GRAIN_BUFFER_ARM (1 << 1) 642b8e80941Smrg#define CL_DEVICE_SVM_FINE_GRAIN_SYSTEM_ARM (1 << 2) 643b8e80941Smrg#define CL_DEVICE_SVM_ATOMICS_ARM (1 << 3) 644b8e80941Smrg 645b8e80941Smrg/* Flag values used by clSVMAllocARM: */ 646b8e80941Smrg#define CL_MEM_SVM_FINE_GRAIN_BUFFER_ARM (1 << 10) 647b8e80941Smrg#define CL_MEM_SVM_ATOMICS_ARM (1 << 11) 648b8e80941Smrg 649b8e80941Smrgtypedef cl_bitfield cl_svm_mem_flags_arm; 650b8e80941Smrgtypedef cl_uint cl_kernel_exec_info_arm; 651b8e80941Smrgtypedef cl_bitfield cl_device_svm_capabilities_arm; 652b8e80941Smrg 653b8e80941Smrgextern CL_API_ENTRY void * CL_API_CALL 654b8e80941SmrgclSVMAllocARM(cl_context context, 655b8e80941Smrg cl_svm_mem_flags_arm flags, 656b8e80941Smrg size_t size, 657b8e80941Smrg cl_uint alignment) CL_EXT_SUFFIX__VERSION_1_2; 658b8e80941Smrg 659b8e80941Smrgextern CL_API_ENTRY void CL_API_CALL 660b8e80941SmrgclSVMFreeARM(cl_context context, 661b8e80941Smrg void * svm_pointer) CL_EXT_SUFFIX__VERSION_1_2; 662b8e80941Smrg 663b8e80941Smrgextern CL_API_ENTRY cl_int CL_API_CALL 664b8e80941SmrgclEnqueueSVMFreeARM(cl_command_queue command_queue, 665b8e80941Smrg cl_uint num_svm_pointers, 666b8e80941Smrg void * svm_pointers[], 667b8e80941Smrg void (CL_CALLBACK * pfn_free_func)(cl_command_queue queue, 668b8e80941Smrg cl_uint num_svm_pointers, 669b8e80941Smrg void * svm_pointers[], 670b8e80941Smrg void * user_data), 671b8e80941Smrg void * user_data, 672b8e80941Smrg cl_uint num_events_in_wait_list, 673b8e80941Smrg const cl_event * event_wait_list, 674b8e80941Smrg cl_event * event) CL_EXT_SUFFIX__VERSION_1_2; 675b8e80941Smrg 676b8e80941Smrgextern CL_API_ENTRY cl_int CL_API_CALL 677b8e80941SmrgclEnqueueSVMMemcpyARM(cl_command_queue command_queue, 678b8e80941Smrg cl_bool blocking_copy, 679b8e80941Smrg void * dst_ptr, 680b8e80941Smrg const void * src_ptr, 681b8e80941Smrg size_t size, 682b8e80941Smrg cl_uint num_events_in_wait_list, 683b8e80941Smrg const cl_event * event_wait_list, 684b8e80941Smrg cl_event * event) CL_EXT_SUFFIX__VERSION_1_2; 685b8e80941Smrg 686b8e80941Smrgextern CL_API_ENTRY cl_int CL_API_CALL 687b8e80941SmrgclEnqueueSVMMemFillARM(cl_command_queue command_queue, 688b8e80941Smrg void * svm_ptr, 689b8e80941Smrg const void * pattern, 690b8e80941Smrg size_t pattern_size, 691b8e80941Smrg size_t size, 692b8e80941Smrg cl_uint num_events_in_wait_list, 693b8e80941Smrg const cl_event * event_wait_list, 694b8e80941Smrg cl_event * event) CL_EXT_SUFFIX__VERSION_1_2; 695b8e80941Smrg 696b8e80941Smrgextern CL_API_ENTRY cl_int CL_API_CALL 697b8e80941SmrgclEnqueueSVMMapARM(cl_command_queue command_queue, 698b8e80941Smrg cl_bool blocking_map, 699b8e80941Smrg cl_map_flags flags, 700b8e80941Smrg void * svm_ptr, 701b8e80941Smrg size_t size, 702b8e80941Smrg cl_uint num_events_in_wait_list, 703b8e80941Smrg const cl_event * event_wait_list, 704b8e80941Smrg cl_event * event) CL_EXT_SUFFIX__VERSION_1_2; 705b8e80941Smrg 706b8e80941Smrgextern CL_API_ENTRY cl_int CL_API_CALL 707b8e80941SmrgclEnqueueSVMUnmapARM(cl_command_queue command_queue, 708b8e80941Smrg void * svm_ptr, 709b8e80941Smrg cl_uint num_events_in_wait_list, 710b8e80941Smrg const cl_event * event_wait_list, 711b8e80941Smrg cl_event * event) CL_EXT_SUFFIX__VERSION_1_2; 712b8e80941Smrg 713b8e80941Smrgextern CL_API_ENTRY cl_int CL_API_CALL 714b8e80941SmrgclSetKernelArgSVMPointerARM(cl_kernel kernel, 715b8e80941Smrg cl_uint arg_index, 716b8e80941Smrg const void * arg_value) CL_EXT_SUFFIX__VERSION_1_2; 717b8e80941Smrg 718b8e80941Smrgextern CL_API_ENTRY cl_int CL_API_CALL 719b8e80941SmrgclSetKernelExecInfoARM(cl_kernel kernel, 720b8e80941Smrg cl_kernel_exec_info_arm param_name, 721b8e80941Smrg size_t param_value_size, 722b8e80941Smrg const void * param_value) CL_EXT_SUFFIX__VERSION_1_2; 723b8e80941Smrg 724b8e80941Smrg/******************************** 725b8e80941Smrg * cl_arm_get_core_id extension * 726b8e80941Smrg ********************************/ 727b8e80941Smrg 728b8e80941Smrg#ifdef CL_VERSION_1_2 729b8e80941Smrg 730b8e80941Smrg#define cl_arm_get_core_id 1 731b8e80941Smrg 732b8e80941Smrg/* Device info property for bitfield of cores present */ 733b8e80941Smrg#define CL_DEVICE_COMPUTE_UNITS_BITFIELD_ARM 0x40BF 734b8e80941Smrg 735b8e80941Smrg#endif /* CL_VERSION_1_2 */ 736848b8605Smrg 737848b8605Smrg#ifdef __cplusplus 738848b8605Smrg} 739848b8605Smrg#endif 740848b8605Smrg 741848b8605Smrg 742848b8605Smrg#endif /* __CL_EXT_H */ 743