Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. /*******************************************************************************
  2.  * Copyright (c) 2008-2013 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_fp16 extension - no extension #define since it has no functions  */
  44. #define CL_DEVICE_HALF_FP_CONFIG                    0x1033
  45.  
  46. /* Memory object destruction
  47.  *
  48.  * Apple extension for use to manage externally allocated buffers used with cl_mem objects with CL_MEM_USE_HOST_PTR
  49.  *
  50.  * Registers a user callback function that will be called when the memory object is deleted and its resources
  51.  * freed. Each call to clSetMemObjectCallbackFn registers the specified user callback function on a callback
  52.  * stack associated with memobj. The registered user callback functions are called in the reverse order in
  53.  * which they were registered. The user callback functions are called and then the memory object is deleted
  54.  * and its resources freed. This provides a mechanism for the application (and libraries) using memobj to be
  55.  * notified when the memory referenced by host_ptr, specified when the memory object is created and used as
  56.  * the storage bits for the memory object, can be reused or freed.
  57.  *
  58.  * The application may not call CL api's with the cl_mem object passed to the pfn_notify.
  59.  *
  60.  * Please check for the "cl_APPLE_SetMemObjectDestructor" extension using clGetDeviceInfo(CL_DEVICE_EXTENSIONS)
  61.  * before using.
  62.  */
  63. #define cl_APPLE_SetMemObjectDestructor 1
  64. cl_int  CL_API_ENTRY clSetMemObjectDestructorAPPLE(  cl_mem /* memobj */,
  65.                                         void (* /*pfn_notify*/)( cl_mem /* memobj */, void* /*user_data*/),
  66.                                         void * /*user_data */ )             CL_EXT_SUFFIX__VERSION_1_0;  
  67.  
  68.  
  69. /* Context Logging Functions
  70.  *
  71.  * The next three convenience functions are intended to be used as the pfn_notify parameter to clCreateContext().
  72.  * Please check for the "cl_APPLE_ContextLoggingFunctions" extension using clGetDeviceInfo(CL_DEVICE_EXTENSIONS)
  73.  * before using.
  74.  *
  75.  * clLogMessagesToSystemLog fowards on all log messages to the Apple System Logger
  76.  */
  77. #define cl_APPLE_ContextLoggingFunctions 1
  78. extern void CL_API_ENTRY clLogMessagesToSystemLogAPPLE(  const char * /* errstr */,
  79.                                             const void * /* private_info */,
  80.                                             size_t       /* cb */,
  81.                                             void *       /* user_data */ )  CL_EXT_SUFFIX__VERSION_1_0;
  82.  
  83. /* clLogMessagesToStdout sends all log messages to the file descriptor stdout */
  84. extern void CL_API_ENTRY clLogMessagesToStdoutAPPLE(   const char * /* errstr */,
  85.                                           const void * /* private_info */,
  86.                                           size_t       /* cb */,
  87.                                           void *       /* user_data */ )    CL_EXT_SUFFIX__VERSION_1_0;
  88.  
  89. /* clLogMessagesToStderr sends all log messages to the file descriptor stderr */
  90. extern void CL_API_ENTRY clLogMessagesToStderrAPPLE(   const char * /* errstr */,
  91.                                           const void * /* private_info */,
  92.                                           size_t       /* cb */,
  93.                                           void *       /* user_data */ )    CL_EXT_SUFFIX__VERSION_1_0;
  94.  
  95.  
  96. /************************
  97. * cl_khr_icd extension *                                                  
  98. ************************/
  99. #define cl_khr_icd 1
  100.  
  101. /* cl_platform_info                                                        */
  102. #define CL_PLATFORM_ICD_SUFFIX_KHR                  0x0920
  103.  
  104. /* Additional Error Codes                                                  */
  105. #define CL_PLATFORM_NOT_FOUND_KHR                   -1001
  106.  
  107. extern CL_API_ENTRY cl_int CL_API_CALL
  108. clIcdGetPlatformIDsKHR(cl_uint          /* num_entries */,
  109.                        cl_platform_id * /* platforms */,
  110.                        cl_uint *        /* num_platforms */);
  111.  
  112. typedef CL_API_ENTRY cl_int (CL_API_CALL *clIcdGetPlatformIDsKHR_fn)(
  113.     cl_uint          /* num_entries */,
  114.     cl_platform_id * /* platforms */,
  115.     cl_uint *        /* num_platforms */);
  116.  
  117.  
  118. /* Extension: cl_khr_image2D_buffer
  119.  *
  120.  * This extension allows a 2D image to be created from a cl_mem buffer without a copy.
  121.  * The type associated with a 2D image created from a buffer in an OpenCL program is image2d_t.
  122.  * Both the sampler and sampler-less read_image built-in functions are supported for 2D images
  123.  * and 2D images created from a buffer.  Similarly, the write_image built-ins are also supported
  124.  * for 2D images created from a buffer.
  125.  *
  126.  * When the 2D image from buffer is created, the client must specify the width,
  127.  * height, image format (i.e. channel order and channel data type) and optionally the row pitch
  128.  *
  129.  * The pitch specified must be a multiple of CL_DEVICE_IMAGE_PITCH_ALIGNMENT pixels.
  130.  * The base address of the buffer must be aligned to CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT pixels.
  131.  */
  132.    
  133. /*************************************
  134.  * cl_khr_initalize_memory extension *
  135.  *************************************/
  136.    
  137. #define CL_CONTEXT_MEMORY_INITIALIZE_KHR            0x200E
  138.    
  139.    
  140. /**************************************
  141.  * cl_khr_terminate_context extension *
  142.  **************************************/
  143.    
  144. #define CL_DEVICE_TERMINATE_CAPABILITY_KHR          0x200F
  145. #define CL_CONTEXT_TERMINATE_KHR                    0x2010
  146.  
  147. #define cl_khr_terminate_context 1
  148. extern CL_API_ENTRY cl_int CL_API_CALL clTerminateContextKHR(cl_context /* context */) CL_EXT_SUFFIX__VERSION_1_2;
  149.  
  150. typedef CL_API_ENTRY cl_int (CL_API_CALL *clTerminateContextKHR_fn)(cl_context /* context */) CL_EXT_SUFFIX__VERSION_1_2;
  151.    
  152.    
  153. /*
  154.  * Extension: cl_khr_spir
  155.  *
  156.  * This extension adds support to create an OpenCL program object from a
  157.  * Standard Portable Intermediate Representation (SPIR) instance
  158.  */
  159.  
  160. #define CL_DEVICE_SPIR_VERSIONS                     0x40E0
  161. #define CL_PROGRAM_BINARY_TYPE_INTERMEDIATE         0x40E1
  162.  
  163.  
  164. /******************************************
  165. * cl_nv_device_attribute_query extension *
  166. ******************************************/
  167. /* cl_nv_device_attribute_query extension - no extension #define since it has no functions */
  168. #define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV       0x4000
  169. #define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV       0x4001
  170. #define CL_DEVICE_REGISTERS_PER_BLOCK_NV            0x4002
  171. #define CL_DEVICE_WARP_SIZE_NV                      0x4003
  172. #define CL_DEVICE_GPU_OVERLAP_NV                    0x4004
  173. #define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV            0x4005
  174. #define CL_DEVICE_INTEGRATED_MEMORY_NV              0x4006
  175.  
  176. /*********************************
  177. * cl_amd_device_attribute_query *
  178. *********************************/
  179. #define CL_DEVICE_PROFILING_TIMER_OFFSET_AMD        0x4036
  180.  
  181. /*********************************
  182. * cl_arm_printf extension
  183. *********************************/
  184. #define CL_PRINTF_CALLBACK_ARM                      0x40B0
  185. #define CL_PRINTF_BUFFERSIZE_ARM                    0x40B1
  186.  
  187. #ifdef CL_VERSION_1_1
  188.    /***********************************
  189.     * cl_ext_device_fission extension *
  190.     ***********************************/
  191.     #define cl_ext_device_fission   1
  192.    
  193.     extern CL_API_ENTRY cl_int CL_API_CALL
  194.     clReleaseDeviceEXT( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
  195.    
  196.     typedef CL_API_ENTRY cl_int
  197.     (CL_API_CALL *clReleaseDeviceEXT_fn)( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
  198.  
  199.     extern CL_API_ENTRY cl_int CL_API_CALL
  200.     clRetainDeviceEXT( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
  201.    
  202.     typedef CL_API_ENTRY cl_int
  203.     (CL_API_CALL *clRetainDeviceEXT_fn)( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
  204.  
  205.     typedef cl_ulong  cl_device_partition_property_ext;
  206.     extern CL_API_ENTRY cl_int CL_API_CALL
  207.     clCreateSubDevicesEXT(  cl_device_id /*in_device*/,
  208.                             const cl_device_partition_property_ext * /* properties */,
  209.                             cl_uint /*num_entries*/,
  210.                             cl_device_id * /*out_devices*/,
  211.                             cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__VERSION_1_1;
  212.  
  213.     typedef CL_API_ENTRY cl_int
  214.     ( CL_API_CALL * clCreateSubDevicesEXT_fn)(  cl_device_id /*in_device*/,
  215.                                                 const cl_device_partition_property_ext * /* properties */,
  216.                                                 cl_uint /*num_entries*/,
  217.                                                 cl_device_id * /*out_devices*/,
  218.                                                 cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__VERSION_1_1;
  219.  
  220.     /* cl_device_partition_property_ext */
  221.     #define CL_DEVICE_PARTITION_EQUALLY_EXT             0x4050
  222.     #define CL_DEVICE_PARTITION_BY_COUNTS_EXT           0x4051
  223.     #define CL_DEVICE_PARTITION_BY_NAMES_EXT            0x4052
  224.     #define CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN_EXT  0x4053
  225.    
  226.     /* clDeviceGetInfo selectors */
  227.     #define CL_DEVICE_PARENT_DEVICE_EXT                 0x4054
  228.     #define CL_DEVICE_PARTITION_TYPES_EXT               0x4055
  229.     #define CL_DEVICE_AFFINITY_DOMAINS_EXT              0x4056
  230.     #define CL_DEVICE_REFERENCE_COUNT_EXT               0x4057
  231.     #define CL_DEVICE_PARTITION_STYLE_EXT               0x4058
  232.    
  233.     /* error codes */
  234.     #define CL_DEVICE_PARTITION_FAILED_EXT              -1057
  235.     #define CL_INVALID_PARTITION_COUNT_EXT              -1058
  236.     #define CL_INVALID_PARTITION_NAME_EXT               -1059
  237.    
  238.     /* CL_AFFINITY_DOMAINs */
  239.     #define CL_AFFINITY_DOMAIN_L1_CACHE_EXT             0x1
  240.     #define CL_AFFINITY_DOMAIN_L2_CACHE_EXT             0x2
  241.     #define CL_AFFINITY_DOMAIN_L3_CACHE_EXT             0x3
  242.     #define CL_AFFINITY_DOMAIN_L4_CACHE_EXT             0x4
  243.     #define CL_AFFINITY_DOMAIN_NUMA_EXT                 0x10
  244.     #define CL_AFFINITY_DOMAIN_NEXT_FISSIONABLE_EXT     0x100
  245.    
  246.     /* cl_device_partition_property_ext list terminators */
  247.     #define CL_PROPERTIES_LIST_END_EXT                  ((cl_device_partition_property_ext) 0)
  248.     #define CL_PARTITION_BY_COUNTS_LIST_END_EXT         ((cl_device_partition_property_ext) 0)
  249.     #define CL_PARTITION_BY_NAMES_LIST_END_EXT          ((cl_device_partition_property_ext) 0 - 1)
  250.  
  251. /*********************************
  252. * cl_qcom_ext_host_ptr extension
  253. *********************************/
  254.  
  255. #define CL_MEM_EXT_HOST_PTR_QCOM                  (1 << 29)
  256.  
  257. #define CL_DEVICE_EXT_MEM_PADDING_IN_BYTES_QCOM   0x40A0      
  258. #define CL_DEVICE_PAGE_SIZE_QCOM                  0x40A1
  259. #define CL_IMAGE_ROW_ALIGNMENT_QCOM               0x40A2
  260. #define CL_IMAGE_SLICE_ALIGNMENT_QCOM             0x40A3
  261. #define CL_MEM_HOST_UNCACHED_QCOM                 0x40A4
  262. #define CL_MEM_HOST_WRITEBACK_QCOM                0x40A5
  263. #define CL_MEM_HOST_WRITETHROUGH_QCOM             0x40A6
  264. #define CL_MEM_HOST_WRITE_COMBINING_QCOM          0x40A7
  265.  
  266. typedef cl_uint                                   cl_image_pitch_info_qcom;
  267.  
  268. extern CL_API_ENTRY cl_int CL_API_CALL
  269. clGetDeviceImageInfoQCOM(cl_device_id             device,
  270.                          size_t                   image_width,
  271.                          size_t                   image_height,
  272.                          const cl_image_format   *image_format,
  273.                          cl_image_pitch_info_qcom param_name,
  274.                          size_t                   param_value_size,
  275.                          void                    *param_value,
  276.                          size_t                  *param_value_size_ret);
  277.  
  278. typedef struct _cl_mem_ext_host_ptr
  279. {
  280.     /* Type of external memory allocation. */
  281.     /* Legal values will be defined in layered extensions. */
  282.     cl_uint  allocation_type;
  283.            
  284.         /* Host cache policy for this external memory allocation. */
  285.     cl_uint  host_cache_policy;
  286.  
  287. } cl_mem_ext_host_ptr;
  288.  
  289. /*********************************
  290. * cl_qcom_ion_host_ptr extension
  291. *********************************/
  292.  
  293. #define CL_MEM_ION_HOST_PTR_QCOM                  0x40A8
  294.  
  295. typedef struct _cl_mem_ion_host_ptr
  296. {
  297.     /* Type of external memory allocation. */
  298.     /* Must be CL_MEM_ION_HOST_PTR_QCOM for ION allocations. */
  299.     cl_mem_ext_host_ptr  ext_host_ptr;
  300.  
  301.     /* ION file descriptor */
  302.     int                  ion_filedesc;
  303.            
  304.     /* Host pointer to the ION allocated memory */
  305.     void*                ion_hostptr;
  306.  
  307. } cl_mem_ion_host_ptr;
  308.  
  309. #endif /* CL_VERSION_1_1 */
  310.  
  311. #ifdef __cplusplus
  312. }
  313. #endif
  314.  
  315.  
  316. #endif /* __CL_EXT_H */
  317.