cl_ext.h 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  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. /* $Revision: 11928 $ on $Date: 2010-07-13 09:04:56 -0700 (Tue, 13 Jul 2010) $ */
  24. /* cl_ext.h contains OpenCL extensions which don't have external */
  25. /* (OpenGL, D3D) dependencies. */
  26. #ifndef __CL_EXT_H
  27. #define __CL_EXT_H
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31. #ifdef __APPLE__
  32. #include <OpenCL/cl.h>
  33. #include <AvailabilityMacros.h>
  34. #else
  35. #include <CL/cl.h>
  36. #endif
  37. /* cl_khr_fp64 extension - no extension #define since it has no functions */
  38. #define CL_DEVICE_DOUBLE_FP_CONFIG 0x1032
  39. /* cl_khr_fp16 extension - no extension #define since it has no functions */
  40. #define CL_DEVICE_HALF_FP_CONFIG 0x1033
  41. /* Memory object destruction
  42. *
  43. * Apple extension for use to manage externally allocated buffers used with cl_mem objects with CL_MEM_USE_HOST_PTR
  44. *
  45. * Registers a user callback function that will be called when the memory object is deleted and its resources
  46. * freed. Each call to clSetMemObjectCallbackFn registers the specified user callback function on a callback
  47. * stack associated with memobj. The registered user callback functions are called in the reverse order in
  48. * which they were registered. The user callback functions are called and then the memory object is deleted
  49. * and its resources freed. This provides a mechanism for the application (and libraries) using memobj to be
  50. * notified when the memory referenced by host_ptr, specified when the memory object is created and used as
  51. * the storage bits for the memory object, can be reused or freed.
  52. *
  53. * The application may not call CL api's with the cl_mem object passed to the pfn_notify.
  54. *
  55. * Please check for the "cl_APPLE_SetMemObjectDestructor" extension using clGetDeviceInfo(CL_DEVICE_EXTENSIONS)
  56. * before using.
  57. */
  58. #define cl_APPLE_SetMemObjectDestructor 1
  59. cl_int CL_API_ENTRY clSetMemObjectDestructorAPPLE( cl_mem /* memobj */,
  60. void (* /*pfn_notify*/)( cl_mem /* memobj */, void* /*user_data*/),
  61. void * /*user_data */ ) CL_EXT_SUFFIX__VERSION_1_0;
  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 fowards 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. /* clLogMessagesToStdout sends all log messages to the file descriptor stdout */
  76. extern void CL_API_ENTRY clLogMessagesToStdoutAPPLE( const char * /* errstr */,
  77. const void * /* private_info */,
  78. size_t /* cb */,
  79. void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0;
  80. /* clLogMessagesToStderr sends all log messages to the file descriptor stderr */
  81. extern void CL_API_ENTRY clLogMessagesToStderrAPPLE( const char * /* errstr */,
  82. const void * /* private_info */,
  83. size_t /* cb */,
  84. void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0;
  85. /************************
  86. * cl_khr_icd extension *
  87. ************************/
  88. #define cl_khr_icd 1
  89. /* cl_platform_info */
  90. #define CL_PLATFORM_ICD_SUFFIX_KHR 0x0920
  91. /* Additional Error Codes */
  92. #define CL_PLATFORM_NOT_FOUND_KHR -1001
  93. extern CL_API_ENTRY cl_int CL_API_CALL
  94. clIcdGetPlatformIDsKHR(cl_uint /* num_entries */,
  95. cl_platform_id * /* platforms */,
  96. cl_uint * /* num_platforms */);
  97. typedef CL_API_ENTRY cl_int (CL_API_CALL *clIcdGetPlatformIDsKHR_fn)(
  98. cl_uint /* num_entries */,
  99. cl_platform_id * /* platforms */,
  100. cl_uint * /* num_platforms */);
  101. /******************************************
  102. * cl_nv_device_attribute_query extension *
  103. ******************************************/
  104. /* cl_nv_device_attribute_query extension - no extension #define since it has no functions */
  105. #define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000
  106. #define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001
  107. #define CL_DEVICE_REGISTERS_PER_BLOCK_NV 0x4002
  108. #define CL_DEVICE_WARP_SIZE_NV 0x4003
  109. #define CL_DEVICE_GPU_OVERLAP_NV 0x4004
  110. #define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV 0x4005
  111. #define CL_DEVICE_INTEGRATED_MEMORY_NV 0x4006
  112. /*********************************
  113. * cl_amd_device_attribute_query *
  114. *********************************/
  115. #define CL_DEVICE_PROFILING_TIMER_OFFSET_AMD 0x4036
  116. #ifdef CL_VERSION_1_1
  117. /***********************************
  118. * cl_ext_device_fission extension *
  119. ***********************************/
  120. #define cl_ext_device_fission 1
  121. extern CL_API_ENTRY cl_int CL_API_CALL
  122. clReleaseDeviceEXT( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
  123. typedef CL_API_ENTRY cl_int
  124. (CL_API_CALL *clReleaseDeviceEXT_fn)( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
  125. extern CL_API_ENTRY cl_int CL_API_CALL
  126. clRetainDeviceEXT( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
  127. typedef CL_API_ENTRY cl_int
  128. (CL_API_CALL *clRetainDeviceEXT_fn)( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
  129. typedef cl_ulong cl_device_partition_property_ext;
  130. extern CL_API_ENTRY cl_int CL_API_CALL
  131. clCreateSubDevicesEXT( cl_device_id /*in_device*/,
  132. const cl_device_partition_property_ext * /* properties */,
  133. cl_uint /*num_entries*/,
  134. cl_device_id * /*out_devices*/,
  135. cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__VERSION_1_1;
  136. typedef CL_API_ENTRY cl_int
  137. ( CL_API_CALL * clCreateSubDevicesEXT_fn)( cl_device_id /*in_device*/,
  138. const cl_device_partition_property_ext * /* properties */,
  139. cl_uint /*num_entries*/,
  140. cl_device_id * /*out_devices*/,
  141. cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__VERSION_1_1;
  142. /* cl_device_partition_property_ext */
  143. #define CL_DEVICE_PARTITION_EQUALLY_EXT 0x4050
  144. #define CL_DEVICE_PARTITION_BY_COUNTS_EXT 0x4051
  145. #define CL_DEVICE_PARTITION_BY_NAMES_EXT 0x4052
  146. #define CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN_EXT 0x4053
  147. /* clDeviceGetInfo selectors */
  148. #define CL_DEVICE_PARENT_DEVICE_EXT 0x4054
  149. #define CL_DEVICE_PARTITION_TYPES_EXT 0x4055
  150. #define CL_DEVICE_AFFINITY_DOMAINS_EXT 0x4056
  151. #define CL_DEVICE_REFERENCE_COUNT_EXT 0x4057
  152. #define CL_DEVICE_PARTITION_STYLE_EXT 0x4058
  153. /* error codes */
  154. #define CL_DEVICE_PARTITION_FAILED_EXT -1057
  155. #define CL_INVALID_PARTITION_COUNT_EXT -1058
  156. #define CL_INVALID_PARTITION_NAME_EXT -1059
  157. /* CL_AFFINITY_DOMAINs */
  158. #define CL_AFFINITY_DOMAIN_L1_CACHE_EXT 0x1
  159. #define CL_AFFINITY_DOMAIN_L2_CACHE_EXT 0x2
  160. #define CL_AFFINITY_DOMAIN_L3_CACHE_EXT 0x3
  161. #define CL_AFFINITY_DOMAIN_L4_CACHE_EXT 0x4
  162. #define CL_AFFINITY_DOMAIN_NUMA_EXT 0x10
  163. #define CL_AFFINITY_DOMAIN_NEXT_FISSIONABLE_EXT 0x100
  164. /* cl_device_partition_property_ext list terminators */
  165. #define CL_PROPERTIES_LIST_END_EXT ((cl_device_partition_property_ext) 0)
  166. #define CL_PARTITION_BY_COUNTS_LIST_END_EXT ((cl_device_partition_property_ext) 0)
  167. #define CL_PARTITION_BY_NAMES_LIST_END_EXT ((cl_device_partition_property_ext) 0 - 1)
  168. #endif /* CL_VERSION_1_1 */
  169. #ifdef __cplusplus
  170. }
  171. #endif
  172. #endif /* __CL_EXT_H */