155#if defined(__CL_ENABLE_EXCEPTIONS)
159#pragma push_macro("max")
161#if defined(USE_DX_INTEROP)
162#include <CL/cl_d3d10.h>
163#include <CL/cl_dx9_media_sharing.h>
168#if defined(USE_CL_DEVICE_FISSION)
169#include <CL/cl_ext.h>
172#if defined(__APPLE__) || defined(__MACOSX)
173#include <OpenGL/OpenGL.h>
174#include <OpenCL/opencl.h>
175#include <libkern/OSAtomic.h>
178#include <CL/opencl.h>
184#if defined(CL_VERSION_1_2) && !defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
185#define __CL_EXPLICIT_CONSTRUCTORS explicit
187#define __CL_EXPLICIT_CONSTRUCTORS
192#if !defined(CL_EXT_PREFIX__VERSION_1_1_DEPRECATED)
193#define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
195#if !defined(CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED)
196#define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
199#if !defined(CL_CALLBACK)
206#if !defined(__NO_STD_VECTOR)
210#if !defined(__NO_STD_STRING)
214#if defined(linux) || defined(__APPLE__) || defined(__MACOSX)
217#include <emmintrin.h>
218#include <xmmintrin.h>
236#if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS) || (defined(CL_VERSION_1_1) && !defined(CL_VERSION_1_2))
237#define __INIT_CL_EXT_FCN_PTR(name) \
239 pfn_##name = (PFN_##name) \
240 clGetExtensionFunctionAddress(#name); \
246#if defined(CL_VERSION_1_2)
247#define __INIT_CL_EXT_FCN_PTR_PLATFORM(platform, name) \
249 pfn_##name = (PFN_##name) \
250 clGetExtensionFunctionAddressForPlatform(platform, #name); \
263#if defined(__CL_ENABLE_EXCEPTIONS)
272 const char * errStr_;
283 Error(cl_int err,
const char * errStr = NULL) : err_(err), errStr_(errStr)
292 virtual const char * what()
const throw ()
294 if (errStr_ == NULL) {
306 cl_int err(
void)
const {
return err_; }
309#define __ERR_STR(x) #x
311#define __ERR_STR(x) NULL
317#if defined(__CL_ENABLE_EXCEPTIONS)
318static inline cl_int errHandler (
320 const char * errStr = NULL)
322 if (err != CL_SUCCESS) {
323 throw Error(err, errStr);
328static inline cl_int errHandler (cl_int err,
const char * errStr = NULL)
339#if !defined(__CL_USER_OVERRIDE_ERROR_STRINGS)
340#define __GET_DEVICE_INFO_ERR __ERR_STR(clGetDeviceInfo)
341#define __GET_PLATFORM_INFO_ERR __ERR_STR(clGetPlatformInfo)
342#define __GET_DEVICE_IDS_ERR __ERR_STR(clGetDeviceIDs)
343#define __GET_PLATFORM_IDS_ERR __ERR_STR(clGetPlatformIDs)
344#define __GET_CONTEXT_INFO_ERR __ERR_STR(clGetContextInfo)
345#define __GET_EVENT_INFO_ERR __ERR_STR(clGetEventInfo)
346#define __GET_EVENT_PROFILE_INFO_ERR __ERR_STR(clGetEventProfileInfo)
347#define __GET_MEM_OBJECT_INFO_ERR __ERR_STR(clGetMemObjectInfo)
348#define __GET_IMAGE_INFO_ERR __ERR_STR(clGetImageInfo)
349#define __GET_SAMPLER_INFO_ERR __ERR_STR(clGetSamplerInfo)
350#define __GET_KERNEL_INFO_ERR __ERR_STR(clGetKernelInfo)
351#if defined(CL_VERSION_1_2)
352#define __GET_KERNEL_ARG_INFO_ERR __ERR_STR(clGetKernelArgInfo)
354#define __GET_KERNEL_WORK_GROUP_INFO_ERR __ERR_STR(clGetKernelWorkGroupInfo)
355#define __GET_PROGRAM_INFO_ERR __ERR_STR(clGetProgramInfo)
356#define __GET_PROGRAM_BUILD_INFO_ERR __ERR_STR(clGetProgramBuildInfo)
357#define __GET_COMMAND_QUEUE_INFO_ERR __ERR_STR(clGetCommandQueueInfo)
359#define __CREATE_CONTEXT_ERR __ERR_STR(clCreateContext)
360#define __CREATE_CONTEXT_FROM_TYPE_ERR __ERR_STR(clCreateContextFromType)
361#define __GET_SUPPORTED_IMAGE_FORMATS_ERR __ERR_STR(clGetSupportedImageFormats)
363#define __CREATE_BUFFER_ERR __ERR_STR(clCreateBuffer)
364#define __COPY_ERR __ERR_STR(cl::copy)
365#define __CREATE_SUBBUFFER_ERR __ERR_STR(clCreateSubBuffer)
366#define __CREATE_GL_BUFFER_ERR __ERR_STR(clCreateFromGLBuffer)
367#define __CREATE_GL_RENDER_BUFFER_ERR __ERR_STR(clCreateFromGLBuffer)
368#define __GET_GL_OBJECT_INFO_ERR __ERR_STR(clGetGLObjectInfo)
369#if defined(CL_VERSION_1_2)
370#define __CREATE_IMAGE_ERR __ERR_STR(clCreateImage)
371#define __CREATE_GL_TEXTURE_ERR __ERR_STR(clCreateFromGLTexture)
372#define __IMAGE_DIMENSION_ERR __ERR_STR(Incorrect image dimensions)
374#define __CREATE_SAMPLER_ERR __ERR_STR(clCreateSampler)
375#define __SET_MEM_OBJECT_DESTRUCTOR_CALLBACK_ERR __ERR_STR(clSetMemObjectDestructorCallback)
377#define __CREATE_USER_EVENT_ERR __ERR_STR(clCreateUserEvent)
378#define __SET_USER_EVENT_STATUS_ERR __ERR_STR(clSetUserEventStatus)
379#define __SET_EVENT_CALLBACK_ERR __ERR_STR(clSetEventCallback)
380#define __WAIT_FOR_EVENTS_ERR __ERR_STR(clWaitForEvents)
382#define __CREATE_KERNEL_ERR __ERR_STR(clCreateKernel)
383#define __SET_KERNEL_ARGS_ERR __ERR_STR(clSetKernelArg)
384#define __CREATE_PROGRAM_WITH_SOURCE_ERR __ERR_STR(clCreateProgramWithSource)
385#define __CREATE_PROGRAM_WITH_BINARY_ERR __ERR_STR(clCreateProgramWithBinary)
386#if defined(CL_VERSION_1_2)
387#define __CREATE_PROGRAM_WITH_BUILT_IN_KERNELS_ERR __ERR_STR(clCreateProgramWithBuiltInKernels)
389#define __BUILD_PROGRAM_ERR __ERR_STR(clBuildProgram)
390#if defined(CL_VERSION_1_2)
391#define __COMPILE_PROGRAM_ERR __ERR_STR(clCompileProgram)
394#define __CREATE_KERNELS_IN_PROGRAM_ERR __ERR_STR(clCreateKernelsInProgram)
396#define __CREATE_COMMAND_QUEUE_ERR __ERR_STR(clCreateCommandQueue)
397#define __SET_COMMAND_QUEUE_PROPERTY_ERR __ERR_STR(clSetCommandQueueProperty)
398#define __ENQUEUE_READ_BUFFER_ERR __ERR_STR(clEnqueueReadBuffer)
399#define __ENQUEUE_READ_BUFFER_RECT_ERR __ERR_STR(clEnqueueReadBufferRect)
400#define __ENQUEUE_WRITE_BUFFER_ERR __ERR_STR(clEnqueueWriteBuffer)
401#define __ENQUEUE_WRITE_BUFFER_RECT_ERR __ERR_STR(clEnqueueWriteBufferRect)
402#define __ENQEUE_COPY_BUFFER_ERR __ERR_STR(clEnqueueCopyBuffer)
403#define __ENQEUE_COPY_BUFFER_RECT_ERR __ERR_STR(clEnqueueCopyBufferRect)
404#define __ENQUEUE_FILL_BUFFER_ERR __ERR_STR(clEnqueueFillBuffer)
405#define __ENQUEUE_READ_IMAGE_ERR __ERR_STR(clEnqueueReadImage)
406#define __ENQUEUE_WRITE_IMAGE_ERR __ERR_STR(clEnqueueWriteImage)
407#define __ENQUEUE_COPY_IMAGE_ERR __ERR_STR(clEnqueueCopyImage)
408#define __ENQUEUE_FILL_IMAGE_ERR __ERR_STR(clEnqueueFillImage)
409#define __ENQUEUE_COPY_IMAGE_TO_BUFFER_ERR __ERR_STR(clEnqueueCopyImageToBuffer)
410#define __ENQUEUE_COPY_BUFFER_TO_IMAGE_ERR __ERR_STR(clEnqueueCopyBufferToImage)
411#define __ENQUEUE_MAP_BUFFER_ERR __ERR_STR(clEnqueueMapBuffer)
412#define __ENQUEUE_MAP_IMAGE_ERR __ERR_STR(clEnqueueMapImage)
413#define __ENQUEUE_UNMAP_MEM_OBJECT_ERR __ERR_STR(clEnqueueUnMapMemObject)
414#define __ENQUEUE_NDRANGE_KERNEL_ERR __ERR_STR(clEnqueueNDRangeKernel)
415#define __ENQUEUE_TASK_ERR __ERR_STR(clEnqueueTask)
416#define __ENQUEUE_NATIVE_KERNEL __ERR_STR(clEnqueueNativeKernel)
417#if defined(CL_VERSION_1_2)
418#define __ENQUEUE_MIGRATE_MEM_OBJECTS_ERR __ERR_STR(clEnqueueMigrateMemObjects)
421#define __ENQUEUE_ACQUIRE_GL_ERR __ERR_STR(clEnqueueAcquireGLObjects)
422#define __ENQUEUE_RELEASE_GL_ERR __ERR_STR(clEnqueueReleaseGLObjects)
425#define __RETAIN_ERR __ERR_STR(Retain Object)
426#define __RELEASE_ERR __ERR_STR(Release Object)
427#define __FLUSH_ERR __ERR_STR(clFlush)
428#define __FINISH_ERR __ERR_STR(clFinish)
429#define __VECTOR_CAPACITY_ERR __ERR_STR(Vector capacity error)
434#if defined(CL_VERSION_1_2)
435#define __CREATE_SUB_DEVICES __ERR_STR(clCreateSubDevices)
437#define __CREATE_SUB_DEVICES __ERR_STR(clCreateSubDevicesEXT)
443#if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS) || (defined(CL_VERSION_1_1) && !defined(CL_VERSION_1_2))
444#define __ENQUEUE_MARKER_ERR __ERR_STR(clEnqueueMarker)
445#define __ENQUEUE_WAIT_FOR_EVENTS_ERR __ERR_STR(clEnqueueWaitForEvents)
446#define __ENQUEUE_BARRIER_ERR __ERR_STR(clEnqueueBarrier)
447#define __UNLOAD_COMPILER_ERR __ERR_STR(clUnloadCompiler)
448#define __CREATE_GL_TEXTURE_2D_ERR __ERR_STR(clCreateFromGLTexture2D)
449#define __CREATE_GL_TEXTURE_3D_ERR __ERR_STR(clCreateFromGLTexture3D)
450#define __CREATE_IMAGE2D_ERR __ERR_STR(clCreateImage2D)
451#define __CREATE_IMAGE3D_ERR __ERR_STR(clCreateImage3D)
460#if defined(CL_VERSION_1_2)
461#define __ENQUEUE_MARKER_WAIT_LIST_ERR __ERR_STR(clEnqueueMarkerWithWaitList)
462#define __ENQUEUE_BARRIER_WAIT_LIST_ERR __ERR_STR(clEnqueueBarrierWithWaitList)
465#if !defined(__USE_DEV_STRING) && !defined(__NO_STD_STRING)
467#elif !defined(__USE_DEV_STRING)
484 string(
void) : size_(0), str_(NULL)
504 str_ =
new char[size_+1];
506 memcpy(str_, str, size_ *
sizeof(
char));
520 string(
const char * str) :
525 size_= ::strlen(str);
528 str_ =
new char[size_ + 1];
530 memcpy(str_, str, (size_ + 1) *
sizeof(
char));
548 char *newString =
new char[n + 1];
556 memcpy(newString, str_, (copySize + 1) *
sizeof(
char));
558 if( copySize < size_ ) {
559 memset(newString + copySize, 0, size_ - copySize);
561 newString[size_] =
'\0';
596 if (rhs.size_ == 0 || rhs.str_ == NULL) {
601 str_ =
new char[rhs.size_ + 1];
605 memcpy(str_, rhs.str_, (size_ + 1) *
sizeof(
char));
619 string(
const string& rhs) :
634 ::size_t
size(
void)
const {
return size_; }
637 ::size_t length(
void)
const {
return size(); }
642 const char * c_str(
void)
const {
return (str_) ? str_ :
"";}
647#if !defined(__USE_DEV_VECTOR) && !defined(__NO_STD_VECTOR)
648#define VECTOR_CLASS std::vector
649#elif !defined(__USE_DEV_VECTOR)
650#define VECTOR_CLASS cl::vector
652#if !defined(__MAX_DEFAULT_VECTOR_SIZE)
653#define __MAX_DEFAULT_VECTOR_SIZE 10
678template <
typename T,
unsigned int N = __MAX_DEFAULT_VECTOR_SIZE>
679class CL_EXT_PREFIX__VERSION_1_1_DEPRECATED vector CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
688 size_(static_cast<unsigned int>(0))
698 unsigned int size(
void)
const
719 void push_back (
const T& x)
722 new (&data_[size_]) T(x);
725 detail::errHandler(CL_MEM_OBJECT_ALLOCATION_FAILURE, __VECTOR_CAPACITY_ERR);
739 detail::errHandler(CL_MEM_OBJECT_ALLOCATION_FAILURE, __VECTOR_CAPACITY_ERR);
747 vector(
const vector<T, N>& vec) :
751 assign(vec.begin(), vec.end());
761 vector(
unsigned int size,
const T& val = T()) :
764 for (
unsigned int i = 0; i <
size; i++) {
776 vector<T, N>&
operator=(
const vector<T, N>& rhs)
782 if (rhs.size_ != 0) {
783 assign(rhs.begin(), rhs.end());
797 if (
size() != vec.size()) {
801 for(
unsigned int i = 0; i <
size(); ++i ) {
802 if(
operator[](i) != vec[i] ) {
810 operator T* () {
return data_; }
813 operator const T* ()
const {
return data_; }
816 bool empty (
void)
const
822 unsigned int max_size (
void)
const
828 unsigned int capacity ()
const
865 void assign(I start, I end)
868 while(start != end) {
880 const vector<T,N> *vec_;
888 iterator (
const vector<T,N> &vec,
int index) :
905 iterator(
const iterator& rhs) :
913 static iterator
begin(
const cl::vector<T,N> &vec)
920 static iterator
end(
const cl::vector<T,N> &vec)
922 iterator i(vec, vec.size());
929 return ((vec_ == i.vec_) &&
930 (index_ == i.index_));
935 return (!(*
this==i));
938 iterator& operator++()
944 iterator operator++(
int)
946 iterator retVal(*
this);
951 iterator& operator--()
957 iterator operator--(
int)
959 iterator retVal(*
this);
966 return (*vec_)[index_];
972 return iterator::begin(*
this);
975 iterator
begin(
void)
const
977 return iterator::begin(*
this);
982 return iterator::end(*
this);
985 iterator
end(
void)
const
987 return iterator::end(*
this);
1000 const T& front(
void)
const
1005 const T& back(
void)
const
1007 return data_[size_-1];
1017#define __DEFAULT_NOT_INITIALIZED 1
1018#define __DEFAULT_BEING_INITIALIZED 2
1019#define __DEFAULT_INITIALIZED 4
1024 inline int compare_exchange(
volatile int * dest,
int exchange,
int comparand)
1027 return (
int)(InterlockedCompareExchange(
1028 (
volatile long*)dest,
1031#elif defined(__APPLE__) || defined(__MACOSX)
1032 return OSAtomicOr32Orig((uint32_t)exchange, (
volatile uint32_t*)dest);
1034 return (__sync_val_compare_and_swap(
1041 inline void fence() { _mm_mfence(); }
1059 for(
int i = 0; i < N; ++i ) {
1066 return data_[index];
1069 const ::size_t& operator[](
int index)
const
1071 return data_[index];
1075 operator ::size_t* () {
return data_; }
1078 operator const ::size_t* ()
const {
return data_; }
1087template<
typename Functor,
typename T>
1088inline cl_int getInfoHelper(Functor f, cl_uint name, T* param,
long)
1090 return f(name,
sizeof(T), param, NULL);
1094template <
typename Func,
typename T>
1095inline cl_int getInfoHelper(Func f, cl_uint name, VECTOR_CLASS<T>* param,
long)
1098 cl_int err = f(name, 0, NULL, &required);
1099 if (err != CL_SUCCESS) {
1103 T* value = (T*) alloca(required);
1104 err = f(name, required, value, NULL);
1105 if (err != CL_SUCCESS) {
1109 param->assign(&value[0], &value[required/
sizeof(T)]);
1119template <
typename Func,
typename T>
1120inline cl_int getInfoHelper(Func f, cl_uint name, VECTOR_CLASS<T>* param,
int,
typename T::cl_type = 0)
1123 cl_int err = f(name, 0, NULL, &required);
1124 if (err != CL_SUCCESS) {
1128 typename T::cl_type * value = (
typename T::cl_type *) alloca(required);
1129 err = f(name, required, value, NULL);
1130 if (err != CL_SUCCESS) {
1134 ::size_t elements = required /
sizeof(
typename T::cl_type);
1135 param->assign(&value[0], &value[elements]);
1136 for (::size_t i = 0; i < elements; i++)
1138 if (value[i] != NULL)
1140 err = (*param)[i].retain();
1141 if (err != CL_SUCCESS) {
1150template <
typename Func>
1151inline cl_int getInfoHelper(Func f, cl_uint name, VECTOR_CLASS<char *>* param,
int)
1153 cl_int err = f(name, param->size() *
sizeof(
char *), &(*param)[0], NULL);
1155 if (err != CL_SUCCESS) {
1163template <
typename Func>
1164inline cl_int getInfoHelper(Func f, cl_uint name,
STRING_CLASS* param,
long)
1167 cl_int err = f(name, 0, NULL, &required);
1168 if (err != CL_SUCCESS) {
1172 char* value = (
char*) alloca(required);
1173 err = f(name, required, value, NULL);
1174 if (err != CL_SUCCESS) {
1183template <
typename Func, ::
size_t N>
1184inline cl_int getInfoHelper(Func f, cl_uint name, size_t<N>* param,
long)
1187 cl_int err = f(name, 0, NULL, &required);
1188 if (err != CL_SUCCESS) {
1192 ::size_t* value = (::size_t*) alloca(required);
1193 err = f(name, required, value, NULL);
1194 if (err != CL_SUCCESS) {
1198 for(
int i = 0; i < N; ++i) {
1199 (*param)[i] = value[i];
1205template<
typename T>
struct ReferenceHandler;
1213template<
typename Func,
typename T>
1214inline cl_int getInfoHelper(Func f, cl_uint name, T* param,
int,
typename T::cl_type = 0)
1216 typename T::cl_type value;
1217 cl_int err = f(name,
sizeof(value), &value, NULL);
1218 if (err != CL_SUCCESS) {
1224 err = param->retain();
1225 if (err != CL_SUCCESS) {
1232#define __PARAM_NAME_INFO_1_0(F) \
1233 F(cl_platform_info, CL_PLATFORM_PROFILE, STRING_CLASS) \
1234 F(cl_platform_info, CL_PLATFORM_VERSION, STRING_CLASS) \
1235 F(cl_platform_info, CL_PLATFORM_NAME, STRING_CLASS) \
1236 F(cl_platform_info, CL_PLATFORM_VENDOR, STRING_CLASS) \
1237 F(cl_platform_info, CL_PLATFORM_EXTENSIONS, STRING_CLASS) \
1239 F(cl_device_info, CL_DEVICE_TYPE, cl_device_type) \
1240 F(cl_device_info, CL_DEVICE_VENDOR_ID, cl_uint) \
1241 F(cl_device_info, CL_DEVICE_MAX_COMPUTE_UNITS, cl_uint) \
1242 F(cl_device_info, CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS, cl_uint) \
1243 F(cl_device_info, CL_DEVICE_MAX_WORK_GROUP_SIZE, ::size_t) \
1244 F(cl_device_info, CL_DEVICE_MAX_WORK_ITEM_SIZES, VECTOR_CLASS< ::size_t>) \
1245 F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR, cl_uint) \
1246 F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT, cl_uint) \
1247 F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT, cl_uint) \
1248 F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG, cl_uint) \
1249 F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT, cl_uint) \
1250 F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE, cl_uint) \
1251 F(cl_device_info, CL_DEVICE_MAX_CLOCK_FREQUENCY, cl_uint) \
1252 F(cl_device_info, CL_DEVICE_ADDRESS_BITS, cl_uint) \
1253 F(cl_device_info, CL_DEVICE_MAX_READ_IMAGE_ARGS, cl_uint) \
1254 F(cl_device_info, CL_DEVICE_MAX_WRITE_IMAGE_ARGS, cl_uint) \
1255 F(cl_device_info, CL_DEVICE_MAX_MEM_ALLOC_SIZE, cl_ulong) \
1256 F(cl_device_info, CL_DEVICE_IMAGE2D_MAX_WIDTH, ::size_t) \
1257 F(cl_device_info, CL_DEVICE_IMAGE2D_MAX_HEIGHT, ::size_t) \
1258 F(cl_device_info, CL_DEVICE_IMAGE3D_MAX_WIDTH, ::size_t) \
1259 F(cl_device_info, CL_DEVICE_IMAGE3D_MAX_HEIGHT, ::size_t) \
1260 F(cl_device_info, CL_DEVICE_IMAGE3D_MAX_DEPTH, ::size_t) \
1261 F(cl_device_info, CL_DEVICE_IMAGE_SUPPORT, cl_bool) \
1262 F(cl_device_info, CL_DEVICE_MAX_PARAMETER_SIZE, ::size_t) \
1263 F(cl_device_info, CL_DEVICE_MAX_SAMPLERS, cl_uint) \
1264 F(cl_device_info, CL_DEVICE_MEM_BASE_ADDR_ALIGN, cl_uint) \
1265 F(cl_device_info, CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE, cl_uint) \
1266 F(cl_device_info, CL_DEVICE_SINGLE_FP_CONFIG, cl_device_fp_config) \
1267 F(cl_device_info, CL_DEVICE_GLOBAL_MEM_CACHE_TYPE, cl_device_mem_cache_type) \
1268 F(cl_device_info, CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE, cl_uint)\
1269 F(cl_device_info, CL_DEVICE_GLOBAL_MEM_CACHE_SIZE, cl_ulong) \
1270 F(cl_device_info, CL_DEVICE_GLOBAL_MEM_SIZE, cl_ulong) \
1271 F(cl_device_info, CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE, cl_ulong) \
1272 F(cl_device_info, CL_DEVICE_MAX_CONSTANT_ARGS, cl_uint) \
1273 F(cl_device_info, CL_DEVICE_LOCAL_MEM_TYPE, cl_device_local_mem_type) \
1274 F(cl_device_info, CL_DEVICE_LOCAL_MEM_SIZE, cl_ulong) \
1275 F(cl_device_info, CL_DEVICE_ERROR_CORRECTION_SUPPORT, cl_bool) \
1276 F(cl_device_info, CL_DEVICE_PROFILING_TIMER_RESOLUTION, ::size_t) \
1277 F(cl_device_info, CL_DEVICE_ENDIAN_LITTLE, cl_bool) \
1278 F(cl_device_info, CL_DEVICE_AVAILABLE, cl_bool) \
1279 F(cl_device_info, CL_DEVICE_COMPILER_AVAILABLE, cl_bool) \
1280 F(cl_device_info, CL_DEVICE_EXECUTION_CAPABILITIES, cl_device_exec_capabilities) \
1281 F(cl_device_info, CL_DEVICE_QUEUE_PROPERTIES, cl_command_queue_properties) \
1282 F(cl_device_info, CL_DEVICE_PLATFORM, cl_platform_id) \
1283 F(cl_device_info, CL_DEVICE_NAME, STRING_CLASS) \
1284 F(cl_device_info, CL_DEVICE_VENDOR, STRING_CLASS) \
1285 F(cl_device_info, CL_DRIVER_VERSION, STRING_CLASS) \
1286 F(cl_device_info, CL_DEVICE_PROFILE, STRING_CLASS) \
1287 F(cl_device_info, CL_DEVICE_VERSION, STRING_CLASS) \
1288 F(cl_device_info, CL_DEVICE_EXTENSIONS, STRING_CLASS) \
1290 F(cl_context_info, CL_CONTEXT_REFERENCE_COUNT, cl_uint) \
1291 F(cl_context_info, CL_CONTEXT_DEVICES, VECTOR_CLASS<Device>) \
1292 F(cl_context_info, CL_CONTEXT_PROPERTIES, VECTOR_CLASS<cl_context_properties>) \
1294 F(cl_event_info, CL_EVENT_COMMAND_QUEUE, cl::CommandQueue) \
1295 F(cl_event_info, CL_EVENT_COMMAND_TYPE, cl_command_type) \
1296 F(cl_event_info, CL_EVENT_REFERENCE_COUNT, cl_uint) \
1297 F(cl_event_info, CL_EVENT_COMMAND_EXECUTION_STATUS, cl_uint) \
1299 F(cl_profiling_info, CL_PROFILING_COMMAND_QUEUED, cl_ulong) \
1300 F(cl_profiling_info, CL_PROFILING_COMMAND_SUBMIT, cl_ulong) \
1301 F(cl_profiling_info, CL_PROFILING_COMMAND_START, cl_ulong) \
1302 F(cl_profiling_info, CL_PROFILING_COMMAND_END, cl_ulong) \
1304 F(cl_mem_info, CL_MEM_TYPE, cl_mem_object_type) \
1305 F(cl_mem_info, CL_MEM_FLAGS, cl_mem_flags) \
1306 F(cl_mem_info, CL_MEM_SIZE, ::size_t) \
1307 F(cl_mem_info, CL_MEM_HOST_PTR, void*) \
1308 F(cl_mem_info, CL_MEM_MAP_COUNT, cl_uint) \
1309 F(cl_mem_info, CL_MEM_REFERENCE_COUNT, cl_uint) \
1310 F(cl_mem_info, CL_MEM_CONTEXT, cl::Context) \
1312 F(cl_image_info, CL_IMAGE_FORMAT, cl_image_format) \
1313 F(cl_image_info, CL_IMAGE_ELEMENT_SIZE, ::size_t) \
1314 F(cl_image_info, CL_IMAGE_ROW_PITCH, ::size_t) \
1315 F(cl_image_info, CL_IMAGE_SLICE_PITCH, ::size_t) \
1316 F(cl_image_info, CL_IMAGE_WIDTH, ::size_t) \
1317 F(cl_image_info, CL_IMAGE_HEIGHT, ::size_t) \
1318 F(cl_image_info, CL_IMAGE_DEPTH, ::size_t) \
1320 F(cl_sampler_info, CL_SAMPLER_REFERENCE_COUNT, cl_uint) \
1321 F(cl_sampler_info, CL_SAMPLER_CONTEXT, cl::Context) \
1322 F(cl_sampler_info, CL_SAMPLER_NORMALIZED_COORDS, cl_addressing_mode) \
1323 F(cl_sampler_info, CL_SAMPLER_ADDRESSING_MODE, cl_filter_mode) \
1324 F(cl_sampler_info, CL_SAMPLER_FILTER_MODE, cl_bool) \
1326 F(cl_program_info, CL_PROGRAM_REFERENCE_COUNT, cl_uint) \
1327 F(cl_program_info, CL_PROGRAM_CONTEXT, cl::Context) \
1328 F(cl_program_info, CL_PROGRAM_NUM_DEVICES, cl_uint) \
1329 F(cl_program_info, CL_PROGRAM_DEVICES, VECTOR_CLASS<Device>) \
1330 F(cl_program_info, CL_PROGRAM_SOURCE, STRING_CLASS) \
1331 F(cl_program_info, CL_PROGRAM_BINARY_SIZES, VECTOR_CLASS< ::size_t>) \
1332 F(cl_program_info, CL_PROGRAM_BINARIES, VECTOR_CLASS<char *>) \
1334 F(cl_program_build_info, CL_PROGRAM_BUILD_STATUS, cl_build_status) \
1335 F(cl_program_build_info, CL_PROGRAM_BUILD_OPTIONS, STRING_CLASS) \
1336 F(cl_program_build_info, CL_PROGRAM_BUILD_LOG, STRING_CLASS) \
1338 F(cl_kernel_info, CL_KERNEL_FUNCTION_NAME, STRING_CLASS) \
1339 F(cl_kernel_info, CL_KERNEL_NUM_ARGS, cl_uint) \
1340 F(cl_kernel_info, CL_KERNEL_REFERENCE_COUNT, cl_uint) \
1341 F(cl_kernel_info, CL_KERNEL_CONTEXT, cl::Context) \
1342 F(cl_kernel_info, CL_KERNEL_PROGRAM, cl::Program) \
1344 F(cl_kernel_work_group_info, CL_KERNEL_WORK_GROUP_SIZE, ::size_t) \
1345 F(cl_kernel_work_group_info, CL_KERNEL_COMPILE_WORK_GROUP_SIZE, cl::size_t<3>) \
1346 F(cl_kernel_work_group_info, CL_KERNEL_LOCAL_MEM_SIZE, cl_ulong) \
1348 F(cl_command_queue_info, CL_QUEUE_CONTEXT, cl::Context) \
1349 F(cl_command_queue_info, CL_QUEUE_DEVICE, cl::Device) \
1350 F(cl_command_queue_info, CL_QUEUE_REFERENCE_COUNT, cl_uint) \
1351 F(cl_command_queue_info, CL_QUEUE_PROPERTIES, cl_command_queue_properties)
1353#if defined(CL_VERSION_1_1)
1354#define __PARAM_NAME_INFO_1_1(F) \
1355 F(cl_context_info, CL_CONTEXT_NUM_DEVICES, cl_uint)\
1356 F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF, cl_uint) \
1357 F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR, cl_uint) \
1358 F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT, cl_uint) \
1359 F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_INT, cl_uint) \
1360 F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG, cl_uint) \
1361 F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT, cl_uint) \
1362 F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE, cl_uint) \
1363 F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF, cl_uint) \
1364 F(cl_device_info, CL_DEVICE_DOUBLE_FP_CONFIG, cl_device_fp_config) \
1365 F(cl_device_info, CL_DEVICE_HALF_FP_CONFIG, cl_device_fp_config) \
1366 F(cl_device_info, CL_DEVICE_HOST_UNIFIED_MEMORY, cl_bool) \
1367 F(cl_device_info, CL_DEVICE_OPENCL_C_VERSION, STRING_CLASS) \
1369 F(cl_mem_info, CL_MEM_ASSOCIATED_MEMOBJECT, cl::Memory) \
1370 F(cl_mem_info, CL_MEM_OFFSET, ::size_t) \
1372 F(cl_kernel_work_group_info, CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE, ::size_t) \
1373 F(cl_kernel_work_group_info, CL_KERNEL_PRIVATE_MEM_SIZE, cl_ulong) \
1375 F(cl_event_info, CL_EVENT_CONTEXT, cl::Context)
1379#if defined(CL_VERSION_1_2)
1380#define __PARAM_NAME_INFO_1_2(F) \
1381 F(cl_image_info, CL_IMAGE_BUFFER, cl::Buffer) \
1383 F(cl_program_info, CL_PROGRAM_NUM_KERNELS, ::size_t) \
1384 F(cl_program_info, CL_PROGRAM_KERNEL_NAMES, STRING_CLASS) \
1386 F(cl_program_build_info, CL_PROGRAM_BINARY_TYPE, cl_program_binary_type) \
1388 F(cl_kernel_info, CL_KERNEL_ATTRIBUTES, STRING_CLASS) \
1390 F(cl_kernel_arg_info, CL_KERNEL_ARG_ADDRESS_QUALIFIER, cl_kernel_arg_address_qualifier) \
1391 F(cl_kernel_arg_info, CL_KERNEL_ARG_ACCESS_QUALIFIER, cl_kernel_arg_access_qualifier) \
1392 F(cl_kernel_arg_info, CL_KERNEL_ARG_TYPE_NAME, STRING_CLASS) \
1393 F(cl_kernel_arg_info, CL_KERNEL_ARG_NAME, STRING_CLASS) \
1395 F(cl_device_info, CL_DEVICE_PARENT_DEVICE, cl_device_id) \
1396 F(cl_device_info, CL_DEVICE_PARTITION_PROPERTIES, VECTOR_CLASS<cl_device_partition_property>) \
1397 F(cl_device_info, CL_DEVICE_PARTITION_TYPE, VECTOR_CLASS<cl_device_partition_property>) \
1398 F(cl_device_info, CL_DEVICE_REFERENCE_COUNT, cl_uint) \
1399 F(cl_device_info, CL_DEVICE_PREFERRED_INTEROP_USER_SYNC, ::size_t) \
1400 F(cl_device_info, CL_DEVICE_PARTITION_AFFINITY_DOMAIN, cl_device_affinity_domain) \
1401 F(cl_device_info, CL_DEVICE_BUILT_IN_KERNELS, STRING_CLASS)
1404#if defined(USE_CL_DEVICE_FISSION)
1405#define __PARAM_NAME_DEVICE_FISSION(F) \
1406 F(cl_device_info, CL_DEVICE_PARENT_DEVICE_EXT, cl_device_id) \
1407 F(cl_device_info, CL_DEVICE_PARTITION_TYPES_EXT, VECTOR_CLASS<cl_device_partition_property_ext>) \
1408 F(cl_device_info, CL_DEVICE_AFFINITY_DOMAINS_EXT, VECTOR_CLASS<cl_device_partition_property_ext>) \
1409 F(cl_device_info, CL_DEVICE_REFERENCE_COUNT_EXT , cl_uint) \
1410 F(cl_device_info, CL_DEVICE_PARTITION_STYLE_EXT, VECTOR_CLASS<cl_device_partition_property_ext>)
1413template <
typename enum_type, cl_
int Name>
1416#define __CL_DECLARE_PARAM_TRAITS(token, param_name, T) \
1419struct param_traits<detail:: token,param_name> \
1421 enum { value = param_name }; \
1422 typedef T param_type; \
1425__PARAM_NAME_INFO_1_0(__CL_DECLARE_PARAM_TRAITS)
1426#if defined(CL_VERSION_1_1)
1427__PARAM_NAME_INFO_1_1(__CL_DECLARE_PARAM_TRAITS)
1429#if defined(CL_VERSION_1_2)
1430__PARAM_NAME_INFO_1_2(__CL_DECLARE_PARAM_TRAITS)
1433#if defined(USE_CL_DEVICE_FISSION)
1434__PARAM_NAME_DEVICE_FISSION(__CL_DECLARE_PARAM_TRAITS);
1437#ifdef CL_PLATFORM_ICD_SUFFIX_KHR
1438__CL_DECLARE_PARAM_TRAITS(cl_platform_info, CL_PLATFORM_ICD_SUFFIX_KHR,
STRING_CLASS)
1441#ifdef CL_DEVICE_PROFILING_TIMER_OFFSET_AMD
1442__CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_PROFILING_TIMER_OFFSET_AMD, cl_ulong)
1445#ifdef CL_DEVICE_GLOBAL_FREE_MEMORY_AMD
1446__CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_GLOBAL_FREE_MEMORY_AMD, VECTOR_CLASS< ::size_t>)
1448#ifdef CL_DEVICE_SIMD_PER_COMPUTE_UNIT_AMD
1449__CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_SIMD_PER_COMPUTE_UNIT_AMD, cl_uint)
1451#ifdef CL_DEVICE_SIMD_WIDTH_AMD
1452__CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_SIMD_WIDTH_AMD, cl_uint)
1454#ifdef CL_DEVICE_SIMD_INSTRUCTION_WIDTH_AMD
1455__CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_SIMD_INSTRUCTION_WIDTH_AMD, cl_uint)
1457#ifdef CL_DEVICE_WAVEFRONT_WIDTH_AMD
1458__CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_WAVEFRONT_WIDTH_AMD, cl_uint)
1460#ifdef CL_DEVICE_GLOBAL_MEM_CHANNELS_AMD
1461__CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_GLOBAL_MEM_CHANNELS_AMD, cl_uint)
1463#ifdef CL_DEVICE_GLOBAL_MEM_CHANNEL_BANKS_AMD
1464__CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_GLOBAL_MEM_CHANNEL_BANKS_AMD, cl_uint)
1466#ifdef CL_DEVICE_GLOBAL_MEM_CHANNEL_BANK_WIDTH_AMD
1467__CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_GLOBAL_MEM_CHANNEL_BANK_WIDTH_AMD, cl_uint)
1469#ifdef CL_DEVICE_LOCAL_MEM_SIZE_PER_COMPUTE_UNIT_AMD
1470__CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_LOCAL_MEM_SIZE_PER_COMPUTE_UNIT_AMD, cl_uint)
1472#ifdef CL_DEVICE_LOCAL_MEM_BANKS_AMD
1473__CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_LOCAL_MEM_BANKS_AMD, cl_uint)
1476#ifdef CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV
1477__CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV, cl_uint)
1479#ifdef CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV
1480__CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV, cl_uint)
1482#ifdef CL_DEVICE_REGISTERS_PER_BLOCK_NV
1483__CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_REGISTERS_PER_BLOCK_NV, cl_uint)
1485#ifdef CL_DEVICE_WARP_SIZE_NV
1486__CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_WARP_SIZE_NV, cl_uint)
1488#ifdef CL_DEVICE_GPU_OVERLAP_NV
1489__CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_GPU_OVERLAP_NV, cl_bool)
1491#ifdef CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV
1492__CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV, cl_bool)
1494#ifdef CL_DEVICE_INTEGRATED_MEMORY_NV
1495__CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_INTEGRATED_MEMORY_NV, cl_bool)
1500template <
typename Func,
typename T>
1502getInfo(Func f, cl_uint name, T* param)
1504 return getInfoHelper(f, name, param, 0);
1507template <
typename Func,
typename Arg0>
1510 Func f_;
const Arg0& arg0_;
1512 cl_uint param, ::size_t
size,
void* value, ::size_t* size_ret)
1513 {
return f_(arg0_, param,
size, value, size_ret); }
1516template <
typename Func,
typename Arg0,
typename Arg1>
1519 Func f_;
const Arg0& arg0_;
const Arg1& arg1_;
1521 cl_uint param, ::size_t
size,
void* value, ::size_t* size_ret)
1522 {
return f_(arg0_, arg1_, param,
size, value, size_ret); }
1525template <
typename Func,
typename Arg0,
typename T>
1527getInfo(Func f,
const Arg0& arg0, cl_uint name, T* param)
1530 return getInfoHelper(f0, name, param, 0);
1533template <
typename Func,
typename Arg0,
typename Arg1,
typename T>
1535getInfo(Func f,
const Arg0& arg0,
const Arg1& arg1, cl_uint name, T* param)
1537 GetInfoFunctor1<Func, Arg0, Arg1> f0 = { f, arg0, arg1 };
1538 return getInfoHelper(f0, name, param, 0);
1545#if defined(CL_VERSION_1_2)
1561 static cl_int retain(cl_device_id device)
1562 { return ::clRetainDevice(device); }
1572 static cl_int
release(cl_device_id device)
1573 { return ::clReleaseDevice(device); }
1583 static cl_int retain(cl_device_id)
1584 {
return CL_SUCCESS; }
1586 static cl_int
release(cl_device_id)
1587 {
return CL_SUCCESS; }
1595 static cl_int retain(cl_platform_id)
1596 {
return CL_SUCCESS; }
1598 static cl_int
release(cl_platform_id)
1599 {
return CL_SUCCESS; }
1605 static cl_int retain(cl_context context)
1606 { return ::clRetainContext(context); }
1607 static cl_int
release(cl_context context)
1608 { return ::clReleaseContext(context); }
1614 static cl_int retain(cl_command_queue queue)
1615 { return ::clRetainCommandQueue(queue); }
1616 static cl_int
release(cl_command_queue queue)
1617 { return ::clReleaseCommandQueue(queue); }
1623 static cl_int retain(cl_mem memory)
1624 { return ::clRetainMemObject(memory); }
1625 static cl_int
release(cl_mem memory)
1626 { return ::clReleaseMemObject(memory); }
1632 static cl_int retain(cl_sampler sampler)
1633 { return ::clRetainSampler(sampler); }
1634 static cl_int
release(cl_sampler sampler)
1635 { return ::clReleaseSampler(sampler); }
1641 static cl_int retain(cl_program program)
1642 { return ::clRetainProgram(program); }
1643 static cl_int
release(cl_program program)
1644 { return ::clReleaseProgram(program); }
1650 static cl_int retain(cl_kernel kernel)
1651 { return ::clRetainKernel(kernel); }
1652 static cl_int
release(cl_kernel kernel)
1653 { return ::clReleaseKernel(kernel); }
1659 static cl_int retain(cl_event event)
1660 { return ::clRetainEvent(event); }
1661 static cl_int
release(cl_event event)
1662 { return ::clReleaseEvent(event); }
1667static cl_uint getVersion(
const char *versionInfo)
1669 int highVersion = 0;
1672 while(versionInfo[index] !=
'.' ) {
1674 highVersion += versionInfo[index]-
'0';
1678 while(versionInfo[index] !=
' ' ) {
1680 lowVersion += versionInfo[index]-
'0';
1683 return (highVersion << 16) | lowVersion;
1686static cl_uint getPlatformVersion(cl_platform_id platform)
1689 clGetPlatformInfo(platform, CL_PLATFORM_VERSION, 0, NULL, &
size);
1690 char *versionInfo = (
char *) alloca(
size);
1691 clGetPlatformInfo(platform, CL_PLATFORM_VERSION,
size, &versionInfo[0], &
size);
1692 return getVersion(versionInfo);
1695static cl_uint getDevicePlatformVersion(cl_device_id device)
1697 cl_platform_id platform;
1698 clGetDeviceInfo(device, CL_DEVICE_PLATFORM,
sizeof(platform), &platform, NULL);
1699 return getPlatformVersion(platform);
1702#if defined(CL_VERSION_1_2) && defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
1703static cl_uint getContextPlatformVersion(cl_context context)
1708 clGetContextInfo(context, CL_CONTEXT_DEVICES, 0, NULL, &
size);
1711 cl_device_id *devices = (cl_device_id *) alloca(
size);
1712 clGetContextInfo(context, CL_CONTEXT_DEVICES,
size, devices, NULL);
1713 return getDevicePlatformVersion(devices[0]);
1717template <
typename T>
1729 Wrapper(
const cl_type &obj) : object_(obj) { }
1733 if (object_ != NULL) { release(); }
1738 object_ = rhs.object_;
1739 if (object_ != NULL) { detail::errHandler(retain(), __RETAIN_ERR); }
1744 if (object_ != NULL) { detail::errHandler(release(), __RELEASE_ERR); }
1745 object_ = rhs.object_;
1746 if (object_ != NULL) { detail::errHandler(retain(), __RETAIN_ERR); }
1752 if (object_ != NULL) { detail::errHandler(release(), __RELEASE_ERR); }
1757 cl_type operator ()()
const {
return object_; }
1759 cl_type& operator ()() {
return object_; }
1762 template<
typename Func,
typename U>
1763 friend inline cl_int getInfoHelper(Func, cl_uint, U*,
int,
typename U::cl_type);
1765 cl_int retain()
const
1770 cl_int release()
const
1780 typedef cl_device_id cl_type;
1784 bool referenceCountable_;
1786 static bool isReferenceCountable(cl_device_id device)
1788 bool retVal =
false;
1789 if (device != NULL) {
1790 int version = getDevicePlatformVersion(device);
1791 if(version > ((1 << 16) + 1)) {
1799 Wrapper() : object_(NULL), referenceCountable_(
false)
1803 Wrapper(
const cl_type &obj) : object_(obj), referenceCountable_(
false)
1805 referenceCountable_ = isReferenceCountable(obj);
1810 if (object_ != NULL) { release(); }
1815 object_ = rhs.object_;
1816 referenceCountable_ = isReferenceCountable(object_);
1817 if (object_ != NULL) { detail::errHandler(retain(), __RETAIN_ERR); }
1822 if (object_ != NULL) { detail::errHandler(release(), __RELEASE_ERR); }
1823 object_ = rhs.object_;
1824 referenceCountable_ = rhs.referenceCountable_;
1825 if (object_ != NULL) { detail::errHandler(retain(), __RETAIN_ERR); }
1831 if (object_ != NULL) { detail::errHandler(release(), __RELEASE_ERR); }
1833 referenceCountable_ = isReferenceCountable(object_);
1837 cl_type operator ()()
const {
return object_; }
1839 cl_type& operator ()() {
return object_; }
1842 template<
typename Func,
typename U>
1843 friend inline cl_int getInfoHelper(Func, cl_uint, U*,
int,
typename U::cl_type);
1845 template<
typename Func,
typename U>
1846 friend inline cl_int getInfoHelper(Func, cl_uint, VECTOR_CLASS<U>*,
int,
typename U::cl_type);
1848 cl_int retain()
const
1850 if( referenceCountable_ ) {
1858 cl_int release()
const
1860 if( referenceCountable_ ) {
1885 image_channel_order = order;
1886 image_channel_data_type = type;
1893 this->image_channel_data_type = rhs.image_channel_data_type;
1894 this->image_channel_order = rhs.image_channel_order;
1923 Device(
const cl_device_id &device) : detail::Wrapper<cl_type>(device) { }
1954 template <
typename T>
1955 cl_int
getInfo(cl_device_info name, T* param)
const
1957 return detail::errHandler(
1958 detail::getInfo(&::clGetDeviceInfo, object_, name, param),
1959 __GET_DEVICE_INFO_ERR);
1963 template <cl_
int name>
typename
1968 detail::cl_device_info, name>::param_type param;
1969 cl_int result =
getInfo(name, ¶m);
1979#if defined(CL_VERSION_1_2)
1981 cl_int createSubDevices(
1982 const cl_device_partition_property * properties,
1983 VECTOR_CLASS<Device>* devices)
1986 cl_int err = clCreateSubDevices(object_, properties, 0, NULL, &n);
1987 if (err != CL_SUCCESS) {
1988 return detail::errHandler(err, __CREATE_SUB_DEVICES);
1991 cl_device_id* ids = (cl_device_id*) alloca(n *
sizeof(cl_device_id));
1992 err = clCreateSubDevices(object_, properties, n, ids, NULL);
1993 if (err != CL_SUCCESS) {
1994 return detail::errHandler(err, __CREATE_SUB_DEVICES);
1997 devices->assign(&ids[0], &ids[n]);
2005#if defined(CL_VERSION_1_1)
2006#if defined(USE_CL_DEVICE_FISSION)
2007 cl_int createSubDevices(
2008 const cl_device_partition_property_ext * properties,
2009 VECTOR_CLASS<Device>* devices)
2011 typedef CL_API_ENTRY cl_int
2012 ( CL_API_CALL * PFN_clCreateSubDevicesEXT)(
2014 const cl_device_partition_property_ext * ,
2017 cl_uint * ) CL_EXT_SUFFIX__VERSION_1_1;
2019 static PFN_clCreateSubDevicesEXT pfn_clCreateSubDevicesEXT = NULL;
2020 __INIT_CL_EXT_FCN_PTR(clCreateSubDevicesEXT);
2023 cl_int err = pfn_clCreateSubDevicesEXT(object_, properties, 0, NULL, &n);
2024 if (err != CL_SUCCESS) {
2025 return detail::errHandler(err, __CREATE_SUB_DEVICES);
2028 cl_device_id* ids = (cl_device_id*) alloca(n *
sizeof(cl_device_id));
2029 err = pfn_clCreateSubDevicesEXT(object_, properties, n, ids, NULL);
2030 if (err != CL_SUCCESS) {
2031 return detail::errHandler(err, __CREATE_SUB_DEVICES);
2034 devices->assign(&ids[0], &ids[n]);
2064 Platform(
const cl_platform_id &platform) : detail::Wrapper<cl_type>(platform) { }
2091 return detail::errHandler(
2092 detail::getInfo(&::clGetPlatformInfo, object_, name, param),
2093 __GET_PLATFORM_INFO_ERR);
2097 template <cl_
int name>
typename
2102 detail::cl_platform_info, name>::param_type param;
2103 cl_int result =
getInfo(name, ¶m);
2115 cl_device_type type,
2116 VECTOR_CLASS<Device>* devices)
const
2119 if( devices == NULL ) {
2120 return detail::errHandler(CL_INVALID_ARG_VALUE, __GET_DEVICE_IDS_ERR);
2122 cl_int err = ::clGetDeviceIDs(object_, type, 0, NULL, &n);
2123 if (err != CL_SUCCESS) {
2124 return detail::errHandler(err, __GET_DEVICE_IDS_ERR);
2127 cl_device_id* ids = (cl_device_id*) alloca(n *
sizeof(cl_device_id));
2128 err = ::clGetDeviceIDs(object_, type, n, ids, NULL);
2129 if (err != CL_SUCCESS) {
2130 return detail::errHandler(err, __GET_DEVICE_IDS_ERR);
2133 devices->assign(&ids[0], &ids[n]);
2137#if defined(USE_DX_INTEROP)
2162 cl_d3d10_device_source_khr d3d_device_source,
2164 cl_d3d10_device_set_khr d3d_device_set,
2165 VECTOR_CLASS<Device>* devices)
const
2167 typedef CL_API_ENTRY cl_int (CL_API_CALL *PFN_clGetDeviceIDsFromD3D10KHR)(
2168 cl_platform_id platform,
2169 cl_d3d10_device_source_khr d3d_device_source,
2171 cl_d3d10_device_set_khr d3d_device_set,
2172 cl_uint num_entries,
2173 cl_device_id * devices,
2174 cl_uint* num_devices);
2176 if( devices == NULL ) {
2177 return detail::errHandler(CL_INVALID_ARG_VALUE, __GET_DEVICE_IDS_ERR);
2180 static PFN_clGetDeviceIDsFromD3D10KHR pfn_clGetDeviceIDsFromD3D10KHR = NULL;
2181 __INIT_CL_EXT_FCN_PTR_PLATFORM(object_, clGetDeviceIDsFromD3D10KHR);
2184 cl_int err = pfn_clGetDeviceIDsFromD3D10KHR(
2192 if (err != CL_SUCCESS) {
2193 return detail::errHandler(err, __GET_DEVICE_IDS_ERR);
2196 cl_device_id* ids = (cl_device_id*) alloca(n *
sizeof(cl_device_id));
2197 err = pfn_clGetDeviceIDsFromD3D10KHR(
2205 if (err != CL_SUCCESS) {
2206 return detail::errHandler(err, __GET_DEVICE_IDS_ERR);
2209 devices->assign(&ids[0], &ids[n]);
2219 VECTOR_CLASS<Platform>* platforms)
2223 if( platforms == NULL ) {
2224 return detail::errHandler(CL_INVALID_ARG_VALUE, __GET_PLATFORM_IDS_ERR);
2227 cl_int err = ::clGetPlatformIDs(0, NULL, &n);
2228 if (err != CL_SUCCESS) {
2229 return detail::errHandler(err, __GET_PLATFORM_IDS_ERR);
2232 cl_platform_id* ids = (cl_platform_id*) alloca(
2233 n *
sizeof(cl_platform_id));
2234 err = ::clGetPlatformIDs(n, ids, NULL);
2235 if (err != CL_SUCCESS) {
2236 return detail::errHandler(err, __GET_PLATFORM_IDS_ERR);
2239 platforms->assign(&ids[0], &ids[n]);
2252 if( platform == NULL ) {
2253 return detail::errHandler(CL_INVALID_ARG_VALUE, __GET_PLATFORM_IDS_ERR);
2256 cl_int err = ::clGetPlatformIDs(0, NULL, &n);
2257 if (err != CL_SUCCESS) {
2258 return detail::errHandler(err, __GET_PLATFORM_IDS_ERR);
2261 cl_platform_id* ids = (cl_platform_id*) alloca(
2262 n *
sizeof(cl_platform_id));
2263 err = ::clGetPlatformIDs(n, ids, NULL);
2264 if (err != CL_SUCCESS) {
2265 return detail::errHandler(err, __GET_PLATFORM_IDS_ERR);
2277 cl_int * errResult = NULL)
2281 cl_int err = ::clGetPlatformIDs(0, NULL, &n);
2282 if (err != CL_SUCCESS) {
2283 detail::errHandler(err, __GET_PLATFORM_IDS_ERR);
2284 if (errResult != NULL) {
2289 cl_platform_id* ids = (cl_platform_id*) alloca(
2290 n *
sizeof(cl_platform_id));
2291 err = ::clGetPlatformIDs(n, ids, NULL);
2293 if (err != CL_SUCCESS) {
2294 detail::errHandler(err, __GET_PLATFORM_IDS_ERR);
2297 if (errResult != NULL) {
2305 cl_int *errResult = NULL )
2307 return get(errResult);
2311#if defined(CL_VERSION_1_2)
2316 return ::clUnloadPlatformCompiler(object_);
2324#if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS) || (defined(CL_VERSION_1_1) && !defined(CL_VERSION_1_2))
2329inline CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_int
2330UnloadCompiler() CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
2334 return ::clUnloadCompiler();
2350 static volatile int default_initialized_;
2352 static volatile cl_int default_error_;
2365 const VECTOR_CLASS<Device>& devices,
2366 cl_context_properties* properties = NULL,
2367 void (CL_CALLBACK * notifyFptr)(
2377 ::size_t numDevices = devices.size();
2378 cl_device_id* deviceIDs = (cl_device_id*) alloca(numDevices *
sizeof(cl_device_id));
2379 for( ::size_t deviceIndex = 0; deviceIndex < numDevices; ++deviceIndex ) {
2380 deviceIDs[deviceIndex] = (devices[deviceIndex])();
2383 object_ = ::clCreateContext(
2384 properties, (cl_uint) numDevices,
2386 notifyFptr, data, &error);
2388 detail::errHandler(error, __CREATE_CONTEXT_ERR);
2396 cl_context_properties* properties = NULL,
2397 void (CL_CALLBACK * notifyFptr)(
2407 cl_device_id deviceID = device();
2409 object_ = ::clCreateContext(
2412 notifyFptr, data, &error);
2414 detail::errHandler(error, __CREATE_CONTEXT_ERR);
2425 cl_device_type type,
2426 cl_context_properties* properties = NULL,
2427 void (CL_CALLBACK * notifyFptr)(
2437#if !defined(__APPLE__) || !defined(__MACOS)
2438 cl_context_properties prop[4] = {CL_CONTEXT_PLATFORM, 0, 0, 0 };
2440 if (properties == NULL) {
2442 VECTOR_CLASS<Platform> platforms;
2444 if (error != CL_SUCCESS) {
2445 detail::errHandler(error, __CREATE_CONTEXT_FROM_TYPE_ERR);
2453 cl_context_properties platform_id = 0;
2454 for (
unsigned int i = 0; i < platforms.size(); i++) {
2456 VECTOR_CLASS<Device> devices;
2458#if defined(__CL_ENABLE_EXCEPTIONS)
2462 error = platforms[i].getDevices(type, &devices);
2464#if defined(__CL_ENABLE_EXCEPTIONS)
2471 if (error != CL_SUCCESS && error != CL_DEVICE_NOT_FOUND) {
2472 detail::errHandler(error, __CREATE_CONTEXT_FROM_TYPE_ERR);
2478 if (devices.size() > 0) {
2479 platform_id = (cl_context_properties)platforms[i]();
2484 if (platform_id == 0) {
2485 detail::errHandler(CL_DEVICE_NOT_FOUND, __CREATE_CONTEXT_FROM_TYPE_ERR);
2487 *err = CL_DEVICE_NOT_FOUND;
2492 prop[1] = platform_id;
2493 properties = &prop[0];
2496 object_ = ::clCreateContextFromType(
2497 properties, type, notifyFptr, data, &error);
2499 detail::errHandler(error, __CREATE_CONTEXT_FROM_TYPE_ERR);
2511 int state = detail::compare_exchange(
2512 &default_initialized_,
2513 __DEFAULT_BEING_INITIALIZED, __DEFAULT_NOT_INITIALIZED);
2515 if (state & __DEFAULT_INITIALIZED) {
2517 *err = default_error_;
2522 if (state & __DEFAULT_BEING_INITIALIZED) {
2524 while(default_initialized_ != __DEFAULT_INITIALIZED) {
2529 *err = default_error_;
2536 CL_DEVICE_TYPE_DEFAULT,
2544 default_error_ = error;
2546 default_initialized_ = __DEFAULT_INITIALIZED;
2551 *err = default_error_;
2571 __CL_EXPLICIT_CONSTRUCTORS
Context(
const cl_context& context) : detail::Wrapper<cl_type>(context) { }
2598 template <
typename T>
2599 cl_int
getInfo(cl_context_info name, T* param)
const
2601 return detail::errHandler(
2602 detail::getInfo(&::clGetContextInfo, object_, name, param),
2603 __GET_CONTEXT_INFO_ERR);
2607 template <cl_
int name>
typename
2612 detail::cl_context_info, name>::param_type param;
2613 cl_int result =
getInfo(name, ¶m);
2626 cl_mem_object_type type,
2627 VECTOR_CLASS<ImageFormat>* formats)
const
2630 cl_int err = ::clGetSupportedImageFormats(
2637 if (err != CL_SUCCESS) {
2638 return detail::errHandler(err, __GET_SUPPORTED_IMAGE_FORMATS_ERR);
2643 err = ::clGetSupportedImageFormats(
2648 (cl_image_format*) value,
2650 if (err != CL_SUCCESS) {
2651 return detail::errHandler(err, __GET_SUPPORTED_IMAGE_FORMATS_ERR);
2654 formats->assign(&value[0], &value[numEntries]);
2665 detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
2667 if (error != CL_SUCCESS) {
2673 device = context.
getInfo<CL_CONTEXT_DEVICES>()[0];
2684__declspec(selectany)
volatile int Context::default_initialized_ = __DEFAULT_NOT_INITIALIZED;
2685__declspec(selectany)
Context Context::default_;
2686__declspec(selectany)
volatile cl_int Context::default_error_ = CL_SUCCESS;
2688__attribute__((weak))
volatile int Context::default_initialized_ = __DEFAULT_NOT_INITIALIZED;
2689__attribute__((weak))
Context Context::default_;
2690__attribute__((weak))
volatile cl_int Context::default_error_ = CL_SUCCESS;
2711 Event() : detail::Wrapper<cl_type>() { }
2724 Event(
const cl_event& event) : detail::Wrapper<cl_type>(event) { }
2751 template <
typename T>
2752 cl_int
getInfo(cl_event_info name, T* param)
const
2754 return detail::errHandler(
2755 detail::getInfo(&::clGetEventInfo, object_, name, param),
2756 __GET_EVENT_INFO_ERR);
2760 template <cl_
int name>
typename
2765 detail::cl_event_info, name>::param_type param;
2766 cl_int result =
getInfo(name, ¶m);
2774 template <
typename T>
2777 return detail::errHandler(detail::getInfo(
2778 &::clGetEventProfilingInfo, object_, name, param),
2779 __GET_EVENT_PROFILE_INFO_ERR);
2783 template <cl_
int name>
typename
2788 detail::cl_profiling_info, name>::param_type param;
2802 return detail::errHandler(
2803 ::clWaitForEvents(1, &object_),
2804 __WAIT_FOR_EVENTS_ERR);
2807#if defined(CL_VERSION_1_1)
2814 void (CL_CALLBACK * pfn_notify)(cl_event, cl_int,
void *),
2815 void * user_data = NULL)
2817 return detail::errHandler(
2818 ::clSetEventCallback(
2823 __SET_EVENT_CALLBACK_ERR);
2834 return detail::errHandler(
2836 (cl_uint) events.size(), (cl_event*)&events.front()),
2837 __WAIT_FOR_EVENTS_ERR);
2841#if defined(CL_VERSION_1_1)
2846class UserEvent :
public Event
2855 cl_int * err = NULL)
2858 object_ = ::clCreateUserEvent(
2862 detail::errHandler(error, __CREATE_USER_EVENT_ERR);
2869 UserEvent() : Event() { }
2872 UserEvent(
const UserEvent& event) : Event(event) { }
2878 Event::operator=(rhs);
2887 cl_int setStatus(cl_int status)
2889 return detail::errHandler(
2890 ::clSetUserEventStatus(object_,status),
2891 __SET_USER_EVENT_STATUS_ERR);
2901WaitForEvents(
const VECTOR_CLASS<Event>& events)
2903 return detail::errHandler(
2905 (cl_uint) events.size(), (cl_event*)&events.front()),
2906 __WAIT_FOR_EVENTS_ERR);
2941 __CL_EXPLICIT_CONSTRUCTORS
Memory(
const cl_mem& memory) : detail::Wrapper<cl_type>(memory) { }
2968 template <
typename T>
2971 return detail::errHandler(
2972 detail::getInfo(&::clGetMemObjectInfo, object_, name, param),
2973 __GET_MEM_OBJECT_INFO_ERR);
2977 template <cl_
int name>
typename
2982 detail::cl_mem_info, name>::param_type param;
2983 cl_int result =
getInfo(name, ¶m);
2990#if defined(CL_VERSION_1_1)
3004 cl_int setDestructorCallback(
3005 void (CL_CALLBACK * pfn_notify)(cl_mem,
void *),
3006 void * user_data = NULL)
3008 return detail::errHandler(
3009 ::clSetMemObjectDestructorCallback(
3013 __SET_MEM_OBJECT_DESTRUCTOR_CALLBACK_ERR);
3021template<
typename IteratorType >
3022cl_int
copy( IteratorType startIterator, IteratorType endIterator,
cl::Buffer &buffer );
3023template<
typename IteratorType >
3024cl_int
copy(
const cl::Buffer &buffer, IteratorType startIterator, IteratorType endIterator );
3025template<
typename IteratorType >
3026cl_int
copy(
const CommandQueue &queue, IteratorType startIterator, IteratorType endIterator,
cl::Buffer &buffer );
3027template<
typename IteratorType >
3028cl_int
copy(
const CommandQueue &queue,
const cl::Buffer &buffer, IteratorType startIterator, IteratorType endIterator );
3052 void* host_ptr = NULL,
3056 object_ = ::clCreateBuffer(context(), flags,
size, host_ptr, &error);
3058 detail::errHandler(error, __CREATE_BUFFER_ERR);
3076 void* host_ptr = NULL,
3083 object_ = ::clCreateBuffer(context(), flags,
size, host_ptr, &error);
3085 detail::errHandler(error, __CREATE_BUFFER_ERR);
3096 template<
typename IteratorType >
3098 IteratorType startIterator,
3099 IteratorType endIterator,
3101 bool useHostPtr =
false,
3107 cl_mem_flags flags = 0;
3109 flags |= CL_MEM_READ_ONLY;
3112 flags |= CL_MEM_READ_WRITE;
3115 flags |= CL_MEM_USE_HOST_PTR;
3118 ::size_t
size =
sizeof(DataType)*(endIterator - startIterator);
3123 object_ = ::clCreateBuffer(context(), flags,
size,
static_cast<DataType*
>(&*startIterator), &error);
3125 object_ = ::clCreateBuffer(context(), flags,
size, 0, &error);
3128 detail::errHandler(error, __CREATE_BUFFER_ERR);
3134 error =
cl::copy(startIterator, endIterator, *
this);
3135 detail::errHandler(error, __CREATE_BUFFER_ERR);
3147 template<
typename IteratorType >
3148 Buffer(
const Context &context, IteratorType startIterator, IteratorType endIterator,
3149 bool readOnly,
bool useHostPtr =
false, cl_int* err = NULL);
3164 __CL_EXPLICIT_CONSTRUCTORS
Buffer(
const cl_mem& buffer) :
Memory(buffer) { }
3188#if defined(CL_VERSION_1_1)
3195 cl_buffer_create_type buffer_create_type,
3196 const void * buffer_create_info,
3197 cl_int * err = NULL)
3201 result.object_ = ::clCreateSubBuffer(
3208 detail::errHandler(error, __CREATE_SUBBUFFER_ERR);
3218#if defined (USE_DX_INTEROP)
3227class BufferD3D10 :
public Buffer
3230 typedef CL_API_ENTRY cl_mem (CL_API_CALL *PFN_clCreateFromD3D10BufferKHR)(
3231 cl_context context, cl_mem_flags flags, ID3D10Buffer* buffer,
3232 cl_int* errcode_ret);
3242 ID3D10Buffer* bufobj,
3243 cl_int * err = NULL)
3245 static PFN_clCreateFromD3D10BufferKHR pfn_clCreateFromD3D10BufferKHR = NULL;
3247#if defined(CL_VERSION_1_2)
3248 vector<cl_context_properties> props = context.getInfo<CL_CONTEXT_PROPERTIES>();
3249 cl_platform platform = -1;
3250 for(
int i = 0; i < props.size(); ++i ) {
3251 if( props[i] == CL_CONTEXT_PLATFORM ) {
3252 platform = props[i+1];
3255 __INIT_CL_EXT_FCN_PTR_PLATFORM(platform, clCreateFromD3D10BufferKHR);
3257#if defined(CL_VERSION_1_1)
3258 __INIT_CL_EXT_FCN_PTR(clCreateFromD3D10BufferKHR);
3262 object_ = pfn_clCreateFromD3D10BufferKHR(
3268 detail::errHandler(error, __CREATE_GL_BUFFER_ERR);
3275 BufferD3D10() : Buffer() { }
3281 BufferD3D10(
const BufferD3D10& buffer) : Buffer(buffer) { }
3287 __CL_EXPLICIT_CONSTRUCTORS BufferD3D10(
const cl_mem& buffer) : Buffer(buffer) { }
3293 BufferD3D10&
operator = (
const BufferD3D10& rhs)
3296 Buffer::operator=(rhs);
3307 Buffer::operator=(rhs);
3333 cl_int * err = NULL)
3336 object_ = ::clCreateFromGLBuffer(
3342 detail::errHandler(error, __CREATE_GL_BUFFER_ERR);
3387 cl_gl_object_type *type,
3388 GLuint * gl_object_name)
3390 return detail::errHandler(
3391 ::clGetGLObjectInfo(object_,type,gl_object_name),
3392 __GET_GL_OBJECT_INFO_ERR);
3416 cl_int * err = NULL)
3419 object_ = ::clCreateFromGLRenderbuffer(
3425 detail::errHandler(error, __CREATE_GL_RENDER_BUFFER_ERR);
3470 cl_gl_object_type *type,
3471 GLuint * gl_object_name)
3473 return detail::errHandler(
3474 ::clGetGLObjectInfo(object_,type,gl_object_name),
3475 __GET_GL_OBJECT_INFO_ERR);
3501 __CL_EXPLICIT_CONSTRUCTORS
Image(
const cl_mem& image) :
Memory(image) { }
3527 template <
typename T>
3530 return detail::errHandler(
3531 detail::getInfo(&::clGetImageInfo, object_, name, param),
3532 __GET_IMAGE_INFO_ERR);
3536 template <cl_
int name>
typename
3541 detail::cl_image_info, name>::param_type param;
3550#if defined(CL_VERSION_1_2)
3557class Image1D :
public Image
3569 void* host_ptr = NULL,
3573 cl_image_desc desc =
3575 CL_MEM_OBJECT_IMAGE1D,
3577 0, 0, 0, 0, 0, 0, 0, 0
3579 object_ = ::clCreateImage(
3587 detail::errHandler(error, __CREATE_IMAGE_ERR);
3600 Image1D(
const Image1D& image1D) : Image(image1D) { }
3606 __CL_EXPLICIT_CONSTRUCTORS Image1D(
const cl_mem& image1D) : Image(image1D) { }
3615 Image::operator=(rhs);
3626 Image::operator=(rhs);
3634class Image1DBuffer :
public Image
3642 const Buffer &buffer,
3646 cl_image_desc desc =
3648 CL_MEM_OBJECT_IMAGE1D_BUFFER,
3650 0, 0, 0, 0, 0, 0, 0,
3653 object_ = ::clCreateImage(
3661 detail::errHandler(error, __CREATE_IMAGE_ERR);
3669 Image1DBuffer(
const Image1DBuffer& image1D) : Image(image1D) { }
3671 __CL_EXPLICIT_CONSTRUCTORS Image1DBuffer(
const cl_mem& image1D) : Image(image1D) { }
3673 Image1DBuffer&
operator = (
const Image1DBuffer& rhs)
3676 Image::operator=(rhs);
3681 Image1DBuffer&
operator = (
const cl_mem& rhs)
3683 Image::operator=(rhs);
3691class Image1DArray :
public Image
3701 void* host_ptr = NULL,
3705 cl_image_desc desc =
3707 CL_MEM_OBJECT_IMAGE1D_ARRAY,
3714 object_ = ::clCreateImage(
3722 detail::errHandler(error, __CREATE_IMAGE_ERR);
3730 Image1DArray(
const Image1DArray& imageArray) : Image(imageArray) { }
3732 __CL_EXPLICIT_CONSTRUCTORS Image1DArray(
const cl_mem& imageArray) : Image(imageArray) { }
3734 Image1DArray&
operator = (
const Image1DArray& rhs)
3737 Image::operator=(rhs);
3744 Image::operator=(rhs);
3770 ::size_t row_pitch = 0,
3771 void* host_ptr = NULL,
3775 bool useCreateImage;
3777#if defined(CL_VERSION_1_2) && defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
3780 cl_uint version = detail::getContextPlatformVersion(context());
3781 useCreateImage = (version >= 0x10002);
3783#elif defined(CL_VERSION_1_2)
3784 useCreateImage =
true;
3786 useCreateImage =
false;
3789#if defined(CL_VERSION_1_2)
3792 cl_image_desc desc =
3794 CL_MEM_OBJECT_IMAGE2D,
3801 object_ = ::clCreateImage(
3809 detail::errHandler(error, __CREATE_IMAGE_ERR);
3815#if !defined(CL_VERSION_1_2) || defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
3816 if (!useCreateImage)
3818 object_ = ::clCreateImage2D(
3819 context(), flags,&format, width, height, row_pitch, host_ptr, &error);
3821 detail::errHandler(error, __CREATE_IMAGE2D_ERR);
3842 __CL_EXPLICIT_CONSTRUCTORS
Image2D(
const cl_mem& image2D) :
Image(image2D) { }
3868#if !defined(CL_VERSION_1_2)
3892 cl_int * err = NULL)
3895 object_ = ::clCreateFromGLTexture2D(
3903 detail::errHandler(error, __CREATE_GL_TEXTURE_2D_ERR);
3932 Image2D::operator=(rhs);
3943 Image2D::operator=(rhs);
3949#if defined(CL_VERSION_1_2)
3953class Image2DArray :
public Image
3964 ::size_t slicePitch,
3965 void* host_ptr = NULL,
3969 cl_image_desc desc =
3971 CL_MEM_OBJECT_IMAGE2D_ARRAY,
3980 object_ = ::clCreateImage(
3988 detail::errHandler(error, __CREATE_IMAGE_ERR);
3996 Image2DArray(
const Image2DArray& imageArray) : Image(imageArray) { }
3998 __CL_EXPLICIT_CONSTRUCTORS Image2DArray(
const cl_mem& imageArray) : Image(imageArray) { }
4000 Image2DArray&
operator = (
const Image2DArray& rhs)
4003 Image::operator=(rhs);
4010 Image::operator=(rhs);
4036 ::size_t row_pitch = 0,
4037 ::size_t slice_pitch = 0,
4038 void* host_ptr = NULL,
4042 bool useCreateImage;
4044#if defined(CL_VERSION_1_2) && defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
4047 cl_uint version = detail::getContextPlatformVersion(context());
4048 useCreateImage = (version >= 0x10002);
4050#elif defined(CL_VERSION_1_2)
4051 useCreateImage =
true;
4053 useCreateImage =
false;
4056#if defined(CL_VERSION_1_2)
4059 cl_image_desc desc =
4061 CL_MEM_OBJECT_IMAGE3D,
4070 object_ = ::clCreateImage(
4078 detail::errHandler(error, __CREATE_IMAGE_ERR);
4084#if !defined(CL_VERSION_1_2) || defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
4085 if (!useCreateImage)
4087 object_ = ::clCreateImage3D(
4088 context(), flags, &format, width, height, depth, row_pitch,
4089 slice_pitch, host_ptr, &error);
4091 detail::errHandler(error, __CREATE_IMAGE3D_ERR);
4112 __CL_EXPLICIT_CONSTRUCTORS
Image3D(
const cl_mem& image3D) :
Image(image3D) { }
4137#if !defined(CL_VERSION_1_2)
4160 cl_int * err = NULL)
4163 object_ = ::clCreateFromGLTexture3D(
4171 detail::errHandler(error, __CREATE_GL_TEXTURE_3D_ERR);
4216#if defined(CL_VERSION_1_2)
4223class ImageGL :
public Image
4232 cl_int * err = NULL)
4235 object_ = ::clCreateFromGLTexture(
4243 detail::errHandler(error, __CREATE_GL_TEXTURE_ERR);
4249 ImageGL() : Image() { }
4251 ImageGL(
const ImageGL& image) : Image(image) { }
4253 __CL_EXPLICIT_CONSTRUCTORS ImageGL(
const cl_mem& image) : Image(image) { }
4258 Image::operator=(rhs);
4265 Image::operator=(rhs);
4297 cl_bool normalized_coords,
4298 cl_addressing_mode addressing_mode,
4299 cl_filter_mode filter_mode,
4303 object_ = ::clCreateSampler(
4310 detail::errHandler(error, __CREATE_SAMPLER_ERR);
4327 Sampler(
const cl_sampler& sampler) : detail::Wrapper<cl_type>(sampler) { }
4354 template <
typename T>
4355 cl_int
getInfo(cl_sampler_info name, T* param)
const
4357 return detail::errHandler(
4358 detail::getInfo(&::clGetSamplerInfo, object_, name, param),
4359 __GET_SAMPLER_INFO_ERR);
4363 template <cl_
int name>
typename
4368 detail::cl_sampler_info, name>::param_type param;
4369 cl_int result =
getInfo(name, ¶m);
4386 cl_uint dimensions_;
4410 NDRange(::size_t size0, ::size_t size1, ::size_t size2)
4422 operator const ::size_t*()
const {
4423 return (const ::size_t*) sizes_;
4431static const NDRange NullRange;
4441template <
typename T>
4444 static ::size_t
size(
const T&) {
return sizeof(T); }
4445 static T* ptr(T& value) {
return &value; }
4494 inline Kernel(
const Program& program,
const char* name, cl_int* err = NULL);
4516 __CL_EXPLICIT_CONSTRUCTORS
Kernel(
const cl_kernel& kernel) : detail::Wrapper<cl_type>(kernel) { }
4542 template <
typename T>
4543 cl_int getInfo(cl_kernel_info name, T* param)
const
4545 return detail::errHandler(
4546 detail::getInfo(&::clGetKernelInfo, object_, name, param),
4547 __GET_KERNEL_INFO_ERR);
4550 template <cl_
int name>
typename
4551 detail::param_traits<detail::cl_kernel_info, name>::param_type
4552 getInfo(cl_int* err = NULL)
const
4554 typename detail::param_traits<
4555 detail::cl_kernel_info, name>::param_type param;
4556 cl_int result = getInfo(name, ¶m);
4563#if defined(CL_VERSION_1_2)
4564 template <
typename T>
4565 cl_int getArgInfo(cl_uint argIndex, cl_kernel_arg_info name, T* param)
const
4567 return detail::errHandler(
4568 detail::getInfo(&::clGetKernelArgInfo, object_, argIndex, name, param),
4569 __GET_KERNEL_ARG_INFO_ERR);
4572 template <cl_
int name>
typename
4573 detail::param_traits<detail::cl_kernel_arg_info, name>::param_type
4574 getArgInfo(cl_uint argIndex, cl_int* err = NULL)
const
4576 typename detail::param_traits<
4577 detail::cl_kernel_arg_info, name>::param_type param;
4578 cl_int result = getArgInfo(argIndex, name, ¶m);
4586 template <
typename T>
4587 cl_int getWorkGroupInfo(
4588 const Device& device, cl_kernel_work_group_info name, T* param)
const
4590 return detail::errHandler(
4592 &::clGetKernelWorkGroupInfo, object_, device(), name, param),
4593 __GET_KERNEL_WORK_GROUP_INFO_ERR);
4596 template <cl_
int name>
typename
4597 detail::param_traits<detail::cl_kernel_work_group_info, name>::param_type
4598 getWorkGroupInfo(
const Device& device, cl_int* err = NULL)
const
4600 typename detail::param_traits<
4601 detail::cl_kernel_work_group_info, name>::param_type param;
4602 cl_int result = getWorkGroupInfo(device, name, ¶m);
4609 template <
typename T>
4610 cl_int setArg(cl_uint index, T value)
4612 return detail::errHandler(
4616 detail::KernelArgumentHandler<T>::size(value),
4617 detail::KernelArgumentHandler<T>::ptr(value)),
4618 __SET_KERNEL_ARGS_ERR);
4621 cl_int setArg(cl_uint index, ::size_t
size,
void* argPtr)
4623 return detail::errHandler(
4624 ::clSetKernelArg(object_, index,
size, argPtr),
4625 __SET_KERNEL_ARGS_ERR);
4635 typedef VECTOR_CLASS<std::pair<const void*, ::size_t> > Binaries;
4636 typedef VECTOR_CLASS<std::pair<const char*, ::size_t> > Sources;
4645 const char * strings = source.c_str();
4646 const ::size_t length = source.size();
4650 object_ = ::clCreateProgramWithSource(
4651 context(), (cl_uint)1, &strings, &length, &error);
4653 detail::errHandler(error, __CREATE_PROGRAM_WITH_SOURCE_ERR);
4655 if (error == CL_SUCCESS && build) {
4657 error = ::clBuildProgram(
4665 detail::errHandler(error, __BUILD_PROGRAM_ERR);
4681 const char * strings = source.c_str();
4682 const ::size_t length = source.size();
4684 object_ = ::clCreateProgramWithSource(
4685 context(), (cl_uint)1, &strings, &length, &error);
4687 detail::errHandler(error, __CREATE_PROGRAM_WITH_SOURCE_ERR);
4689 if (error == CL_SUCCESS && build) {
4691 error = ::clBuildProgram(
4699 detail::errHandler(error, __BUILD_PROGRAM_ERR);
4709 const Sources& sources,
4714 const ::size_t n = (::size_t)sources.size();
4715 ::size_t* lengths = (::size_t*) alloca(n *
sizeof(::size_t));
4716 const char** strings = (
const char**) alloca(n *
sizeof(
const char*));
4718 for (::size_t i = 0; i < n; ++i) {
4719 strings[i] = sources[(int)i].first;
4720 lengths[i] = sources[(int)i].second;
4723 object_ = ::clCreateProgramWithSource(
4724 context(), (cl_uint)n, strings, lengths, &error);
4726 detail::errHandler(error, __CREATE_PROGRAM_WITH_SOURCE_ERR);
4753 const VECTOR_CLASS<Device>& devices,
4754 const Binaries& binaries,
4755 VECTOR_CLASS<cl_int>* binaryStatus = NULL,
4760 const ::size_t numDevices = devices.size();
4763 if(binaries.size() != numDevices) {
4764 error = CL_INVALID_VALUE;
4765 detail::errHandler(error, __CREATE_PROGRAM_WITH_BINARY_ERR);
4772 ::size_t* lengths = (::size_t*) alloca(numDevices *
sizeof(::size_t));
4773 const unsigned char** images = (
const unsigned char**) alloca(numDevices *
sizeof(
const unsigned char**));
4775 for (::size_t i = 0; i < numDevices; ++i) {
4776 images[i] = (
const unsigned char*)binaries[i].first;
4777 lengths[i] = binaries[(int)i].second;
4780 cl_device_id* deviceIDs = (cl_device_id*) alloca(numDevices *
sizeof(cl_device_id));
4781 for( ::size_t deviceIndex = 0; deviceIndex < numDevices; ++deviceIndex ) {
4782 deviceIDs[deviceIndex] = (devices[deviceIndex])();
4786 binaryStatus->resize(numDevices);
4789 object_ = ::clCreateProgramWithBinary(
4790 context(), (cl_uint) devices.size(),
4792 lengths, images, binaryStatus != NULL
4793 ? &binaryStatus->front()
4796 detail::errHandler(error, __CREATE_PROGRAM_WITH_BINARY_ERR);
4803#if defined(CL_VERSION_1_2)
4810 const VECTOR_CLASS<Device>& devices,
4817 ::size_t numDevices = devices.size();
4818 cl_device_id* deviceIDs = (cl_device_id*) alloca(numDevices *
sizeof(cl_device_id));
4819 for( ::size_t deviceIndex = 0; deviceIndex < numDevices; ++deviceIndex ) {
4820 deviceIDs[deviceIndex] = (devices[deviceIndex])();
4823 object_ = ::clCreateProgramWithBuiltInKernels(
4825 (cl_uint) devices.size(),
4827 kernelNames.c_str(),
4830 detail::errHandler(error, __CREATE_PROGRAM_WITH_BUILT_IN_KERNELS_ERR);
4839 Program(
const Program& program) : detail::Wrapper<cl_type>(program) { }
4841 __CL_EXPLICIT_CONSTRUCTORS Program(
const cl_program& program) : detail::Wrapper<cl_type>(program) { }
4843 Program& operator = (
const Program& rhs)
4846 detail::Wrapper<cl_type>::operator=(rhs);
4851 Program& operator = (
const cl_program& rhs)
4853 detail::Wrapper<cl_type>::operator=(rhs);
4858 const VECTOR_CLASS<Device>& devices,
4859 const char* options = NULL,
4860 void (CL_CALLBACK * notifyFptr)(cl_program,
void *) = NULL,
4861 void* data = NULL)
const
4863 ::size_t numDevices = devices.size();
4864 cl_device_id* deviceIDs = (cl_device_id*) alloca(numDevices *
sizeof(cl_device_id));
4865 for( ::size_t deviceIndex = 0; deviceIndex < numDevices; ++deviceIndex ) {
4866 deviceIDs[deviceIndex] = (devices[deviceIndex])();
4869 return detail::errHandler(
4878 __BUILD_PROGRAM_ERR);
4882 const char* options = NULL,
4883 void (CL_CALLBACK * notifyFptr)(cl_program,
void *) = NULL,
4884 void* data = NULL)
const
4886 return detail::errHandler(
4894 __BUILD_PROGRAM_ERR);
4897#if defined(CL_VERSION_1_2)
4899 const char* options = NULL,
4900 void (CL_CALLBACK * notifyFptr)(cl_program,
void *) = NULL,
4901 void* data = NULL)
const
4903 return detail::errHandler(
4914 __COMPILE_PROGRAM_ERR);
4918 template <
typename T>
4919 cl_int getInfo(cl_program_info name, T* param)
const
4921 return detail::errHandler(
4922 detail::getInfo(&::clGetProgramInfo, object_, name, param),
4923 __GET_PROGRAM_INFO_ERR);
4926 template <cl_
int name>
typename
4927 detail::param_traits<detail::cl_program_info, name>::param_type
4928 getInfo(cl_int* err = NULL)
const
4930 typename detail::param_traits<
4931 detail::cl_program_info, name>::param_type param;
4932 cl_int result = getInfo(name, ¶m);
4939 template <
typename T>
4940 cl_int getBuildInfo(
4941 const Device& device, cl_program_build_info name, T* param)
const
4943 return detail::errHandler(
4945 &::clGetProgramBuildInfo, object_, device(), name, param),
4946 __GET_PROGRAM_BUILD_INFO_ERR);
4949 template <cl_
int name>
typename
4950 detail::param_traits<detail::cl_program_build_info, name>::param_type
4951 getBuildInfo(
const Device& device, cl_int* err = NULL)
const
4953 typename detail::param_traits<
4954 detail::cl_program_build_info, name>::param_type param;
4955 cl_int result = getBuildInfo(device, name, ¶m);
4962 cl_int createKernels(VECTOR_CLASS<Kernel>* kernels)
4965 cl_int err = ::clCreateKernelsInProgram(object_, 0, NULL, &numKernels);
4966 if (err != CL_SUCCESS) {
4967 return detail::errHandler(err, __CREATE_KERNELS_IN_PROGRAM_ERR);
4970 Kernel* value = (Kernel*) alloca(numKernels *
sizeof(Kernel));
4971 err = ::clCreateKernelsInProgram(
4972 object_, numKernels, (cl_kernel*) value, NULL);
4973 if (err != CL_SUCCESS) {
4974 return detail::errHandler(err, __CREATE_KERNELS_IN_PROGRAM_ERR);
4977 kernels->assign(&value[0], &value[numKernels]);
4982#if defined(CL_VERSION_1_2)
4983inline Program linkProgram(
4986 const char* options = NULL,
4987 void (CL_CALLBACK * notifyFptr)(cl_program,
void *) = NULL,
4991 cl_int err_local = CL_SUCCESS;
4993 cl_program programs[2] = { input1(), input2() };
4995 Context ctx = input1.getInfo<CL_PROGRAM_CONTEXT>();
4997 cl_program prog = ::clLinkProgram(
5008 detail::errHandler(err_local,__COMPILE_PROGRAM_ERR);
5013 return Program(prog);
5016inline Program linkProgram(
5017 VECTOR_CLASS<Program> inputPrograms,
5018 const char* options = NULL,
5019 void (CL_CALLBACK * notifyFptr)(cl_program,
void *) = NULL,
5023 cl_int err_local = CL_SUCCESS;
5025 cl_program * programs = (cl_program*) alloca(inputPrograms.size() *
sizeof(cl_program));
5027 if (programs != NULL) {
5028 for (
unsigned int i = 0; i < inputPrograms.size(); i++) {
5029 programs[i] = inputPrograms[i]();
5033 cl_program prog = ::clLinkProgram(
5038 (cl_uint)inputPrograms.size(),
5044 detail::errHandler(err_local,__COMPILE_PROGRAM_ERR);
5049 return Program(prog);
5054inline VECTOR_CLASS<char *> cl::Program::getInfo<CL_PROGRAM_BINARIES>(cl_int* err)
const
5056 VECTOR_CLASS< ::size_t> sizes = getInfo<CL_PROGRAM_BINARY_SIZES>();
5057 VECTOR_CLASS<char *> binaries;
5058 for (VECTOR_CLASS< ::size_t>::iterator s = sizes.begin(); s != sizes.end(); ++s)
5063 binaries.push_back(ptr);
5066 cl_int result = getInfo(CL_PROGRAM_BINARIES, &binaries);
5073inline Kernel::Kernel(
const Program& program,
const char* name, cl_int* err)
5077 object_ = ::clCreateKernel(program(), name, &error);
5078 detail::errHandler(error, __CREATE_KERNEL_ERR);
5092 static volatile int default_initialized_;
5094 static volatile cl_int default_error_;
5097 cl_command_queue_properties properties,
5103 detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
5105 if (error != CL_SUCCESS) {
5113 object_ = ::clCreateCommandQueue(
5114 context(), device(), properties, &error);
5116 detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
5127 cl_command_queue_properties properties = 0,
5131 VECTOR_CLASS<cl::Device> devices;
5132 error = context.
getInfo(CL_CONTEXT_DEVICES, &devices);
5134 detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
5136 if (error != CL_SUCCESS)
5144 object_ = ::clCreateCommandQueue(context(), devices[0](), properties, &error);
5146 detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
5157 cl_command_queue_properties properties = 0,
5161 object_ = ::clCreateCommandQueue(
5162 context(), device(), properties, &error);
5164 detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
5170 static CommandQueue getDefault(cl_int * err = NULL)
5172 int state = detail::compare_exchange(
5173 &default_initialized_,
5174 __DEFAULT_BEING_INITIALIZED, __DEFAULT_NOT_INITIALIZED);
5176 if (state & __DEFAULT_INITIALIZED) {
5178 *err = default_error_;
5183 if (state & __DEFAULT_BEING_INITIALIZED) {
5185 while(default_initialized_ != __DEFAULT_INITIALIZED) {
5190 *err = default_error_;
5198 detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
5200 if (error != CL_SUCCESS) {
5206 Device device = context.getInfo<CL_CONTEXT_DEVICES>()[0];
5208 default_ = CommandQueue(context, device, 0, &error);
5210 detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
5218 default_error_ = error;
5220 default_initialized_ = __DEFAULT_INITIALIZED;
5225 *err = default_error_;
5233 CommandQueue(
const CommandQueue& commandQueue) : detail::Wrapper<cl_type>(commandQueue) { }
5235 CommandQueue(
const cl_command_queue& commandQueue) : detail::Wrapper<cl_type>(commandQueue) { }
5237 CommandQueue& operator = (
const CommandQueue& rhs)
5240 detail::Wrapper<cl_type>::operator=(rhs);
5245 CommandQueue& operator = (
const cl_command_queue& rhs)
5247 detail::Wrapper<cl_type>::operator=(rhs);
5251 template <
typename T>
5252 cl_int getInfo(cl_command_queue_info name, T* param)
const
5254 return detail::errHandler(
5256 &::clGetCommandQueueInfo, object_, name, param),
5257 __GET_COMMAND_QUEUE_INFO_ERR);
5260 template <cl_
int name>
typename
5261 detail::param_traits<detail::cl_command_queue_info, name>::param_type
5262 getInfo(cl_int* err = NULL)
const
5264 typename detail::param_traits<
5265 detail::cl_command_queue_info, name>::param_type param;
5266 cl_int result = getInfo(name, ¶m);
5273 cl_int enqueueReadBuffer(
5274 const Buffer& buffer,
5279 const VECTOR_CLASS<Event>* events = NULL,
5280 Event* event = NULL)
const
5283 cl_int err = detail::errHandler(
5284 ::clEnqueueReadBuffer(
5285 object_, buffer(), blocking, offset,
size,
5287 (events != NULL) ? (cl_uint) events->size() : 0,
5288 (events != NULL && events->
size() > 0) ? (cl_event*) &events->front() : NULL,
5289 (event != NULL) ? &tmp : NULL),
5290 __ENQUEUE_READ_BUFFER_ERR);
5292 if (event != NULL && err == CL_SUCCESS)
5298 cl_int enqueueWriteBuffer(
5299 const Buffer& buffer,
5304 const VECTOR_CLASS<Event>* events = NULL,
5305 Event* event = NULL)
const
5308 cl_int err = detail::errHandler(
5309 ::clEnqueueWriteBuffer(
5310 object_, buffer(), blocking, offset,
size,
5312 (events != NULL) ? (cl_uint) events->size() : 0,
5313 (events != NULL && events->
size() > 0) ? (cl_event*) &events->front() : NULL,
5314 (event != NULL) ? &tmp : NULL),
5315 __ENQUEUE_WRITE_BUFFER_ERR);
5317 if (event != NULL && err == CL_SUCCESS)
5323 cl_int enqueueCopyBuffer(
5326 ::size_t src_offset,
5327 ::size_t dst_offset,
5329 const VECTOR_CLASS<Event>* events = NULL,
5330 Event* event = NULL)
const
5333 cl_int err = detail::errHandler(
5334 ::clEnqueueCopyBuffer(
5335 object_, src(), dst(), src_offset, dst_offset,
size,
5336 (events != NULL) ? (cl_uint) events->size() : 0,
5337 (events != NULL && events->
size() > 0) ? (cl_event*) &events->front() : NULL,
5338 (event != NULL) ? &tmp : NULL),
5339 __ENQEUE_COPY_BUFFER_ERR);
5341 if (event != NULL && err == CL_SUCCESS)
5347 cl_int enqueueReadBufferRect(
5348 const Buffer& buffer,
5350 const size_t<3>& buffer_offset,
5351 const size_t<3>& host_offset,
5352 const size_t<3>& region,
5353 ::size_t buffer_row_pitch,
5354 ::size_t buffer_slice_pitch,
5355 ::size_t host_row_pitch,
5356 ::size_t host_slice_pitch,
5358 const VECTOR_CLASS<Event>* events = NULL,
5359 Event* event = NULL)
const
5362 cl_int err = detail::errHandler(
5363 ::clEnqueueReadBufferRect(
5367 (const ::size_t *)buffer_offset,
5368 (const ::size_t *)host_offset,
5369 (const ::size_t *)region,
5375 (events != NULL) ? (cl_uint) events->size() : 0,
5376 (events != NULL && events->
size() > 0) ? (cl_event*) &events->front() : NULL,
5377 (event != NULL) ? &tmp : NULL),
5378 __ENQUEUE_READ_BUFFER_RECT_ERR);
5380 if (event != NULL && err == CL_SUCCESS)
5386 cl_int enqueueWriteBufferRect(
5387 const Buffer& buffer,
5389 const size_t<3>& buffer_offset,
5390 const size_t<3>& host_offset,
5391 const size_t<3>& region,
5392 ::size_t buffer_row_pitch,
5393 ::size_t buffer_slice_pitch,
5394 ::size_t host_row_pitch,
5395 ::size_t host_slice_pitch,
5397 const VECTOR_CLASS<Event>* events = NULL,
5398 Event* event = NULL)
const
5401 cl_int err = detail::errHandler(
5402 ::clEnqueueWriteBufferRect(
5406 (const ::size_t *)buffer_offset,
5407 (const ::size_t *)host_offset,
5408 (const ::size_t *)region,
5414 (events != NULL) ? (cl_uint) events->size() : 0,
5415 (events != NULL && events->
size() > 0) ? (cl_event*) &events->front() : NULL,
5416 (event != NULL) ? &tmp : NULL),
5417 __ENQUEUE_WRITE_BUFFER_RECT_ERR);
5419 if (event != NULL && err == CL_SUCCESS)
5425 cl_int enqueueCopyBufferRect(
5428 const size_t<3>& src_origin,
5429 const size_t<3>& dst_origin,
5430 const size_t<3>& region,
5431 ::size_t src_row_pitch,
5432 ::size_t src_slice_pitch,
5433 ::size_t dst_row_pitch,
5434 ::size_t dst_slice_pitch,
5435 const VECTOR_CLASS<Event>* events = NULL,
5436 Event* event = NULL)
const
5439 cl_int err = detail::errHandler(
5440 ::clEnqueueCopyBufferRect(
5444 (const ::size_t *)src_origin,
5445 (const ::size_t *)dst_origin,
5446 (const ::size_t *)region,
5451 (events != NULL) ? (cl_uint) events->size() : 0,
5452 (events != NULL && events->
size() > 0) ? (cl_event*) &events->front() : NULL,
5453 (event != NULL) ? &tmp : NULL),
5454 __ENQEUE_COPY_BUFFER_RECT_ERR);
5456 if (event != NULL && err == CL_SUCCESS)
5462#if defined(CL_VERSION_1_2)
5469 template<
typename PatternType>
5470 cl_int enqueueFillBuffer(
5471 const Buffer& buffer,
5472 PatternType pattern,
5475 const VECTOR_CLASS<Event>* events = NULL,
5476 Event* event = NULL)
const
5479 cl_int err = detail::errHandler(
5480 ::clEnqueueFillBuffer(
5483 static_cast<void*
>(&pattern),
5484 sizeof(PatternType),
5487 (events != NULL) ? (cl_uint) events->size() : 0,
5488 (events != NULL && events->
size() > 0) ? (cl_event*) &events->front() : NULL,
5489 (event != NULL) ? &tmp : NULL),
5490 __ENQUEUE_FILL_BUFFER_ERR);
5492 if (event != NULL && err == CL_SUCCESS)
5499 cl_int enqueueReadImage(
5502 const size_t<3>& origin,
5503 const size_t<3>& region,
5505 ::size_t slice_pitch,
5507 const VECTOR_CLASS<Event>* events = NULL,
5508 Event* event = NULL)
const
5511 cl_int err = detail::errHandler(
5512 ::clEnqueueReadImage(
5513 object_, image(), blocking, (const ::size_t *) origin,
5514 (const ::size_t *) region, row_pitch, slice_pitch, ptr,
5515 (events != NULL) ? (cl_uint) events->size() : 0,
5516 (events != NULL && events->
size() > 0) ? (cl_event*) &events->front() : NULL,
5517 (event != NULL) ? &tmp : NULL),
5518 __ENQUEUE_READ_IMAGE_ERR);
5520 if (event != NULL && err == CL_SUCCESS)
5526 cl_int enqueueWriteImage(
5529 const size_t<3>& origin,
5530 const size_t<3>& region,
5532 ::size_t slice_pitch,
5534 const VECTOR_CLASS<Event>* events = NULL,
5535 Event* event = NULL)
const
5538 cl_int err = detail::errHandler(
5539 ::clEnqueueWriteImage(
5540 object_, image(), blocking, (const ::size_t *) origin,
5541 (const ::size_t *) region, row_pitch, slice_pitch, ptr,
5542 (events != NULL) ? (cl_uint) events->size() : 0,
5543 (events != NULL && events->
size() > 0) ? (cl_event*) &events->front() : NULL,
5544 (event != NULL) ? &tmp : NULL),
5545 __ENQUEUE_WRITE_IMAGE_ERR);
5547 if (event != NULL && err == CL_SUCCESS)
5553 cl_int enqueueCopyImage(
5556 const size_t<3>& src_origin,
5557 const size_t<3>& dst_origin,
5558 const size_t<3>& region,
5559 const VECTOR_CLASS<Event>* events = NULL,
5560 Event* event = NULL)
const
5563 cl_int err = detail::errHandler(
5564 ::clEnqueueCopyImage(
5565 object_, src(), dst(), (const ::size_t *) src_origin,
5566 (const ::size_t *)dst_origin, (const ::size_t *) region,
5567 (events != NULL) ? (cl_uint) events->size() : 0,
5568 (events != NULL && events->
size() > 0) ? (cl_event*) &events->front() : NULL,
5569 (event != NULL) ? &tmp : NULL),
5570 __ENQUEUE_COPY_IMAGE_ERR);
5572 if (event != NULL && err == CL_SUCCESS)
5578#if defined(CL_VERSION_1_2)
5586 cl_int enqueueFillImage(
5588 cl_float4 fillColor,
5589 const size_t<3>& origin,
5590 const size_t<3>& region,
5591 const VECTOR_CLASS<Event>* events = NULL,
5592 Event* event = NULL)
const
5595 cl_int err = detail::errHandler(
5596 ::clEnqueueFillImage(
5599 static_cast<void*
>(&fillColor),
5600 (const ::size_t *) origin,
5601 (const ::size_t *) region,
5602 (events != NULL) ? (cl_uint) events->size() : 0,
5603 (events != NULL && events->
size() > 0) ? (cl_event*) &events->front() : NULL,
5604 (event != NULL) ? &tmp : NULL),
5605 __ENQUEUE_FILL_IMAGE_ERR);
5607 if (event != NULL && err == CL_SUCCESS)
5620 cl_int enqueueFillImage(
5623 const size_t<3>& origin,
5624 const size_t<3>& region,
5625 const VECTOR_CLASS<Event>* events = NULL,
5626 Event* event = NULL)
const
5629 cl_int err = detail::errHandler(
5630 ::clEnqueueFillImage(
5633 static_cast<void*
>(&fillColor),
5634 (const ::size_t *) origin,
5635 (const ::size_t *) region,
5636 (events != NULL) ? (cl_uint) events->size() : 0,
5637 (events != NULL && events->
size() > 0) ? (cl_event*) &events->front() : NULL,
5638 (event != NULL) ? &tmp : NULL),
5639 __ENQUEUE_FILL_IMAGE_ERR);
5641 if (event != NULL && err == CL_SUCCESS)
5654 cl_int enqueueFillImage(
5657 const size_t<3>& origin,
5658 const size_t<3>& region,
5659 const VECTOR_CLASS<Event>* events = NULL,
5660 Event* event = NULL)
const
5663 cl_int err = detail::errHandler(
5664 ::clEnqueueFillImage(
5667 static_cast<void*
>(&fillColor),
5668 (const ::size_t *) origin,
5669 (const ::size_t *) region,
5670 (events != NULL) ? (cl_uint) events->size() : 0,
5671 (events != NULL && events->
size() > 0) ? (cl_event*) &events->front() : NULL,
5672 (event != NULL) ? &tmp : NULL),
5673 __ENQUEUE_FILL_IMAGE_ERR);
5675 if (event != NULL && err == CL_SUCCESS)
5682 cl_int enqueueCopyImageToBuffer(
5685 const size_t<3>& src_origin,
5686 const size_t<3>& region,
5687 ::size_t dst_offset,
5688 const VECTOR_CLASS<Event>* events = NULL,
5689 Event* event = NULL)
const
5692 cl_int err = detail::errHandler(
5693 ::clEnqueueCopyImageToBuffer(
5694 object_, src(), dst(), (const ::size_t *) src_origin,
5695 (const ::size_t *) region, dst_offset,
5696 (events != NULL) ? (cl_uint) events->size() : 0,
5697 (events != NULL && events->
size() > 0) ? (cl_event*) &events->front() : NULL,
5698 (event != NULL) ? &tmp : NULL),
5699 __ENQUEUE_COPY_IMAGE_TO_BUFFER_ERR);
5701 if (event != NULL && err == CL_SUCCESS)
5707 cl_int enqueueCopyBufferToImage(
5710 ::size_t src_offset,
5711 const size_t<3>& dst_origin,
5712 const size_t<3>& region,
5713 const VECTOR_CLASS<Event>* events = NULL,
5714 Event* event = NULL)
const
5717 cl_int err = detail::errHandler(
5718 ::clEnqueueCopyBufferToImage(
5719 object_, src(), dst(), src_offset,
5720 (const ::size_t *) dst_origin, (const ::size_t *) region,
5721 (events != NULL) ? (cl_uint) events->size() : 0,
5722 (events != NULL && events->
size() > 0) ? (cl_event*) &events->front() : NULL,
5723 (event != NULL) ? &tmp : NULL),
5724 __ENQUEUE_COPY_BUFFER_TO_IMAGE_ERR);
5726 if (event != NULL && err == CL_SUCCESS)
5732 void* enqueueMapBuffer(
5733 const Buffer& buffer,
5738 const VECTOR_CLASS<Event>* events = NULL,
5739 Event* event = NULL,
5740 cl_int* err = NULL)
const
5743 void * result = ::clEnqueueMapBuffer(
5744 object_, buffer(), blocking, flags, offset,
size,
5745 (events != NULL) ? (cl_uint) events->size() : 0,
5746 (events != NULL && events->
size() > 0) ? (cl_event*) &events->front() : NULL,
5750 detail::errHandler(error, __ENQUEUE_MAP_BUFFER_ERR);
5757 void* enqueueMapImage(
5758 const Image& buffer,
5761 const size_t<3>& origin,
5762 const size_t<3>& region,
5763 ::size_t * row_pitch,
5764 ::size_t * slice_pitch,
5765 const VECTOR_CLASS<Event>* events = NULL,
5766 Event* event = NULL,
5767 cl_int* err = NULL)
const
5770 void * result = ::clEnqueueMapImage(
5771 object_, buffer(), blocking, flags,
5772 (const ::size_t *) origin, (const ::size_t *) region,
5773 row_pitch, slice_pitch,
5774 (events != NULL) ? (cl_uint) events->size() : 0,
5775 (events != NULL && events->
size() > 0) ? (cl_event*) &events->front() : NULL,
5779 detail::errHandler(error, __ENQUEUE_MAP_IMAGE_ERR);
5786 cl_int enqueueUnmapMemObject(
5787 const Memory& memory,
5789 const VECTOR_CLASS<Event>* events = NULL,
5790 Event* event = NULL)
const
5793 cl_int err = detail::errHandler(
5794 ::clEnqueueUnmapMemObject(
5795 object_, memory(), mapped_ptr,
5796 (events != NULL) ? (cl_uint) events->size() : 0,
5797 (events != NULL && events->
size() > 0) ? (cl_event*) &events->front() : NULL,
5798 (event != NULL) ? &tmp : NULL),
5799 __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
5801 if (event != NULL && err == CL_SUCCESS)
5807#if defined(CL_VERSION_1_2)
5819 cl_int enqueueMarkerWithWaitList(
5820 const VECTOR_CLASS<Event> *events = 0,
5824 cl_int err = detail::errHandler(
5825 ::clEnqueueMarkerWithWaitList(
5827 (events != NULL) ? (cl_uint) events->size() : 0,
5828 (events != NULL && events->
size() > 0) ? (cl_event*) &events->front() : NULL,
5829 (event != NULL) ? &tmp : NULL),
5830 __ENQUEUE_MARKER_WAIT_LIST_ERR);
5832 if (event != NULL && err == CL_SUCCESS)
5849 cl_int enqueueBarrierWithWaitList(
5850 const VECTOR_CLASS<Event> *events = 0,
5854 cl_int err = detail::errHandler(
5855 ::clEnqueueBarrierWithWaitList(
5857 (events != NULL) ? (cl_uint) events->size() : 0,
5858 (events != NULL && events->
size() > 0) ? (cl_event*) &events->front() : NULL,
5859 (event != NULL) ? &tmp : NULL),
5860 __ENQUEUE_BARRIER_WAIT_LIST_ERR);
5862 if (event != NULL && err == CL_SUCCESS)
5872 cl_int enqueueMigrateMemObjects(
5873 const VECTOR_CLASS<Memory> &memObjects,
5874 cl_mem_migration_flags flags,
5875 const VECTOR_CLASS<Event>* events = NULL,
5881 cl_mem* localMemObjects =
static_cast<cl_mem*
>(alloca(memObjects.size() *
sizeof(cl_mem)));
5882 for(
int i = 0; i < (int)memObjects.size(); ++i ) {
5883 localMemObjects[i] = memObjects[i]();
5887 cl_int err = detail::errHandler(
5888 ::clEnqueueMigrateMemObjects(
5890 (cl_uint)memObjects.size(),
5891 static_cast<const cl_mem*
>(localMemObjects),
5893 (events != NULL) ? (cl_uint) events->size() : 0,
5894 (events != NULL && events->
size() > 0) ? (cl_event*) &events->front() : NULL,
5895 (event != NULL) ? &tmp : NULL),
5896 __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
5898 if (event != NULL && err == CL_SUCCESS)
5905 cl_int enqueueNDRangeKernel(
5906 const Kernel& kernel,
5907 const NDRange& offset,
5908 const NDRange& global,
5909 const NDRange& local = NullRange,
5910 const VECTOR_CLASS<Event>* events = NULL,
5911 Event* event = NULL)
const
5914 cl_int err = detail::errHandler(
5915 ::clEnqueueNDRangeKernel(
5916 object_, kernel(), (cl_uint) global.dimensions(),
5917 offset.dimensions() != 0 ? (const ::size_t*) offset : NULL,
5918 (const ::size_t*) global,
5919 local.dimensions() != 0 ? (const ::size_t*) local : NULL,
5920 (events != NULL) ? (cl_uint) events->
size() : 0,
5921 (events != NULL && events->
size() > 0) ? (cl_event*) &events->front() : NULL,
5922 (event != NULL) ? &tmp : NULL),
5923 __ENQUEUE_NDRANGE_KERNEL_ERR);
5925 if (event != NULL && err == CL_SUCCESS)
5932 const Kernel& kernel,
5933 const VECTOR_CLASS<Event>* events = NULL,
5934 Event* event = NULL)
const
5937 cl_int err = detail::errHandler(
5940 (events != NULL) ? (cl_uint) events->size() : 0,
5941 (events != NULL && events->
size() > 0) ? (cl_event*) &events->front() : NULL,
5942 (event != NULL) ? &tmp : NULL),
5943 __ENQUEUE_TASK_ERR);
5945 if (event != NULL && err == CL_SUCCESS)
5951 cl_int enqueueNativeKernel(
5952 void (CL_CALLBACK *userFptr)(
void *),
5954 const VECTOR_CLASS<Memory>* mem_objects = NULL,
5955 const VECTOR_CLASS<const void*>* mem_locs = NULL,
5956 const VECTOR_CLASS<Event>* events = NULL,
5957 Event* event = NULL)
const
5959 cl_mem * mems = (mem_objects != NULL && mem_objects->size() > 0)
5960 ? (cl_mem*) alloca(mem_objects->size() *
sizeof(cl_mem))
5964 for (
unsigned int i = 0; i < mem_objects->size(); i++) {
5965 mems[i] = ((*mem_objects)[i])();
5970 cl_int err = detail::errHandler(
5971 ::clEnqueueNativeKernel(
5973 (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
5975 (mem_locs != NULL) ? (const void **) &mem_locs->front() : NULL,
5976 (events != NULL) ? (cl_uint) events->
size() : 0,
5977 (events != NULL && events->
size() > 0) ? (cl_event*) &events->front() : NULL,
5978 (event != NULL) ? &tmp : NULL),
5979 __ENQUEUE_NATIVE_KERNEL);
5981 if (event != NULL && err == CL_SUCCESS)
5990#if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS) || (defined(CL_VERSION_1_1) && !defined(CL_VERSION_1_2))
5991 CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
5992 cl_int enqueueMarker(Event* event = NULL)
const CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
5994 return detail::errHandler(
5995 ::clEnqueueMarker(object_, (cl_event*) event),
5996 __ENQUEUE_MARKER_ERR);
5999 CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
6000 cl_int enqueueWaitForEvents(
const VECTOR_CLASS<Event>& events)
const CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
6002 return detail::errHandler(
6003 ::clEnqueueWaitForEvents(
6005 (cl_uint) events.size(),
6006 (
const cl_event*) &events.front()),
6007 __ENQUEUE_WAIT_FOR_EVENTS_ERR);
6012 const VECTOR_CLASS<Memory>* mem_objects = NULL,
6013 const VECTOR_CLASS<Event>* events = NULL,
6014 Event* event = NULL)
const
6017 cl_int err = detail::errHandler(
6018 ::clEnqueueAcquireGLObjects(
6020 (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
6021 (mem_objects != NULL) ? (
const cl_mem *) &mem_objects->front(): NULL,
6022 (events != NULL) ? (cl_uint) events->size() : 0,
6023 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
6024 (
event != NULL) ? &tmp : NULL),
6025 __ENQUEUE_ACQUIRE_GL_ERR);
6027 if (event != NULL && err == CL_SUCCESS)
6033 cl_int enqueueReleaseGLObjects(
6034 const VECTOR_CLASS<Memory>* mem_objects = NULL,
6035 const VECTOR_CLASS<Event>* events = NULL,
6036 Event* event = NULL)
const
6039 cl_int err = detail::errHandler(
6040 ::clEnqueueReleaseGLObjects(
6042 (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
6043 (mem_objects != NULL) ? (const cl_mem *) &mem_objects->front(): NULL,
6044 (events != NULL) ? (cl_uint) events->
size() : 0,
6045 (events != NULL && events->
size() > 0) ? (cl_event*) &events->front() : NULL,
6046 (event != NULL) ? &tmp : NULL),
6047 __ENQUEUE_RELEASE_GL_ERR);
6049 if (event != NULL && err == CL_SUCCESS)
6055#if defined (USE_DX_INTEROP)
6056typedef CL_API_ENTRY cl_int (CL_API_CALL *PFN_clEnqueueAcquireD3D10ObjectsKHR)(
6057 cl_command_queue command_queue, cl_uint num_objects,
6058 const cl_mem* mem_objects, cl_uint num_events_in_wait_list,
6059 const cl_event* event_wait_list, cl_event* event);
6060typedef CL_API_ENTRY cl_int (CL_API_CALL *PFN_clEnqueueReleaseD3D10ObjectsKHR)(
6061 cl_command_queue command_queue, cl_uint num_objects,
6062 const cl_mem* mem_objects, cl_uint num_events_in_wait_list,
6063 const cl_event* event_wait_list, cl_event* event);
6065 cl_int enqueueAcquireD3D10Objects(
6066 const VECTOR_CLASS<Memory>* mem_objects = NULL,
6067 const VECTOR_CLASS<Event>* events = NULL,
6068 Event* event = NULL)
const
6070 static PFN_clEnqueueAcquireD3D10ObjectsKHR pfn_clEnqueueAcquireD3D10ObjectsKHR = NULL;
6071#if defined(CL_VERSION_1_2)
6072 cl_context context = getInfo<CL_QUEUE_CONTEXT>();
6073 cl::Device device(getInfo<CL_QUEUE_DEVICE>());
6074 cl_platform_id platform = device.getInfo<CL_DEVICE_PLATFORM>();
6075 __INIT_CL_EXT_FCN_PTR_PLATFORM(platform, clEnqueueAcquireD3D10ObjectsKHR);
6077#if defined(CL_VERSION_1_1)
6078 __INIT_CL_EXT_FCN_PTR(clEnqueueAcquireD3D10ObjectsKHR);
6082 cl_int err = detail::errHandler(
6083 pfn_clEnqueueAcquireD3D10ObjectsKHR(
6085 (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
6086 (mem_objects != NULL) ? (const cl_mem *) &mem_objects->front(): NULL,
6087 (events != NULL) ? (cl_uint) events->
size() : 0,
6088 (events != NULL) ? (cl_event*) &events->front() : NULL,
6089 (event != NULL) ? &tmp : NULL),
6090 __ENQUEUE_ACQUIRE_GL_ERR);
6092 if (event != NULL && err == CL_SUCCESS)
6098 cl_int enqueueReleaseD3D10Objects(
6099 const VECTOR_CLASS<Memory>* mem_objects = NULL,
6100 const VECTOR_CLASS<Event>* events = NULL,
6101 Event* event = NULL)
const
6103 static PFN_clEnqueueReleaseD3D10ObjectsKHR pfn_clEnqueueReleaseD3D10ObjectsKHR = NULL;
6104#if defined(CL_VERSION_1_2)
6105 cl_context context = getInfo<CL_QUEUE_CONTEXT>();
6106 cl::Device device(getInfo<CL_QUEUE_DEVICE>());
6107 cl_platform_id platform = device.getInfo<CL_DEVICE_PLATFORM>();
6108 __INIT_CL_EXT_FCN_PTR_PLATFORM(platform, clEnqueueReleaseD3D10ObjectsKHR);
6110#if defined(CL_VERSION_1_1)
6111 __INIT_CL_EXT_FCN_PTR(clEnqueueReleaseD3D10ObjectsKHR);
6115 cl_int err = detail::errHandler(
6116 pfn_clEnqueueReleaseD3D10ObjectsKHR(
6118 (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
6119 (mem_objects != NULL) ? (const cl_mem *) &mem_objects->front(): NULL,
6120 (events != NULL) ? (cl_uint) events->
size() : 0,
6121 (events != NULL) ? (cl_event*) &events->front() : NULL,
6122 (event != NULL) ? &tmp : NULL),
6123 __ENQUEUE_RELEASE_GL_ERR);
6125 if (event != NULL && err == CL_SUCCESS)
6135#if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS) || (defined(CL_VERSION_1_1) && !defined(CL_VERSION_1_2))
6136 CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
6137 cl_int enqueueBarrier() const CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
6139 return detail::errHandler(
6140 ::clEnqueueBarrier(object_),
6141 __ENQUEUE_BARRIER_ERR);
6147 return detail::errHandler(::clFlush(object_), __FLUSH_ERR);
6150 cl_int finish()
const
6152 return detail::errHandler(::clFinish(object_), __FINISH_ERR);
6157__declspec(selectany)
volatile int CommandQueue::default_initialized_ = __DEFAULT_NOT_INITIALIZED;
6158__declspec(selectany) CommandQueue CommandQueue::default_;
6159__declspec(selectany)
volatile cl_int CommandQueue::default_error_ = CL_SUCCESS;
6161__attribute__((weak))
volatile int CommandQueue::default_initialized_ = __DEFAULT_NOT_INITIALIZED;
6162__attribute__((weak)) CommandQueue CommandQueue::default_;
6163__attribute__((weak))
volatile cl_int CommandQueue::default_error_ = CL_SUCCESS;
6166template<
typename IteratorType >
6169 IteratorType startIterator,
6170 IteratorType endIterator,
6178 cl_mem_flags flags = 0;
6180 flags |= CL_MEM_READ_ONLY;
6183 flags |= CL_MEM_READ_WRITE;
6186 flags |= CL_MEM_USE_HOST_PTR;
6189 ::size_t
size =
sizeof(DataType)*(endIterator - startIterator);
6192 object_ = ::clCreateBuffer(context(), flags,
size,
static_cast<DataType*
>(&*startIterator), &error);
6194 object_ = ::clCreateBuffer(context(), flags,
size, 0, &error);
6197 detail::errHandler(error, __CREATE_BUFFER_ERR);
6203 CommandQueue queue(context, 0, &error);
6204 detail::errHandler(error, __CREATE_BUFFER_ERR);
6209 error =
cl::copy(queue, startIterator, endIterator, *
this);
6210 detail::errHandler(error, __CREATE_BUFFER_ERR);
6217inline cl_int enqueueReadBuffer(
6218 const Buffer& buffer,
6223 const VECTOR_CLASS<Event>* events = NULL,
6224 Event* event = NULL)
6227 CommandQueue queue = CommandQueue::getDefault(&error);
6229 if (error != CL_SUCCESS) {
6233 return queue.enqueueReadBuffer(buffer, blocking, offset,
size, ptr, events, event);
6236inline cl_int enqueueWriteBuffer(
6237 const Buffer& buffer,
6242 const VECTOR_CLASS<Event>* events = NULL,
6243 Event* event = NULL)
6246 CommandQueue queue = CommandQueue::getDefault(&error);
6248 if (error != CL_SUCCESS) {
6252 return queue.enqueueWriteBuffer(buffer, blocking, offset,
size, ptr, events, event);
6255inline void* enqueueMapBuffer(
6256 const Buffer& buffer,
6261 const VECTOR_CLASS<Event>* events = NULL,
6262 Event* event = NULL,
6266 CommandQueue queue = CommandQueue::getDefault(&error);
6267 detail::errHandler(error, __ENQUEUE_MAP_BUFFER_ERR);
6272 void * result = ::clEnqueueMapBuffer(
6273 queue(), buffer(), blocking, flags, offset,
size,
6274 (events != NULL) ? (cl_uint) events->size() : 0,
6275 (events != NULL && events->
size() > 0) ? (cl_event*) &events->front() : NULL,
6279 detail::errHandler(error, __ENQUEUE_MAP_BUFFER_ERR);
6286inline cl_int enqueueUnmapMemObject(
6287 const Memory& memory,
6289 const VECTOR_CLASS<Event>* events = NULL,
6290 Event* event = NULL)
6293 CommandQueue queue = CommandQueue::getDefault(&error);
6294 detail::errHandler(error, __ENQUEUE_MAP_BUFFER_ERR);
6295 if (error != CL_SUCCESS) {
6300 cl_int err = detail::errHandler(
6301 ::clEnqueueUnmapMemObject(
6302 queue(), memory(), mapped_ptr,
6303 (events != NULL) ? (cl_uint) events->size() : 0,
6304 (events != NULL && events->
size() > 0) ? (cl_event*) &events->front() : NULL,
6305 (event != NULL) ? &tmp : NULL),
6306 __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
6308 if (event != NULL && err == CL_SUCCESS)
6314inline cl_int enqueueCopyBuffer(
6317 ::size_t src_offset,
6318 ::size_t dst_offset,
6320 const VECTOR_CLASS<Event>* events = NULL,
6321 Event* event = NULL)
6324 CommandQueue queue = CommandQueue::getDefault(&error);
6326 if (error != CL_SUCCESS) {
6330 return queue.enqueueCopyBuffer(src, dst, src_offset, dst_offset,
size, events, event);
6338template<
typename IteratorType >
6339inline cl_int
copy( IteratorType startIterator, IteratorType endIterator,
cl::Buffer &buffer )
6343 if (error != CL_SUCCESS)
6346 return cl::copy(queue, startIterator, endIterator, buffer);
6354template<
typename IteratorType >
6355inline cl_int
copy(
const cl::Buffer &buffer, IteratorType startIterator, IteratorType endIterator )
6359 if (error != CL_SUCCESS)
6362 return cl::copy(queue, buffer, startIterator, endIterator);
6370template<
typename IteratorType >
6376 ::size_t length = endIterator-startIterator;
6377 ::size_t byteLength = length*
sizeof(DataType);
6380 static_cast<DataType*
>(queue.enqueueMapBuffer(buffer, CL_TRUE, CL_MAP_WRITE, 0, byteLength, 0, 0, &error));
6382 if( error != CL_SUCCESS ) {
6385#if defined(_MSC_VER)
6389 stdext::checked_array_iterator<DataType*>(
6392 std::copy(startIterator, endIterator, pointer);
6395 error = queue.enqueueUnmapMemObject(buffer, pointer, 0, &endEvent);
6397 if( error != CL_SUCCESS ) {
6409template<
typename IteratorType >
6415 ::size_t length = endIterator-startIterator;
6416 ::size_t byteLength = length*
sizeof(DataType);
6419 static_cast<DataType*
>(queue.enqueueMapBuffer(buffer, CL_TRUE, CL_MAP_READ, 0, byteLength, 0, 0, &error));
6421 if( error != CL_SUCCESS ) {
6424 std::copy(pointer, pointer + length, startIterator);
6426 error = queue.enqueueUnmapMemObject(buffer, pointer, 0, &endEvent);
6428 if( error != CL_SUCCESS ) {
6435#if defined(CL_VERSION_1_1)
6436inline cl_int enqueueReadBufferRect(
6437 const Buffer& buffer,
6439 const size_t<3>& buffer_offset,
6440 const size_t<3>& host_offset,
6441 const size_t<3>& region,
6442 ::size_t buffer_row_pitch,
6443 ::size_t buffer_slice_pitch,
6444 ::size_t host_row_pitch,
6445 ::size_t host_slice_pitch,
6447 const VECTOR_CLASS<Event>* events = NULL,
6448 Event* event = NULL)
6451 CommandQueue queue = CommandQueue::getDefault(&error);
6453 if (error != CL_SUCCESS) {
6457 return queue.enqueueReadBufferRect(
6472inline cl_int enqueueWriteBufferRect(
6473 const Buffer& buffer,
6475 const size_t<3>& buffer_offset,
6476 const size_t<3>& host_offset,
6477 const size_t<3>& region,
6478 ::size_t buffer_row_pitch,
6479 ::size_t buffer_slice_pitch,
6480 ::size_t host_row_pitch,
6481 ::size_t host_slice_pitch,
6483 const VECTOR_CLASS<Event>* events = NULL,
6484 Event* event = NULL)
6487 CommandQueue queue = CommandQueue::getDefault(&error);
6489 if (error != CL_SUCCESS) {
6493 return queue.enqueueWriteBufferRect(
6508inline cl_int enqueueCopyBufferRect(
6511 const size_t<3>& src_origin,
6512 const size_t<3>& dst_origin,
6513 const size_t<3>& region,
6514 ::size_t src_row_pitch,
6515 ::size_t src_slice_pitch,
6516 ::size_t dst_row_pitch,
6517 ::size_t dst_slice_pitch,
6518 const VECTOR_CLASS<Event>* events = NULL,
6519 Event* event = NULL)
6522 CommandQueue queue = CommandQueue::getDefault(&error);
6524 if (error != CL_SUCCESS) {
6528 return queue.enqueueCopyBufferRect(
6543inline cl_int enqueueReadImage(
6546 const size_t<3>& origin,
6547 const size_t<3>& region,
6549 ::size_t slice_pitch,
6551 const VECTOR_CLASS<Event>* events = NULL,
6552 Event* event = NULL)
6555 CommandQueue queue = CommandQueue::getDefault(&error);
6557 if (error != CL_SUCCESS) {
6561 return queue.enqueueReadImage(
6573inline cl_int enqueueWriteImage(
6576 const size_t<3>& origin,
6577 const size_t<3>& region,
6579 ::size_t slice_pitch,
6581 const VECTOR_CLASS<Event>* events = NULL,
6582 Event* event = NULL)
6585 CommandQueue queue = CommandQueue::getDefault(&error);
6587 if (error != CL_SUCCESS) {
6591 return queue.enqueueWriteImage(
6603inline cl_int enqueueCopyImage(
6606 const size_t<3>& src_origin,
6607 const size_t<3>& dst_origin,
6608 const size_t<3>& region,
6609 const VECTOR_CLASS<Event>* events = NULL,
6610 Event* event = NULL)
6613 CommandQueue queue = CommandQueue::getDefault(&error);
6615 if (error != CL_SUCCESS) {
6619 return queue.enqueueCopyImage(
6629inline cl_int enqueueCopyImageToBuffer(
6632 const size_t<3>& src_origin,
6633 const size_t<3>& region,
6634 ::size_t dst_offset,
6635 const VECTOR_CLASS<Event>* events = NULL,
6636 Event* event = NULL)
6639 CommandQueue queue = CommandQueue::getDefault(&error);
6641 if (error != CL_SUCCESS) {
6645 return queue.enqueueCopyImageToBuffer(
6655inline cl_int enqueueCopyBufferToImage(
6658 ::size_t src_offset,
6659 const size_t<3>& dst_origin,
6660 const size_t<3>& region,
6661 const VECTOR_CLASS<Event>* events = NULL,
6662 Event* event = NULL)
6665 CommandQueue queue = CommandQueue::getDefault(&error);
6667 if (error != CL_SUCCESS) {
6671 return queue.enqueueCopyBufferToImage(
6682inline cl_int
flush(
void)
6685 CommandQueue queue = CommandQueue::getDefault(&error);
6687 if (error != CL_SUCCESS) {
6691 return queue.flush();
6694inline cl_int finish(
void)
6697 CommandQueue queue = CommandQueue::getDefault(&error);
6699 if (error != CL_SUCCESS) {
6704 return queue.finish();
6718 VECTOR_CLASS<Event> events_;
6721 queue_(CommandQueue::getDefault()),
6730 queue_(CommandQueue::getDefault()),
6739 queue_(CommandQueue::getDefault()),
6748 queue_(CommandQueue::getDefault()),
6753 events_.push_back(e);
6757 queue_(CommandQueue::getDefault()),
6762 events_.push_back(e);
6766 queue_(CommandQueue::getDefault()),
6771 events_.push_back(e);
6775 queue_(CommandQueue::getDefault()),
6785 queue_(CommandQueue::getDefault()),
6795 queue_(CommandQueue::getDefault()),
6837 events_.push_back(e);
6846 events_.push_back(e);
6855 events_.push_back(e);
6893template<
int index,
typename T0>
6898 kernel.setArg(index,
arg);
6911 typename T0,
typename T1,
typename T2,
typename T3,
6912 typename T4,
typename T5,
typename T6,
typename T7,
6913 typename T8,
typename T9,
typename T10,
typename T11,
6914 typename T12,
typename T13,
typename T14,
typename T15,
6915 typename T16,
typename T17,
typename T18,
typename T19,
6916 typename T20,
typename T21,
typename T22,
typename T23,
6917 typename T24,
typename T25,
typename T26,
typename T27,
6918 typename T28,
typename T29,
typename T30,
typename T31
6934 cl_int * err = NULL) :
6935 kernel_(program, name.c_str(), err)
7008 args.queue_.enqueueNDRangeKernel(
7099 #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 32))
7101 static_assert(0,
"Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
7325 #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 31))
7327 static_assert(0,
"Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
7547 #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 30))
7549 static_assert(0,
"Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
7765 #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 29))
7767 static_assert(0,
"Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
7979 #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 28))
7981 static_assert(0,
"Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
8189 #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 27))
8191 static_assert(0,
"Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
8395 #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 26))
8397 static_assert(0,
"Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
8597 #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 25))
8599 static_assert(0,
"Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
8795 #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 24))
8797 static_assert(0,
"Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
8989 #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 23))
8991 static_assert(0,
"Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
9179 #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 22))
9181 static_assert(0,
"Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
9365 #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 21))
9367 static_assert(0,
"Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
9547 #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 20))
9549 static_assert(0,
"Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
9725 #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 19))
9727 static_assert(0,
"Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
9899 #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 18))
9901 static_assert(0,
"Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
10069 #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 17))
10071 static_assert(0,
"Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
10235 #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 16))
10237 static_assert(0,
"Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
10397 #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 15))
10399 static_assert(0,
"Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
10555 #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 14))
10557 static_assert(0,
"Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
10709 #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 13))
10711 static_assert(0,
"Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
10859 #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 12))
10861 static_assert(0,
"Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
11005 #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 11))
11007 static_assert(0,
"Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
11147 #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 10))
11149 static_assert(0,
"Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
11285 #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 9))
11287 static_assert(0,
"Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
11419 #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 8))
11421 static_assert(0,
"Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
11549 #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 7))
11551 static_assert(0,
"Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
11675 #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 6))
11677 static_assert(0,
"Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
11797 #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 5))
11799 static_assert(0,
"Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
11915 #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 4))
11917 static_assert(0,
"Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
12029 #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 3))
12031 static_assert(0,
"Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
12139 #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 2))
12141 static_assert(0,
"Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
12245 #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 1))
12247 static_assert(0,
"Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
12281 typename T0,
typename T1 = detail::NullType,
typename T2 = detail::NullType,
12282 typename T3 = detail::NullType,
typename T4 = detail::NullType,
12283 typename T5 = detail::NullType,
typename T6 = detail::NullType,
12284 typename T7 = detail::NullType,
typename T8 = detail::NullType,
12285 typename T9 = detail::NullType,
typename T10 = detail::NullType,
12286 typename T11 = detail::NullType,
typename T12 = detail::NullType,
12287 typename T13 = detail::NullType,
typename T14 = detail::NullType,
12288 typename T15 = detail::NullType,
typename T16 = detail::NullType,
12289 typename T17 = detail::NullType,
typename T18 = detail::NullType,
12290 typename T19 = detail::NullType,
typename T20 = detail::NullType,
12291 typename T21 = detail::NullType,
typename T22 = detail::NullType,
12292 typename T23 = detail::NullType,
typename T24 = detail::NullType,
12293 typename T25 = detail::NullType,
typename T26 = detail::NullType,
12294 typename T27 = detail::NullType,
typename T28 = detail::NullType,
12295 typename T29 = detail::NullType,
typename T30 = detail::NullType,
12296 typename T31 = detail::NullType
12303 T12, T13, T14, T15,
12304 T16, T17, T18, T19,
12305 T20, T21, T22, T23,
12306 T24, T25, T26, T27,
12315 T12, T13, T14, T15,
12316 T16, T17, T18, T19,
12317 T20, T21, T22, T23,
12318 T24, T25, T26, T27,
12325 cl_int * err = NULL) :
12330 T12, T13, T14, T15,
12331 T16, T17, T18, T19,
12332 T20, T21, T22, T23,
12333 T24, T25, T26, T27,
12345 T12, T13, T14, T15,
12346 T16, T17, T18, T19,
12347 T20, T21, T22, T23,
12348 T24, T25, T26, T27,
12359#if !defined(__CL_USER_OVERRIDE_ERROR_STRINGS)
12360#undef __GET_DEVICE_INFO_ERR
12361#undef __GET_PLATFORM_INFO_ERR
12362#undef __GET_DEVICE_IDS_ERR
12363#undef __GET_CONTEXT_INFO_ERR
12364#undef __GET_EVENT_INFO_ERR
12365#undef __GET_EVENT_PROFILE_INFO_ERR
12366#undef __GET_MEM_OBJECT_INFO_ERR
12367#undef __GET_IMAGE_INFO_ERR
12368#undef __GET_SAMPLER_INFO_ERR
12369#undef __GET_KERNEL_INFO_ERR
12370#undef __GET_KERNEL_ARG_INFO_ERR
12371#undef __GET_KERNEL_WORK_GROUP_INFO_ERR
12372#undef __GET_PROGRAM_INFO_ERR
12373#undef __GET_PROGRAM_BUILD_INFO_ERR
12374#undef __GET_COMMAND_QUEUE_INFO_ERR
12376#undef __CREATE_CONTEXT_ERR
12377#undef __CREATE_CONTEXT_FROM_TYPE_ERR
12378#undef __GET_SUPPORTED_IMAGE_FORMATS_ERR
12380#undef __CREATE_BUFFER_ERR
12381#undef __CREATE_SUBBUFFER_ERR
12382#undef __CREATE_IMAGE2D_ERR
12383#undef __CREATE_IMAGE3D_ERR
12384#undef __CREATE_SAMPLER_ERR
12385#undef __SET_MEM_OBJECT_DESTRUCTOR_CALLBACK_ERR
12387#undef __CREATE_USER_EVENT_ERR
12388#undef __SET_USER_EVENT_STATUS_ERR
12389#undef __SET_EVENT_CALLBACK_ERR
12390#undef __SET_PRINTF_CALLBACK_ERR
12392#undef __WAIT_FOR_EVENTS_ERR
12394#undef __CREATE_KERNEL_ERR
12395#undef __SET_KERNEL_ARGS_ERR
12396#undef __CREATE_PROGRAM_WITH_SOURCE_ERR
12397#undef __CREATE_PROGRAM_WITH_BINARY_ERR
12398#undef __CREATE_PROGRAM_WITH_BUILT_IN_KERNELS_ERR
12399#undef __BUILD_PROGRAM_ERR
12400#undef __CREATE_KERNELS_IN_PROGRAM_ERR
12402#undef __CREATE_COMMAND_QUEUE_ERR
12403#undef __SET_COMMAND_QUEUE_PROPERTY_ERR
12404#undef __ENQUEUE_READ_BUFFER_ERR
12405#undef __ENQUEUE_WRITE_BUFFER_ERR
12406#undef __ENQUEUE_READ_BUFFER_RECT_ERR
12407#undef __ENQUEUE_WRITE_BUFFER_RECT_ERR
12408#undef __ENQEUE_COPY_BUFFER_ERR
12409#undef __ENQEUE_COPY_BUFFER_RECT_ERR
12410#undef __ENQUEUE_READ_IMAGE_ERR
12411#undef __ENQUEUE_WRITE_IMAGE_ERR
12412#undef __ENQUEUE_COPY_IMAGE_ERR
12413#undef __ENQUEUE_COPY_IMAGE_TO_BUFFER_ERR
12414#undef __ENQUEUE_COPY_BUFFER_TO_IMAGE_ERR
12415#undef __ENQUEUE_MAP_BUFFER_ERR
12416#undef __ENQUEUE_MAP_IMAGE_ERR
12417#undef __ENQUEUE_UNMAP_MEM_OBJECT_ERR
12418#undef __ENQUEUE_NDRANGE_KERNEL_ERR
12419#undef __ENQUEUE_TASK_ERR
12420#undef __ENQUEUE_NATIVE_KERNEL
12422#undef __CL_EXPLICIT_CONSTRUCTORS
12424#undef __UNLOAD_COMPILER_ERR
12427#undef __CL_FUNCTION_TYPE
12433#if defined(CL_VERSION_1_1)
12434#undef __INIT_CL_EXT_FCN_PTR
12436#undef __CREATE_SUB_DEVICES
12438#if defined(USE_CL_DEVICE_FISSION)
12439#undef __PARAM_NAME_DEVICE_FISSION
12442#undef __DEFAULT_NOT_INITIALIZED
12443#undef __DEFAULT_BEING_INITIALIZED
12444#undef __DEFAULT_INITIALIZED
12449#pragma pop_macro("max")
constexpr complex< _Tp > & operator=(const _Tp &)
void resize(size_t __size, _Tp __c=_Tp())
gslice_array< _Tp > operator[](const gslice &__s)
valarray< size_t > size() const
constexpr _OI copy(_II __first, _II __last, _OI __result)
constexpr auto empty(const _Container &__cont) noexcept(noexcept(__cont.empty())) -> decltype(__cont.empty())
basic_ostream< _CharT, _Traits > & flush(basic_ostream< _CharT, _Traits > &__os)
constexpr auto begin(_Container &__cont) -> decltype(__cont.begin())
constexpr auto end(_Container &__cont) -> decltype(__cont.end())
__gnu_cxx::__promote< _Tp >::__type arg(_Tp __x)
Class interface for GL Buffer Memory Objects.
Definition cl.hpp:3322
BufferGL(const BufferGL &buffer)
Copy constructor - performs shallow copy.
Definition cl.hpp:3355
cl_int getObjectInfo(cl_gl_object_type *type, GLuint *gl_object_name)
Wrapper for clGetGLObjectInfo().
Definition cl.hpp:3386
BufferGL & operator=(const BufferGL &rhs)
Assignment from BufferGL - performs shallow copy.
Definition cl.hpp:3367
BufferGL()
Default constructor - initializes to NULL.
Definition cl.hpp:3349
BufferGL(const Context &context, cl_mem_flags flags, GLuint bufobj, cl_int *err=NULL)
Constructs a BufferGL in a specified context, from a given GL buffer.
Definition cl.hpp:3329
__CL_EXPLICIT_CONSTRUCTORS BufferGL(const cl_mem &buffer)
Constructor from cl_mem - takes ownership.
Definition cl.hpp:3361
Class interface for GL Render Buffer Memory Objects.
Definition cl.hpp:3405
BufferRenderGL(const Context &context, cl_mem_flags flags, GLuint bufobj, cl_int *err=NULL)
Constructs a BufferRenderGL in a specified context, from a given GL Renderbuffer.
Definition cl.hpp:3412
__CL_EXPLICIT_CONSTRUCTORS BufferRenderGL(const cl_mem &buffer)
Constructor from cl_mem - takes ownership.
Definition cl.hpp:3444
BufferRenderGL()
Default constructor - initializes to NULL.
Definition cl.hpp:3432
BufferRenderGL(const BufferGL &buffer)
Copy constructor - performs shallow copy.
Definition cl.hpp:3438
cl_int getObjectInfo(cl_gl_object_type *type, GLuint *gl_object_name)
Wrapper for clGetGLObjectInfo().
Definition cl.hpp:3469
BufferRenderGL & operator=(const BufferRenderGL &rhs)
Assignment from BufferGL - performs shallow copy.
Definition cl.hpp:3450
Class interface for Buffer Memory Objects.
Definition cl.hpp:3038
Buffer()
Default constructor - initializes to NULL.
Definition cl.hpp:3152
Buffer & operator=(const Buffer &rhs)
Assignment from Buffer - performs shallow copy.
Definition cl.hpp:3170
Buffer(const Context &context, cl_mem_flags flags, ::size_t size, void *host_ptr=NULL, cl_int *err=NULL)
Constructs a Buffer in a specified context.
Definition cl.hpp:3048
Buffer(const Context &context, IteratorType startIterator, IteratorType endIterator, bool readOnly, bool useHostPtr=false, cl_int *err=NULL)
Construct a Buffer from a host container via iterators using a specified context. IteratorType must b...
Buffer(cl_mem_flags flags, ::size_t size, void *host_ptr=NULL, cl_int *err=NULL)
Constructs a Buffer in the default context.
Definition cl.hpp:3073
Buffer(IteratorType startIterator, IteratorType endIterator, bool readOnly, bool useHostPtr=false, cl_int *err=NULL)
Construct a Buffer from a host container via iterators. IteratorType must be random access....
Definition cl.hpp:3097
__CL_EXPLICIT_CONSTRUCTORS Buffer(const cl_mem &buffer)
Constructor from cl_mem - takes ownership.
Definition cl.hpp:3164
Buffer(const Buffer &buffer)
Copy constructor - performs shallow copy.
Definition cl.hpp:3158
Class interface for GL 2D Image Memory objects.
Definition cl.hpp:3879
__CL_EXPLICIT_CONSTRUCTORS Image2DGL(const cl_mem &image)
Constructor from cl_mem - takes ownership.
Definition cl.hpp:3923
Image2DGL(const Context &context, cl_mem_flags flags, GLenum target, GLint miplevel, GLuint texobj, cl_int *err=NULL)
Constructs an Image2DGL in a specified context, from a given GL Texture.
Definition cl.hpp:3886
Image2DGL(const Image2DGL &image)
Copy constructor - performs shallow copy.
Definition cl.hpp:3917
Image2DGL()
Default constructor - initializes to NULL.
Definition cl.hpp:3911
CommandQueue interface for cl_command_queue.
Definition cl.hpp:5090
cl_int flush() const
Deprecated APIs for 1.2.
Definition cl.hpp:6145
cl_int enqueueAcquireGLObjects(const VECTOR_CLASS< Memory > *mem_objects=NULL, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL) const
Deprecated APIs for 1.2.
Definition cl.hpp:6011
CommandQueue(const Context &context, cl_command_queue_properties properties=0, cl_int *err=NULL)
Constructs a CommandQueue for an implementation defined device in the given context.
Definition cl.hpp:5125
Deprecated APIs for 1.2.
Definition cl.hpp:2348
cl_int getSupportedImageFormats(cl_mem_flags flags, cl_mem_object_type type, VECTOR_CLASS< ImageFormat > *formats) const
Gets a list of supported image formats.
Definition cl.hpp:2624
Context(const VECTOR_CLASS< Device > &devices, cl_context_properties *properties=NULL, void(CL_CALLBACK *notifyFptr)(const char *, const void *, ::size_t, void *)=NULL, void *data=NULL, cl_int *err=NULL)
Constructs a context including a list of specified devices.
Definition cl.hpp:2364
detail::param_traits< detail::cl_context_info, name >::param_type getInfo(cl_int *err=NULL) const
Wrapper for clGetContextInfo() that returns by value.
Definition cl.hpp:2609
Context(cl_device_type type, cl_context_properties *properties=NULL, void(CL_CALLBACK *notifyFptr)(const char *, const void *, ::size_t, void *)=NULL, void *data=NULL, cl_int *err=NULL)
Constructs a context including all or a subset of devices of a specified type.
Definition cl.hpp:2424
Context()
Default constructor - initializes to NULL.
Definition cl.hpp:2558
cl_int getInfo(cl_context_info name, T *param) const
Wrapper for clGetContextInfo().
Definition cl.hpp:2599
Context & operator=(const Context &rhs)
Assignment operator from Context.
Definition cl.hpp:2578
static Context getDefault(cl_int *err=NULL)
Returns a singleton context including all devices of CL_DEVICE_TYPE_DEFAULT.
Definition cl.hpp:2509
Context(const Context &context)
Copy constructor.
Definition cl.hpp:2564
__CL_EXPLICIT_CONSTRUCTORS Context(const cl_context &context)
Constructor from cl_context - takes ownership.
Definition cl.hpp:2571
~Context()
Destructor.
Definition cl.hpp:2358
Class interface for cl_device_id.
Definition cl.hpp:1908
static Device getDefault(cl_int *err=NULL)
Returns the first device on the default context.
Definition cl.hpp:2659
cl_int getInfo(cl_device_info name, T *param) const
Wrapper for clGetDeviceInfo().
Definition cl.hpp:1955
Device()
Default constructor - initializes to NULL.
Definition cl.hpp:1911
Device(const Device &device)
Copy constructor.
Definition cl.hpp:1917
detail::param_traits< detail::cl_device_info, name >::param_type getInfo(cl_int *err=NULL) const
Wrapper for clGetDeviceInfo() that returns by value.
Definition cl.hpp:1965
Device(const cl_device_id &device)
Constructor from cl_device_id.
Definition cl.hpp:1923
Device & operator=(const Device &rhs)
Assignment operator from Device.
Definition cl.hpp:1935
Class interface for cl_event.
Definition cl.hpp:2702
~Event()
Destructor.
Definition cl.hpp:2708
Event(const cl_event &event)
Constructor from cl_event - takes ownership.
Definition cl.hpp:2724
cl_int getProfilingInfo(cl_profiling_info name, T *param) const
Wrapper for clGetEventProfilingInfo().
Definition cl.hpp:2775
cl_int getInfo(cl_event_info name, T *param) const
Wrapper for clGetEventInfo().
Definition cl.hpp:2752
cl_int wait() const
Blocks the calling thread until this event completes.
Definition cl.hpp:2800
detail::param_traits< detail::cl_event_info, name >::param_type getInfo(cl_int *err=NULL) const
Wrapper for clGetEventInfo() that returns by value.
Definition cl.hpp:2762
detail::param_traits< detail::cl_profiling_info, name >::param_type getProfilingInfo(cl_int *err=NULL) const
Wrapper for clGetEventProfilingInfo() that returns by value.
Definition cl.hpp:2785
Event()
Default constructor - initializes to NULL.
Definition cl.hpp:2711
Event & operator=(const Event &rhs)
Assignment operator from cl_event - takes ownership.
Definition cl.hpp:2731
static cl_int waitForEvents(const VECTOR_CLASS< Event > &events)
Blocks the calling thread until every event specified is complete.
Definition cl.hpp:2832
Event(const Event &event)
Copy constructor.
Definition cl.hpp:2717
Class interface for 2D Image Memory objects.
Definition cl.hpp:3758
Image2D(const Context &context, cl_mem_flags flags, ImageFormat format, ::size_t width, ::size_t height, ::size_t row_pitch=0, void *host_ptr=NULL, cl_int *err=NULL)
Constructs a 1D Image in a specified context.
Definition cl.hpp:3764
__CL_EXPLICIT_CONSTRUCTORS Image2D(const cl_mem &image2D)
Constructor from cl_mem - takes ownership.
Definition cl.hpp:3842
Image2D & operator=(const Image2D &rhs)
Assignment from Image2D - performs shallow copy.
Definition cl.hpp:3848
Image2D()
Default constructor - initializes to NULL.
Definition cl.hpp:3830
Image2D(const Image2D &image2D)
Copy constructor - performs shallow copy.
Definition cl.hpp:3836
Class interface for GL 3D Image Memory objects.
Definition cl.hpp:4147
Image3DGL()
Default constructor - initializes to NULL.
Definition cl.hpp:4178
Image3DGL(const Image3DGL &image)
Copy constructor - performs shallow copy.
Definition cl.hpp:4184
Image3DGL(const Context &context, cl_mem_flags flags, GLenum target, GLint miplevel, GLuint texobj, cl_int *err=NULL)
Constructs an Image3DGL in a specified context, from a given GL Texture.
Definition cl.hpp:4154
__CL_EXPLICIT_CONSTRUCTORS Image3DGL(const cl_mem &image)
Constructor from cl_mem - takes ownership.
Definition cl.hpp:4190
Image3DGL & operator=(const Image3DGL &rhs)
Assignment from Image3DGL - performs shallow copy.
Definition cl.hpp:4196
Class interface for 3D Image Memory objects.
Definition cl.hpp:4023
Image3D(const Context &context, cl_mem_flags flags, ImageFormat format, ::size_t width, ::size_t height, ::size_t depth, ::size_t row_pitch=0, ::size_t slice_pitch=0, void *host_ptr=NULL, cl_int *err=NULL)
Constructs a 3D Image in a specified context.
Definition cl.hpp:4029
__CL_EXPLICIT_CONSTRUCTORS Image3D(const cl_mem &image3D)
Constructor from cl_mem - takes ownership.
Definition cl.hpp:4112
Image3D & operator=(const Image3D &rhs)
Assignment from Image3D - performs shallow copy.
Definition cl.hpp:4118
Image3D()
Default constructor - initializes to NULL.
Definition cl.hpp:4100
Image3D(const Image3D &image3D)
Copy constructor - performs shallow copy.
Definition cl.hpp:4106
C++ base class for Image Memory objects.
Definition cl.hpp:3486
Image & operator=(const Image &rhs)
Assignment from Image - performs shallow copy.
Definition cl.hpp:3507
detail::param_traits< detail::cl_image_info, name >::param_type getImageInfo(cl_int *err=NULL) const
Wrapper for clGetImageInfo() that returns by value.
Definition cl.hpp:3538
cl_int getImageInfo(cl_image_info name, T *param) const
Wrapper for clGetImageInfo().
Definition cl.hpp:3528
Image(const Image &image)
Copy constructor - performs shallow copy.
Definition cl.hpp:3495
__CL_EXPLICIT_CONSTRUCTORS Image(const cl_mem &image)
Constructor from cl_mem - takes ownership.
Definition cl.hpp:3501
Image()
Default constructor - initializes to NULL.
Definition cl.hpp:3489
Class interface for cl_kernel.
Definition cl.hpp:4492
Kernel()
Default constructor - initializes to NULL.
Definition cl.hpp:4503
Kernel & operator=(const Kernel &rhs)
Assignment operator from Kernel.
Definition cl.hpp:4523
Kernel(const Kernel &kernel)
Copy constructor - performs shallow copy.
Definition cl.hpp:4509
__CL_EXPLICIT_CONSTRUCTORS Kernel(const cl_kernel &kernel)
Constructor from cl_kernel - takes ownership.
Definition cl.hpp:4516
~Kernel()
Destructor.
Definition cl.hpp:4500
Class interface for cl_mem.
Definition cl.hpp:2918
Memory(const Memory &memory)
Copy constructor - performs shallow copy.
Definition cl.hpp:2934
detail::param_traits< detail::cl_mem_info, name >::param_type getInfo(cl_int *err=NULL) const
Wrapper for clGetMemObjectInfo() that returns by value.
Definition cl.hpp:2979
Memory()
Default constructor - initializes to NULL.
Definition cl.hpp:2928
Memory & operator=(const Memory &rhs)
Assignment operator from Memory.
Definition cl.hpp:2948
~Memory()
Destructor.
Definition cl.hpp:2925
cl_int getInfo(cl_mem_info name, T *param) const
Wrapper for clGetMemObjectInfo().
Definition cl.hpp:2969
__CL_EXPLICIT_CONSTRUCTORS Memory(const cl_mem &memory)
Constructor from cl_mem - takes ownership.
Definition cl.hpp:2941
Class interface for specifying NDRange values.
Definition cl.hpp:4383
NDRange(::size_t size0, ::size_t size1)
Constructs two-dimensional range.
Definition cl.hpp:4402
NDRange(::size_t size0)
Constructs one-dimensional range.
Definition cl.hpp:4395
NDRange(::size_t size0, ::size_t size1, ::size_t size2)
Constructs three-dimensional range.
Definition cl.hpp:4410
NDRange()
Default constructor - resulting range has zero dimensions.
Definition cl.hpp:4390
::size_t dimensions() const
Queries the number of dimensions in the range.
Definition cl.hpp:4427
Program interface that implements cl_program.
Definition cl.hpp:4633
Program(const Context &context, const VECTOR_CLASS< Device > &devices, const Binaries &binaries, VECTOR_CLASS< cl_int > *binaryStatus=NULL, cl_int *err=NULL)
Construct a program object from a list of devices and a per-device list of binaries.
Definition cl.hpp:4751
Class interface for cl_sampler.
Definition cl.hpp:4280
Sampler(const Sampler &sampler)
Copy constructor - performs shallow copy.
Definition cl.hpp:4320
Sampler()
Default constructor - initializes to NULL.
Definition cl.hpp:4289
~Sampler()
Destructor.
Definition cl.hpp:4286
Sampler(const Context &context, cl_bool normalized_coords, cl_addressing_mode addressing_mode, cl_filter_mode filter_mode, cl_int *err=NULL)
Constructs a Sampler in a specified context.
Definition cl.hpp:4295
cl_int getInfo(cl_sampler_info name, T *param) const
Wrapper for clGetSamplerInfo().
Definition cl.hpp:4355
Sampler & operator=(const Sampler &rhs)
Assignment operator from Sampler.
Definition cl.hpp:4334
Sampler(const cl_sampler &sampler)
Constructor from cl_sampler - takes ownership.
Definition cl.hpp:4327
detail::param_traits< detail::cl_sampler_info, name >::param_type getInfo(cl_int *err=NULL) const
Wrapper for clGetSamplerInfo() that returns by value.
Definition cl.hpp:4365
class used to interface between C++ and OpenCL C calls that require arrays of size_t values,...
Definition cl.hpp:1051
size_t()
Initialize size_t to all 0s.
Definition cl.hpp:1057
Column< R, value > operator*(const Matrix< R, C, value > &A, const Column< C, value > &V)
CartesianChart4D ::vector vector
bool operator==(const MultipleStringSelection &a, const MultipleStringSelection &b)
bool operator!=(const MultipleStringSelection &a, const MultipleStringSelection &b)
The OpenCL C++ bindings are defined within this namespace.
cl_int copy(IteratorType startIterator, IteratorType endIterator, cl::Buffer &buffer)
Blocking copy operation between iterators and a buffer.
Definition cl.hpp:6339
LocalSpaceArg Local(::size_t size)
Helper function for generating LocalSpaceArg objects.
Definition cl.hpp:4475
CL_EXT_PREFIX__VERSION_1_1_DEPRECATED LocalSpaceArg __local(::size_t size) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
Helper function for generating LocalSpaceArg objects. Deprecated. Replaced with Local.
Definition cl.hpp:4465
std::string STRING_CLASS
CL 1.2 marker and barrier commands.
Definition cl.hpp:466
Local address wrapper for use with Kernel::setArg.
Definition cl.hpp:4435
cl::detail::functionImplementation_< T0, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::type_ Event type_(const EnqueueArgs &, T0)
Function signature of kernel functor with no event dependency.
Definition cl.hpp:12256
cl::detail::functionImplementation_< T0, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::result_type Event result_type
Return type of the functor.
Definition cl.hpp:12253
cl::detail::functionImplementation_< T0, T1, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::result_type Event result_type
Return type of the functor.
Definition cl.hpp:12147
cl::detail::functionImplementation_< T0, T1, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::type_ Event type_(const EnqueueArgs &, T0, T1)
Function signature of kernel functor with no event dependency.
Definition cl.hpp:12150
cl::detail::functionImplementation_< T0, T1, T2, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::type_ Event type_(const EnqueueArgs &, T0, T1, T2)
Function signature of kernel functor with no event dependency.
Definition cl.hpp:12040
cl::detail::functionImplementation_< T0, T1, T2, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::result_type Event result_type
Return type of the functor.
Definition cl.hpp:12037
cl::detail::functionImplementation_< T0, T1, T2, T3, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::type_ Event type_(const EnqueueArgs &, T0, T1, T2, T3)
Function signature of kernel functor with no event dependency.
Definition cl.hpp:11926
cl::detail::functionImplementation_< T0, T1, T2, T3, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::result_type Event result_type
Return type of the functor.
Definition cl.hpp:11923
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::result_type Event result_type
Return type of the functor.
Definition cl.hpp:11805
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::type_ Event type_(const EnqueueArgs &, T0, T1, T2, T3, T4)
Function signature of kernel functor with no event dependency.
Definition cl.hpp:11808
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::result_type Event result_type
Return type of the functor.
Definition cl.hpp:9907
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::type_ Event type_(const EnqueueArgs &, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17)
Function signature of kernel functor with no event dependency.
Definition cl.hpp:9910
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::type_ Event type_(const EnqueueArgs &, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14)
Function signature of kernel functor with no event dependency.
Definition cl.hpp:10408
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::result_type Event result_type
Return type of the functor.
Definition cl.hpp:10405
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::type_ Event type_(const EnqueueArgs &, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20)
Function signature of kernel functor with no event dependency.
Definition cl.hpp:9376
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::result_type Event result_type
Return type of the functor.
Definition cl.hpp:9373
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::type_ Event type_(const EnqueueArgs &, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)
Function signature of kernel functor with no event dependency.
Definition cl.hpp:10870
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::result_type Event result_type
Return type of the functor.
Definition cl.hpp:10867
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, NullType, NullType, NullType, NullType >::result_type Event result_type
Return type of the functor.
Definition cl.hpp:7987
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, NullType, NullType, NullType, NullType >::type_ Event type_(const EnqueueArgs &, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27)
Function signature of kernel functor with no event dependency.
Definition cl.hpp:7990
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::result_type Event result_type
Return type of the functor.
Definition cl.hpp:10717
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::type_ Event type_(const EnqueueArgs &, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)
Function signature of kernel functor with no event dependency.
Definition cl.hpp:10720
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::result_type Event result_type
Return type of the functor.
Definition cl.hpp:11683
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::type_ Event type_(const EnqueueArgs &, T0, T1, T2, T3, T4, T5)
Function signature of kernel functor with no event dependency.
Definition cl.hpp:11686
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::type_ Event type_(const EnqueueArgs &, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22)
Function signature of kernel functor with no event dependency.
Definition cl.hpp:9000
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::result_type Event result_type
Return type of the functor.
Definition cl.hpp:8997
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, NullType, NullType, NullType, NullType, NullType >::result_type Event result_type
Return type of the functor.
Definition cl.hpp:8197
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, NullType, NullType, NullType, NullType, NullType >::type_ Event type_(const EnqueueArgs &, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26)
Function signature of kernel functor with no event dependency.
Definition cl.hpp:8200
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::type_ Event type_(const EnqueueArgs &, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15)
Function signature of kernel functor with no event dependency.
Definition cl.hpp:10246
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::result_type Event result_type
Return type of the functor.
Definition cl.hpp:10243
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::type_ Event type_(const EnqueueArgs &, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21)
Function signature of kernel functor with no event dependency.
Definition cl.hpp:9190
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::result_type Event result_type
Return type of the functor.
Definition cl.hpp:9187
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, NullType, NullType, NullType, NullType, NullType, NullType >::type_ Event type_(const EnqueueArgs &, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25)
Function signature of kernel functor with no event dependency.
Definition cl.hpp:8406
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, NullType, NullType, NullType, NullType, NullType, NullType >::result_type Event result_type
Return type of the functor.
Definition cl.hpp:8403
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::result_type Event result_type
Return type of the functor.
Definition cl.hpp:8605
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::type_ Event type_(const EnqueueArgs &, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24)
Function signature of kernel functor with no event dependency.
Definition cl.hpp:8608
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::type_ Event type_(const EnqueueArgs &, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)
Function signature of kernel functor with no event dependency.
Definition cl.hpp:11016
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::result_type Event result_type
Return type of the functor.
Definition cl.hpp:11013
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::type_ Event type_(const EnqueueArgs &, T0, T1, T2, T3, T4, T5, T6, T7)
Function signature of kernel functor with no event dependency.
Definition cl.hpp:11430
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::result_type Event result_type
Return type of the functor.
Definition cl.hpp:11427
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::type_ Event type_(const EnqueueArgs &, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13)
Function signature of kernel functor with no event dependency.
Definition cl.hpp:10566
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::result_type Event result_type
Return type of the functor.
Definition cl.hpp:10563
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::result_type Event result_type
Return type of the functor.
Definition cl.hpp:11557
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::type_ Event type_(const EnqueueArgs &, T0, T1, T2, T3, T4, T5, T6)
Function signature of kernel functor with no event dependency.
Definition cl.hpp:11560
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::result_type Event result_type
Return type of the functor.
Definition cl.hpp:11155
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::type_ Event type_(const EnqueueArgs &, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)
Function signature of kernel functor with no event dependency.
Definition cl.hpp:11158
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::result_type Event result_type
Return type of the functor.
Definition cl.hpp:9733
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::type_ Event type_(const EnqueueArgs &, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18)
Function signature of kernel functor with no event dependency.
Definition cl.hpp:9736
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, NullType, NullType, NullType >::type_ Event type_(const EnqueueArgs &, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28)
Function signature of kernel functor with no event dependency.
Definition cl.hpp:7776
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, NullType, NullType, NullType >::result_type Event result_type
Return type of the functor.
Definition cl.hpp:7773
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::result_type Event result_type
Return type of the functor.
Definition cl.hpp:10077
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::type_ Event type_(const EnqueueArgs &, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16)
Function signature of kernel functor with no event dependency.
Definition cl.hpp:10080
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::result_type Event result_type
Return type of the functor.
Definition cl.hpp:8803
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::type_ Event type_(const EnqueueArgs &, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23)
Function signature of kernel functor with no event dependency.
Definition cl.hpp:8806
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, T8, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::type_ Event type_(const EnqueueArgs &, T0, T1, T2, T3, T4, T5, T6, T7, T8)
Function signature of kernel functor with no event dependency.
Definition cl.hpp:11296
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, T8, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::result_type Event result_type
Return type of the functor.
Definition cl.hpp:11293
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, NullType >::type_ Event type_(const EnqueueArgs &, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30)
Function signature of kernel functor with no event dependency.
Definition cl.hpp:7336
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, NullType >::result_type Event result_type
Return type of the functor.
Definition cl.hpp:7333
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, NullType, NullType >::result_type Event result_type
Return type of the functor.
Definition cl.hpp:7555
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, NullType, NullType >::type_ Event type_(const EnqueueArgs &, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29)
Function signature of kernel functor with no event dependency.
Definition cl.hpp:7558
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::result_type Event result_type
Return type of the functor.
Definition cl.hpp:9555
cl::detail::functionImplementation_< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType >::type_ Event type_(const EnqueueArgs &, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19)
Function signature of kernel functor with no event dependency.
Definition cl.hpp:9558
Event type_(const EnqueueArgs &, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31)
Function signature of kernel functor with no event dependency.
Definition cl.hpp:7110
Event result_type
Return type of the functor.
Definition cl.hpp:7107