| 1 | /******************************************************************************* |
| 2 | * Copyright (c) 2008-2010 The Khronos Group Inc. |
| 3 | * |
| 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 | * |
| 15 | * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
| 19 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
| 20 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
| 21 | * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. |
| 22 | ******************************************************************************/ |
| 23 | |
| 24 | /* $Revision: 11928 $ on $Date: 2010-07-13 09:04:56 -0700 (Tue, 13 Jul 2010) $ */ |
| 25 | |
| 26 | /* cl_ext.h contains OpenCL extensions which don't have external */ |
| 27 | /* (OpenGL, D3D) dependencies. */ |
| 28 | |
| 29 | #ifndef __CL_EXT_H |
| 30 | #define __CL_EXT_H |
| 31 | |
| 32 | #ifdef __cplusplus |
| 33 | extern "C" { |
| 34 | #endif |
| 35 | |
| 36 | #ifdef __APPLE__ |
| 37 | #include <OpenCL/cl.h> |
| 38 | #include <AvailabilityMacros.h> |
| 39 | #else |
| 40 | #include <CL/cl.h> |
| 41 | #endif |
| 42 | |
| 43 | /* cl_khr_fp64 extension - no extension #define since it has no functions */ |
| 44 | #define CL_DEVICE_DOUBLE_FP_CONFIG 0x1032 |
| 45 | |
| 46 | /* cl_khr_fp16 extension - no extension #define since it has no functions */ |
| 47 | #define CL_DEVICE_HALF_FP_CONFIG 0x1033 |
| 48 | |
| 49 | /* Memory object destruction |
| 50 | * |
| 51 | * Apple extension for use to manage externally allocated buffers used with cl_mem objects with CL_MEM_USE_HOST_PTR |
| 52 | * |
| 53 | * Registers a user callback function that will be called when the memory object is deleted and its resources |
| 54 | * freed. Each call to clSetMemObjectCallbackFn registers the specified user callback function on a callback |
| 55 | * stack associated with memobj. The registered user callback functions are called in the reverse order in |
| 56 | * which they were registered. The user callback functions are called and then the memory object is deleted |
| 57 | * and its resources freed. This provides a mechanism for the application (and libraries) using memobj to be |
| 58 | * notified when the memory referenced by host_ptr, specified when the memory object is created and used as |
| 59 | * the storage bits for the memory object, can be reused or freed. |
| 60 | * |
| 61 | * The application may not call CL api's with the cl_mem object passed to the pfn_notify. |
| 62 | * |
| 63 | * Please check for the "cl_APPLE_SetMemObjectDestructor" extension using clGetDeviceInfo(CL_DEVICE_EXTENSIONS) |
| 64 | * before using. |
| 65 | */ |
| 66 | #define cl_APPLE_SetMemObjectDestructor 1 |
| 67 | cl_int CL_API_ENTRY clSetMemObjectDestructorAPPLE( cl_mem /* memobj */, |
| 68 | void (* /*pfn_notify*/)( cl_mem /* memobj */, void* /*user_data*/), |
| 69 | void * /*user_data */ ) CL_EXT_SUFFIX__VERSION_1_0; |
| 70 | |
| 71 | |
| 72 | /* Context Logging Functions |
| 73 | * |
| 74 | * The next three convenience functions are intended to be used as the pfn_notify parameter to clCreateContext(). |
| 75 | * Please check for the "cl_APPLE_ContextLoggingFunctions" extension using clGetDeviceInfo(CL_DEVICE_EXTENSIONS) |
| 76 | * before using. |
| 77 | * |
| 78 | * clLogMessagesToSystemLog fowards on all log messages to the Apple System Logger |
| 79 | */ |
| 80 | #define cl_APPLE_ContextLoggingFunctions 1 |
| 81 | extern void CL_API_ENTRY clLogMessagesToSystemLogAPPLE( const char * /* errstr */, |
| 82 | const void * /* private_info */, |
| 83 | size_t /* cb */, |
| 84 | void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0; |
| 85 | |
| 86 | /* clLogMessagesToStdout sends all log messages to the file descriptor stdout */ |
| 87 | extern void CL_API_ENTRY clLogMessagesToStdoutAPPLE( const char * /* errstr */, |
| 88 | const void * /* private_info */, |
| 89 | size_t /* cb */, |
| 90 | void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0; |
| 91 | |
| 92 | /* clLogMessagesToStderr sends all log messages to the file descriptor stderr */ |
| 93 | extern void CL_API_ENTRY clLogMessagesToStderrAPPLE( const char * /* errstr */, |
| 94 | const void * /* private_info */, |
| 95 | size_t /* cb */, |
| 96 | void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0; |
| 97 | |
| 98 | |
| 99 | /************************ |
| 100 | * cl_khr_icd extension * |
| 101 | ************************/ |
| 102 | #define cl_khr_icd 1 |
| 103 | |
| 104 | /* cl_platform_info */ |
| 105 | #define CL_PLATFORM_ICD_SUFFIX_KHR 0x0920 |
| 106 | |
| 107 | /* Additional Error Codes */ |
| 108 | #define CL_PLATFORM_NOT_FOUND_KHR -1001 |
| 109 | |
| 110 | extern CL_API_ENTRY cl_int CL_API_CALL |
| 111 | clIcdGetPlatformIDsKHR(cl_uint /* num_entries */, |
| 112 | cl_platform_id * /* platforms */, |
| 113 | cl_uint * /* num_platforms */); |
| 114 | |
| 115 | typedef CL_API_ENTRY cl_int (CL_API_CALL *clIcdGetPlatformIDsKHR_fn)( |
| 116 | cl_uint /* num_entries */, |
| 117 | cl_platform_id * /* platforms */, |
| 118 | cl_uint * /* num_platforms */); |
| 119 | |
| 120 | |
| 121 | /****************************************** |
| 122 | * cl_nv_device_attribute_query extension * |
| 123 | ******************************************/ |
| 124 | /* cl_nv_device_attribute_query extension - no extension #define since it has no functions */ |
| 125 | #define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000 |
| 126 | #define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001 |
| 127 | #define CL_DEVICE_REGISTERS_PER_BLOCK_NV 0x4002 |
| 128 | #define CL_DEVICE_WARP_SIZE_NV 0x4003 |
| 129 | #define CL_DEVICE_GPU_OVERLAP_NV 0x4004 |
| 130 | #define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV 0x4005 |
| 131 | #define CL_DEVICE_INTEGRATED_MEMORY_NV 0x4006 |
| 132 | |
| 133 | |
| 134 | /********************************* |
| 135 | * cl_amd_device_attribute_query * |
| 136 | *********************************/ |
| 137 | #define CL_DEVICE_PROFILING_TIMER_OFFSET_AMD 0x4036 |
| 138 | |
| 139 | |
| 140 | #ifdef CL_VERSION_1_1 |
| 141 | /*********************************** |
| 142 | * cl_ext_device_fission extension * |
| 143 | ***********************************/ |
| 144 | #define cl_ext_device_fission 1 |
| 145 | |
| 146 | extern CL_API_ENTRY cl_int CL_API_CALL |
| 147 | clReleaseDeviceEXT( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1; |
| 148 | |
| 149 | typedef CL_API_ENTRY cl_int |
| 150 | (CL_API_CALL *clReleaseDeviceEXT_fn)( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1; |
| 151 | |
| 152 | extern CL_API_ENTRY cl_int CL_API_CALL |
| 153 | clRetainDeviceEXT( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1; |
| 154 | |
| 155 | typedef CL_API_ENTRY cl_int |
| 156 | (CL_API_CALL *clRetainDeviceEXT_fn)( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1; |
| 157 | |
| 158 | typedef cl_ulong cl_device_partition_property_ext; |
| 159 | extern CL_API_ENTRY cl_int CL_API_CALL |
| 160 | clCreateSubDevicesEXT( cl_device_id /*in_device*/, |
| 161 | const cl_device_partition_property_ext * /* properties */, |
| 162 | cl_uint /*num_entries*/, |
| 163 | cl_device_id * /*out_devices*/, |
| 164 | cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__VERSION_1_1; |
| 165 | |
| 166 | typedef CL_API_ENTRY cl_int |
| 167 | ( CL_API_CALL * clCreateSubDevicesEXT_fn)( cl_device_id /*in_device*/, |
| 168 | const cl_device_partition_property_ext * /* properties */, |
| 169 | cl_uint /*num_entries*/, |
| 170 | cl_device_id * /*out_devices*/, |
| 171 | cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__VERSION_1_1; |
| 172 | |
| 173 | /* cl_device_partition_property_ext */ |
| 174 | #define CL_DEVICE_PARTITION_EQUALLY_EXT 0x4050 |
| 175 | #define CL_DEVICE_PARTITION_BY_COUNTS_EXT 0x4051 |
| 176 | #define CL_DEVICE_PARTITION_BY_NAMES_EXT 0x4052 |
| 177 | #define CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN_EXT 0x4053 |
| 178 | |
| 179 | /* clDeviceGetInfo selectors */ |
| 180 | #define CL_DEVICE_PARENT_DEVICE_EXT 0x4054 |
| 181 | #define CL_DEVICE_PARTITION_TYPES_EXT 0x4055 |
| 182 | #define CL_DEVICE_AFFINITY_DOMAINS_EXT 0x4056 |
| 183 | #define CL_DEVICE_REFERENCE_COUNT_EXT 0x4057 |
| 184 | #define CL_DEVICE_PARTITION_STYLE_EXT 0x4058 |
| 185 | |
| 186 | /* error codes */ |
| 187 | #define CL_DEVICE_PARTITION_FAILED_EXT -1057 |
| 188 | #define CL_INVALID_PARTITION_COUNT_EXT -1058 |
| 189 | #define CL_INVALID_PARTITION_NAME_EXT -1059 |
| 190 | |
| 191 | /* CL_AFFINITY_DOMAINs */ |
| 192 | #define CL_AFFINITY_DOMAIN_L1_CACHE_EXT 0x1 |
| 193 | #define CL_AFFINITY_DOMAIN_L2_CACHE_EXT 0x2 |
| 194 | #define CL_AFFINITY_DOMAIN_L3_CACHE_EXT 0x3 |
| 195 | #define CL_AFFINITY_DOMAIN_L4_CACHE_EXT 0x4 |
| 196 | #define CL_AFFINITY_DOMAIN_NUMA_EXT 0x10 |
| 197 | #define CL_AFFINITY_DOMAIN_NEXT_FISSIONABLE_EXT 0x100 |
| 198 | |
| 199 | /* cl_device_partition_property_ext list terminators */ |
| 200 | #define CL_PROPERTIES_LIST_END_EXT ((cl_device_partition_property_ext) 0) |
| 201 | #define CL_PARTITION_BY_COUNTS_LIST_END_EXT ((cl_device_partition_property_ext) 0) |
| 202 | #define CL_PARTITION_BY_NAMES_LIST_END_EXT ((cl_device_partition_property_ext) 0 - 1) |
| 203 | |
| 204 | |
| 205 | |
| 206 | #endif /* CL_VERSION_1_1 */ |
| 207 | |
| 208 | #ifdef __cplusplus |
| 209 | } |
| 210 | #endif |
| 211 | |
| 212 | |
| 213 | #endif /* __CL_EXT_H */ |