Path: blob/master/3rdparty/include/opencl/1.2/CL/cl_ext.h
16348 views
/*******************************************************************************1* Copyright (c) 2008-2013 The Khronos Group Inc.2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and/or associated documentation files (the5* "Materials"), to deal in the Materials without restriction, including6* without limitation the rights to use, copy, modify, merge, publish,7* distribute, sublicense, and/or sell copies of the Materials, and to8* permit persons to whom the Materials are furnished to do so, subject to9* the following conditions:10*11* The above copyright notice and this permission notice shall be included12* in all copies or substantial portions of the Materials.13*14* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,15* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF16* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.17* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY18* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,19* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE20* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.21******************************************************************************/2223/* $Revision: 11928 $ on $Date: 2010-07-13 09:04:56 -0700 (Tue, 13 Jul 2010) $ */2425/* cl_ext.h contains OpenCL extensions which don't have external */26/* (OpenGL, D3D) dependencies. */2728#ifndef __CL_EXT_H29#define __CL_EXT_H3031#ifdef __cplusplus32extern "C" {33#endif3435#ifdef __APPLE__36#include <OpenCL/cl.h>37#include <AvailabilityMacros.h>38#else39#include <CL/cl.h>40#endif4142/* cl_khr_fp16 extension - no extension #define since it has no functions */43#define CL_DEVICE_HALF_FP_CONFIG 0x10334445/* Memory object destruction46*47* Apple extension for use to manage externally allocated buffers used with cl_mem objects with CL_MEM_USE_HOST_PTR48*49* Registers a user callback function that will be called when the memory object is deleted and its resources50* freed. Each call to clSetMemObjectCallbackFn registers the specified user callback function on a callback51* stack associated with memobj. The registered user callback functions are called in the reverse order in52* which they were registered. The user callback functions are called and then the memory object is deleted53* and its resources freed. This provides a mechanism for the application (and libraries) using memobj to be54* notified when the memory referenced by host_ptr, specified when the memory object is created and used as55* the storage bits for the memory object, can be reused or freed.56*57* The application may not call CL api's with the cl_mem object passed to the pfn_notify.58*59* Please check for the "cl_APPLE_SetMemObjectDestructor" extension using clGetDeviceInfo(CL_DEVICE_EXTENSIONS)60* before using.61*/62#define cl_APPLE_SetMemObjectDestructor 163cl_int CL_API_ENTRY clSetMemObjectDestructorAPPLE( cl_mem /* memobj */,64void (* /*pfn_notify*/)( cl_mem /* memobj */, void* /*user_data*/),65void * /*user_data */ ) CL_EXT_SUFFIX__VERSION_1_0;666768/* Context Logging Functions69*70* The next three convenience functions are intended to be used as the pfn_notify parameter to clCreateContext().71* Please check for the "cl_APPLE_ContextLoggingFunctions" extension using clGetDeviceInfo(CL_DEVICE_EXTENSIONS)72* before using.73*74* clLogMessagesToSystemLog fowards on all log messages to the Apple System Logger75*/76#define cl_APPLE_ContextLoggingFunctions 177extern void CL_API_ENTRY clLogMessagesToSystemLogAPPLE( const char * /* errstr */,78const void * /* private_info */,79size_t /* cb */,80void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0;8182/* clLogMessagesToStdout sends all log messages to the file descriptor stdout */83extern void CL_API_ENTRY clLogMessagesToStdoutAPPLE( const char * /* errstr */,84const void * /* private_info */,85size_t /* cb */,86void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0;8788/* clLogMessagesToStderr sends all log messages to the file descriptor stderr */89extern void CL_API_ENTRY clLogMessagesToStderrAPPLE( const char * /* errstr */,90const void * /* private_info */,91size_t /* cb */,92void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0;939495/************************96* cl_khr_icd extension *97************************/98#define cl_khr_icd 199100/* cl_platform_info */101#define CL_PLATFORM_ICD_SUFFIX_KHR 0x0920102103/* Additional Error Codes */104#define CL_PLATFORM_NOT_FOUND_KHR -1001105106extern CL_API_ENTRY cl_int CL_API_CALL107clIcdGetPlatformIDsKHR(cl_uint /* num_entries */,108cl_platform_id * /* platforms */,109cl_uint * /* num_platforms */);110111typedef CL_API_ENTRY cl_int (CL_API_CALL *clIcdGetPlatformIDsKHR_fn)(112cl_uint /* num_entries */,113cl_platform_id * /* platforms */,114cl_uint * /* num_platforms */);115116117/* Extension: cl_khr_image2D_buffer118*119* This extension allows a 2D image to be created from a cl_mem buffer without a copy.120* The type associated with a 2D image created from a buffer in an OpenCL program is image2d_t.121* Both the sampler and sampler-less read_image built-in functions are supported for 2D images122* and 2D images created from a buffer. Similarly, the write_image built-ins are also supported123* for 2D images created from a buffer.124*125* When the 2D image from buffer is created, the client must specify the width,126* height, image format (i.e. channel order and channel data type) and optionally the row pitch127*128* The pitch specified must be a multiple of CL_DEVICE_IMAGE_PITCH_ALIGNMENT pixels.129* The base address of the buffer must be aligned to CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT pixels.130*/131132/*************************************133* cl_khr_initalize_memory extension *134*************************************/135136#define CL_CONTEXT_MEMORY_INITIALIZE_KHR 0x200E137138139/**************************************140* cl_khr_terminate_context extension *141**************************************/142143#define CL_DEVICE_TERMINATE_CAPABILITY_KHR 0x200F144#define CL_CONTEXT_TERMINATE_KHR 0x2010145146#define cl_khr_terminate_context 1147extern CL_API_ENTRY cl_int CL_API_CALL clTerminateContextKHR(cl_context /* context */) CL_EXT_SUFFIX__VERSION_1_2;148149typedef CL_API_ENTRY cl_int (CL_API_CALL *clTerminateContextKHR_fn)(cl_context /* context */) CL_EXT_SUFFIX__VERSION_1_2;150151152/*153* Extension: cl_khr_spir154*155* This extension adds support to create an OpenCL program object from a156* Standard Portable Intermediate Representation (SPIR) instance157*/158159/******************************************160* cl_nv_device_attribute_query extension *161******************************************/162/* cl_nv_device_attribute_query extension - no extension #define since it has no functions */163#define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000164#define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001165#define CL_DEVICE_REGISTERS_PER_BLOCK_NV 0x4002166#define CL_DEVICE_WARP_SIZE_NV 0x4003167#define CL_DEVICE_GPU_OVERLAP_NV 0x4004168#define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV 0x4005169#define CL_DEVICE_INTEGRATED_MEMORY_NV 0x4006170171/*********************************172* cl_amd_device_attribute_query *173*********************************/174#define CL_DEVICE_PROFILING_TIMER_OFFSET_AMD 0x4036175176#ifdef CL_VERSION_1_1177/***********************************178* cl_ext_device_fission extension *179***********************************/180#define cl_ext_device_fission 1181182extern CL_API_ENTRY cl_int CL_API_CALL183clReleaseDeviceEXT( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;184185typedef CL_API_ENTRY cl_int186(CL_API_CALL *clReleaseDeviceEXT_fn)( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;187188extern CL_API_ENTRY cl_int CL_API_CALL189clRetainDeviceEXT( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;190191typedef CL_API_ENTRY cl_int192(CL_API_CALL *clRetainDeviceEXT_fn)( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;193194typedef cl_ulong cl_device_partition_property_ext;195extern CL_API_ENTRY cl_int CL_API_CALL196clCreateSubDevicesEXT( cl_device_id /*in_device*/,197const cl_device_partition_property_ext * /* properties */,198cl_uint /*num_entries*/,199cl_device_id * /*out_devices*/,200cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__VERSION_1_1;201202typedef CL_API_ENTRY cl_int203( CL_API_CALL * clCreateSubDevicesEXT_fn)( cl_device_id /*in_device*/,204const cl_device_partition_property_ext * /* properties */,205cl_uint /*num_entries*/,206cl_device_id * /*out_devices*/,207cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__VERSION_1_1;208209/* cl_device_partition_property_ext */210#define CL_DEVICE_PARTITION_EQUALLY_EXT 0x4050211#define CL_DEVICE_PARTITION_BY_COUNTS_EXT 0x4051212#define CL_DEVICE_PARTITION_BY_NAMES_EXT 0x4052213#define CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN_EXT 0x4053214215/* clDeviceGetInfo selectors */216#define CL_DEVICE_PARENT_DEVICE_EXT 0x4054217#define CL_DEVICE_PARTITION_TYPES_EXT 0x4055218#define CL_DEVICE_AFFINITY_DOMAINS_EXT 0x4056219#define CL_DEVICE_REFERENCE_COUNT_EXT 0x4057220#define CL_DEVICE_PARTITION_STYLE_EXT 0x4058221222/* error codes */223#define CL_DEVICE_PARTITION_FAILED_EXT -1057224#define CL_INVALID_PARTITION_COUNT_EXT -1058225#define CL_INVALID_PARTITION_NAME_EXT -1059226227/* CL_AFFINITY_DOMAINs */228#define CL_AFFINITY_DOMAIN_L1_CACHE_EXT 0x1229#define CL_AFFINITY_DOMAIN_L2_CACHE_EXT 0x2230#define CL_AFFINITY_DOMAIN_L3_CACHE_EXT 0x3231#define CL_AFFINITY_DOMAIN_L4_CACHE_EXT 0x4232#define CL_AFFINITY_DOMAIN_NUMA_EXT 0x10233#define CL_AFFINITY_DOMAIN_NEXT_FISSIONABLE_EXT 0x100234235/* cl_device_partition_property_ext list terminators */236#define CL_PROPERTIES_LIST_END_EXT ((cl_device_partition_property_ext) 0)237#define CL_PARTITION_BY_COUNTS_LIST_END_EXT ((cl_device_partition_property_ext) 0)238#define CL_PARTITION_BY_NAMES_LIST_END_EXT ((cl_device_partition_property_ext) 0 - 1)239240/*********************************241* cl_qcom_ext_host_ptr extension242*********************************/243244#define CL_MEM_EXT_HOST_PTR_QCOM (1 << 29)245246#define CL_DEVICE_EXT_MEM_PADDING_IN_BYTES_QCOM 0x40A0247#define CL_DEVICE_PAGE_SIZE_QCOM 0x40A1248#define CL_IMAGE_ROW_ALIGNMENT_QCOM 0x40A2249#define CL_IMAGE_SLICE_ALIGNMENT_QCOM 0x40A3250#define CL_MEM_HOST_UNCACHED_QCOM 0x40A4251#define CL_MEM_HOST_WRITEBACK_QCOM 0x40A5252#define CL_MEM_HOST_WRITETHROUGH_QCOM 0x40A6253#define CL_MEM_HOST_WRITE_COMBINING_QCOM 0x40A7254255typedef cl_uint cl_image_pitch_info_qcom;256257extern CL_API_ENTRY cl_int CL_API_CALL258clGetDeviceImageInfoQCOM(cl_device_id device,259size_t image_width,260size_t image_height,261const cl_image_format *image_format,262cl_image_pitch_info_qcom param_name,263size_t param_value_size,264void *param_value,265size_t *param_value_size_ret);266267typedef struct _cl_mem_ext_host_ptr268{269// Type of external memory allocation.270// Legal values will be defined in layered extensions.271cl_uint allocation_type;272273// Host cache policy for this external memory allocation.274cl_uint host_cache_policy;275276} cl_mem_ext_host_ptr;277278/*********************************279* cl_qcom_ion_host_ptr extension280*********************************/281282#define CL_MEM_ION_HOST_PTR_QCOM 0x40A8283284typedef struct _cl_mem_ion_host_ptr285{286// Type of external memory allocation.287// Must be CL_MEM_ION_HOST_PTR_QCOM for ION allocations.288cl_mem_ext_host_ptr ext_host_ptr;289290// ION file descriptor291int ion_filedesc;292293// Host pointer to the ION allocated memory294void* ion_hostptr;295296} cl_mem_ion_host_ptr;297298#endif /* CL_VERSION_1_1 */299300#ifdef __cplusplus301}302#endif303304305#endif /* __CL_EXT_H */306307308