395 #if !defined(CL_HPP_USE_DX_INTEROP) && defined(USE_DX_INTEROP)
396 # pragma message("opencl.hpp: USE_DX_INTEROP is deprecated. Define CL_HPP_USE_DX_INTEROP instead")
397 # define CL_HPP_USE_DX_INTEROP
399 #if !defined(CL_HPP_USE_CL_DEVICE_FISSION) && defined(USE_CL_DEVICE_FISSION)
400 # pragma message("opencl.hpp: USE_CL_DEVICE_FISSION is deprecated. Define CL_HPP_USE_CL_DEVICE_FISSION instead")
401 # define CL_HPP_USE_CL_DEVICE_FISSION
403 #if !defined(CL_HPP_ENABLE_EXCEPTIONS) && defined(__CL_ENABLE_EXCEPTIONS)
404 # pragma message("opencl.hpp: __CL_ENABLE_EXCEPTIONS is deprecated. Define CL_HPP_ENABLE_EXCEPTIONS instead")
405 # define CL_HPP_ENABLE_EXCEPTIONS
407 #if !defined(CL_HPP_NO_STD_VECTOR) && defined(__NO_STD_VECTOR)
408 # pragma message("opencl.hpp: __NO_STD_VECTOR is deprecated. Define CL_HPP_NO_STD_VECTOR instead")
409 # define CL_HPP_NO_STD_VECTOR
411 #if !defined(CL_HPP_NO_STD_STRING) && defined(__NO_STD_STRING)
412 # pragma message("opencl.hpp: __NO_STD_STRING is deprecated. Define CL_HPP_NO_STD_STRING instead")
413 # define CL_HPP_NO_STD_STRING
415 #if defined(VECTOR_CLASS)
416 # pragma message("opencl.hpp: VECTOR_CLASS is deprecated. Alias cl::vector instead")
418 #if defined(STRING_CLASS)
419 # pragma message("opencl.hpp: STRING_CLASS is deprecated. Alias cl::string instead.")
421 #if !defined(CL_HPP_USER_OVERRIDE_ERROR_STRINGS) && defined(__CL_USER_OVERRIDE_ERROR_STRINGS)
422 # pragma message("opencl.hpp: __CL_USER_OVERRIDE_ERROR_STRINGS is deprecated. Define CL_HPP_USER_OVERRIDE_ERROR_STRINGS instead")
423 # define CL_HPP_USER_OVERRIDE_ERROR_STRINGS
428 #if defined(__USE_DEV_VECTOR)
429 # pragma message("opencl.hpp: __USE_DEV_VECTOR is no longer supported. Expect compilation errors")
431 #if defined(__USE_DEV_STRING)
432 # pragma message("opencl.hpp: __USE_DEV_STRING is no longer supported. Expect compilation errors")
436 #if !defined(CL_HPP_TARGET_OPENCL_VERSION)
437 # pragma message("opencl.hpp: CL_HPP_TARGET_OPENCL_VERSION is not defined. It will default to 300 (OpenCL 3.0)")
438 # define CL_HPP_TARGET_OPENCL_VERSION 300
440 #if CL_HPP_TARGET_OPENCL_VERSION != 100 && \
441 CL_HPP_TARGET_OPENCL_VERSION != 110 && \
442 CL_HPP_TARGET_OPENCL_VERSION != 120 && \
443 CL_HPP_TARGET_OPENCL_VERSION != 200 && \
444 CL_HPP_TARGET_OPENCL_VERSION != 210 && \
445 CL_HPP_TARGET_OPENCL_VERSION != 220 && \
446 CL_HPP_TARGET_OPENCL_VERSION != 300
447 # pragma message("opencl.hpp: CL_HPP_TARGET_OPENCL_VERSION is not a valid value (100, 110, 120, 200, 210, 220 or 300). It will be set to 300 (OpenCL 3.0).")
448 # undef CL_HPP_TARGET_OPENCL_VERSION
449 # define CL_HPP_TARGET_OPENCL_VERSION 300
453 #if defined(CL_TARGET_OPENCL_VERSION)
456 #if CL_TARGET_OPENCL_VERSION < CL_HPP_TARGET_OPENCL_VERSION
457 # pragma message("CL_TARGET_OPENCL_VERSION is already defined as is lower than CL_HPP_TARGET_OPENCL_VERSION")
460 # define CL_TARGET_OPENCL_VERSION CL_HPP_TARGET_OPENCL_VERSION
463 #if !defined(CL_HPP_MINIMUM_OPENCL_VERSION)
464 # define CL_HPP_MINIMUM_OPENCL_VERSION 200
466 #if CL_HPP_MINIMUM_OPENCL_VERSION != 100 && \
467 CL_HPP_MINIMUM_OPENCL_VERSION != 110 && \
468 CL_HPP_MINIMUM_OPENCL_VERSION != 120 && \
469 CL_HPP_MINIMUM_OPENCL_VERSION != 200 && \
470 CL_HPP_MINIMUM_OPENCL_VERSION != 210 && \
471 CL_HPP_MINIMUM_OPENCL_VERSION != 220 && \
472 CL_HPP_MINIMUM_OPENCL_VERSION != 300
473 # pragma message("opencl.hpp: CL_HPP_MINIMUM_OPENCL_VERSION is not a valid value (100, 110, 120, 200, 210, 220 or 300). It will be set to 100")
474 # undef CL_HPP_MINIMUM_OPENCL_VERSION
475 # define CL_HPP_MINIMUM_OPENCL_VERSION 100
477 #if CL_HPP_MINIMUM_OPENCL_VERSION > CL_HPP_TARGET_OPENCL_VERSION
478 # error "CL_HPP_MINIMUM_OPENCL_VERSION must not be greater than CL_HPP_TARGET_OPENCL_VERSION"
481 #if CL_HPP_MINIMUM_OPENCL_VERSION <= 100 && !defined(CL_USE_DEPRECATED_OPENCL_1_0_APIS)
482 # define CL_USE_DEPRECATED_OPENCL_1_0_APIS
484 #if CL_HPP_MINIMUM_OPENCL_VERSION <= 110 && !defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
485 # define CL_USE_DEPRECATED_OPENCL_1_1_APIS
487 #if CL_HPP_MINIMUM_OPENCL_VERSION <= 120 && !defined(CL_USE_DEPRECATED_OPENCL_1_2_APIS)
488 # define CL_USE_DEPRECATED_OPENCL_1_2_APIS
490 #if CL_HPP_MINIMUM_OPENCL_VERSION <= 200 && !defined(CL_USE_DEPRECATED_OPENCL_2_0_APIS)
491 # define CL_USE_DEPRECATED_OPENCL_2_0_APIS
493 #if CL_HPP_MINIMUM_OPENCL_VERSION <= 210 && !defined(CL_USE_DEPRECATED_OPENCL_2_1_APIS)
494 # define CL_USE_DEPRECATED_OPENCL_2_1_APIS
496 #if CL_HPP_MINIMUM_OPENCL_VERSION <= 220 && !defined(CL_USE_DEPRECATED_OPENCL_2_2_APIS)
497 # define CL_USE_DEPRECATED_OPENCL_2_2_APIS
504 #if defined(CL_HPP_USE_DX_INTEROP)
505 #include <CL/cl_d3d10.h>
506 #include <CL/cl_dx9_media_sharing.h>
510 #if defined(_MSC_VER)
518 #if (!defined(_MSC_VER) && __cplusplus < 201103L) || (defined(_MSC_VER) && _MSC_VER < 1700)
519 #error Visual studio 2013 or another C++11-supporting compiler required
523 #if defined(CL_HPP_USE_CL_DEVICE_FISSION) || defined(CL_HPP_USE_CL_SUB_GROUPS_KHR)
524 #include <CL/cl_ext.h>
527 #if defined(__APPLE__) || defined(__MACOSX)
528 #include <OpenCL/opencl.h>
530 #include <CL/opencl.h>
533 #if (__cplusplus >= 201103L || _MSVC_LANG >= 201103L )
534 #define CL_HPP_NOEXCEPT_ noexcept
536 #define CL_HPP_NOEXCEPT_
539 #if __cplusplus >= 201703L
540 # define CL_HPP_DEFINE_STATIC_MEMBER_ inline
541 #elif defined(_MSC_VER)
542 # define CL_HPP_DEFINE_STATIC_MEMBER_ __declspec(selectany)
543 #elif defined(__MINGW32__)
544 # define CL_HPP_DEFINE_STATIC_MEMBER_ __attribute__((selectany))
546 # define CL_HPP_DEFINE_STATIC_MEMBER_ __attribute__((weak))
551 #if !defined(CL_EXT_PREFIX__VERSION_1_1_DEPRECATED)
552 #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
553 #endif // #if !defined(CL_EXT_PREFIX__VERSION_1_1_DEPRECATED)
554 #if !defined(CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED)
555 #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
556 #endif // #if !defined(CL_EXT_PREFIX__VERSION_1_1_DEPRECATED)
558 #if !defined(CL_EXT_PREFIX__VERSION_1_2_DEPRECATED)
559 #define CL_EXT_PREFIX__VERSION_1_2_DEPRECATED
560 #endif // #if !defined(CL_EXT_PREFIX__VERSION_1_2_DEPRECATED)
561 #if !defined(CL_EXT_SUFFIX__VERSION_1_2_DEPRECATED)
562 #define CL_EXT_SUFFIX__VERSION_1_2_DEPRECATED
563 #endif // #if !defined(CL_EXT_PREFIX__VERSION_1_2_DEPRECATED)
565 #if !defined(CL_CALLBACK)
574 #include <functional>
578 #if defined(CL_HPP_ENABLE_SIZE_T_COMPATIBILITY)
580 using size_type = ::size_t;
582 #else // #if defined(CL_HPP_ENABLE_SIZE_T_COMPATIBILITY)
584 using size_type = size_t;
586 #endif // #if defined(CL_HPP_ENABLE_SIZE_T_COMPATIBILITY)
589 #if defined(CL_HPP_ENABLE_EXCEPTIONS)
591 #endif // #if defined(CL_HPP_ENABLE_EXCEPTIONS)
593 #if !defined(CL_HPP_NO_STD_VECTOR)
596 template <
class T,
class Alloc = std::allocator<T> >
597 using vector = std::vector<T, Alloc>;
599 #endif // #if !defined(CL_HPP_NO_STD_VECTOR)
601 #if !defined(CL_HPP_NO_STD_STRING)
604 using string = std::string;
606 #endif // #if !defined(CL_HPP_NO_STD_STRING)
608 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
610 #if !defined(CL_HPP_NO_STD_UNIQUE_PTR)
615 template<
class T,
class D>
616 using pointer = std::unique_ptr<T, D>;
619 #endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 200
620 #if !defined(CL_HPP_NO_STD_ARRAY)
623 template <
class T,
size_type N >
624 using array = std::array<T, N>;
626 #endif // #if !defined(CL_HPP_NO_STD_ARRAY)
630 #if defined(CL_HPP_ENABLE_SIZE_T_COMPATIBILITY)
632 namespace compatibility {
647 for (
int i = 0; i < N; ++i) {
652 size_t(
const array<size_type, N> &rhs)
654 for (
int i = 0; i < N; ++i) {
659 size_type& operator[](
int index)
664 const size_type& operator[](
int index)
const
670 operator size_type* () {
return data_; }
673 operator const size_type* ()
const {
return data_; }
675 operator array<size_type, N>()
const
677 array<size_type, N> ret;
679 for (
int i = 0; i < N; ++i) {
688 using size_t = compatibility::size_t<N>;
690 #endif // #if defined(CL_HPP_ENABLE_SIZE_T_COMPATIBILITY)
695 using size_t_array = array<size_type, 3>;
708 #define CL_HPP_INIT_CL_EXT_FCN_PTR_(name) \
710 pfn_##name = (PFN_##name) \
711 clGetExtensionFunctionAddress(#name); \
716 #define CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_(platform, name) \
718 pfn_##name = (PFN_##name) \
719 clGetExtensionFunctionAddressForPlatform(platform, #name); \
728 class DeviceCommandQueue;
733 #if defined(CL_HPP_ENABLE_EXCEPTIONS)
738 class Error :
public std::exception
742 const char * errStr_;
753 Error(cl_int err,
const char * errStr = NULL) : err_(err), errStr_(errStr)
762 virtual const char * what()
const throw ()
764 if (errStr_ == NULL) {
776 cl_int err(
void)
const {
return err_; }
778 #define CL_HPP_ERR_STR_(x) #x
780 #define CL_HPP_ERR_STR_(x) NULL
781 #endif // CL_HPP_ENABLE_EXCEPTIONS
786 #if defined(CL_HPP_ENABLE_EXCEPTIONS)
787 static inline cl_int errHandler (
789 const char * errStr = NULL)
791 if (err != CL_SUCCESS) {
792 throw Error(err, errStr);
797 static inline cl_int errHandler (cl_int err,
const char * errStr = NULL)
802 #endif // CL_HPP_ENABLE_EXCEPTIONS
808 #if !defined(CL_HPP_USER_OVERRIDE_ERROR_STRINGS)
809 #define __GET_DEVICE_INFO_ERR CL_HPP_ERR_STR_(clGetDeviceInfo)
810 #define __GET_PLATFORM_INFO_ERR CL_HPP_ERR_STR_(clGetPlatformInfo)
811 #define __GET_DEVICE_IDS_ERR CL_HPP_ERR_STR_(clGetDeviceIDs)
812 #define __GET_PLATFORM_IDS_ERR CL_HPP_ERR_STR_(clGetPlatformIDs)
813 #define __GET_CONTEXT_INFO_ERR CL_HPP_ERR_STR_(clGetContextInfo)
814 #define __GET_EVENT_INFO_ERR CL_HPP_ERR_STR_(clGetEventInfo)
815 #define __GET_EVENT_PROFILE_INFO_ERR CL_HPP_ERR_STR_(clGetEventProfileInfo)
816 #define __GET_MEM_OBJECT_INFO_ERR CL_HPP_ERR_STR_(clGetMemObjectInfo)
817 #define __GET_IMAGE_INFO_ERR CL_HPP_ERR_STR_(clGetImageInfo)
818 #define __GET_SAMPLER_INFO_ERR CL_HPP_ERR_STR_(clGetSamplerInfo)
819 #define __GET_KERNEL_INFO_ERR CL_HPP_ERR_STR_(clGetKernelInfo)
820 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
821 #define __GET_KERNEL_ARG_INFO_ERR CL_HPP_ERR_STR_(clGetKernelArgInfo)
822 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
823 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
824 #define __GET_KERNEL_SUB_GROUP_INFO_ERR CL_HPP_ERR_STR_(clGetKernelSubGroupInfo)
825 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 200
826 #define __GET_KERNEL_WORK_GROUP_INFO_ERR CL_HPP_ERR_STR_(clGetKernelWorkGroupInfo)
827 #define __GET_PROGRAM_INFO_ERR CL_HPP_ERR_STR_(clGetProgramInfo)
828 #define __GET_PROGRAM_BUILD_INFO_ERR CL_HPP_ERR_STR_(clGetProgramBuildInfo)
829 #define __GET_COMMAND_QUEUE_INFO_ERR CL_HPP_ERR_STR_(clGetCommandQueueInfo)
831 #define __CREATE_CONTEXT_ERR CL_HPP_ERR_STR_(clCreateContext)
832 #define __CREATE_CONTEXT_FROM_TYPE_ERR CL_HPP_ERR_STR_(clCreateContextFromType)
833 #define __GET_SUPPORTED_IMAGE_FORMATS_ERR CL_HPP_ERR_STR_(clGetSupportedImageFormats)
835 #define __CREATE_BUFFER_ERR CL_HPP_ERR_STR_(clCreateBuffer)
836 #define __COPY_ERR CL_HPP_ERR_STR_(cl::copy)
837 #define __CREATE_SUBBUFFER_ERR CL_HPP_ERR_STR_(clCreateSubBuffer)
838 #define __CREATE_GL_BUFFER_ERR CL_HPP_ERR_STR_(clCreateFromGLBuffer)
839 #define __CREATE_GL_RENDER_BUFFER_ERR CL_HPP_ERR_STR_(clCreateFromGLBuffer)
840 #define __GET_GL_OBJECT_INFO_ERR CL_HPP_ERR_STR_(clGetGLObjectInfo)
841 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
842 #define __CREATE_IMAGE_ERR CL_HPP_ERR_STR_(clCreateImage)
843 #define __CREATE_GL_TEXTURE_ERR CL_HPP_ERR_STR_(clCreateFromGLTexture)
844 #define __IMAGE_DIMENSION_ERR CL_HPP_ERR_STR_(Incorrect image dimensions)
845 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
846 #define __SET_MEM_OBJECT_DESTRUCTOR_CALLBACK_ERR CL_HPP_ERR_STR_(clSetMemObjectDestructorCallback)
848 #define __CREATE_USER_EVENT_ERR CL_HPP_ERR_STR_(clCreateUserEvent)
849 #define __SET_USER_EVENT_STATUS_ERR CL_HPP_ERR_STR_(clSetUserEventStatus)
850 #define __SET_EVENT_CALLBACK_ERR CL_HPP_ERR_STR_(clSetEventCallback)
851 #define __WAIT_FOR_EVENTS_ERR CL_HPP_ERR_STR_(clWaitForEvents)
853 #define __CREATE_KERNEL_ERR CL_HPP_ERR_STR_(clCreateKernel)
854 #define __SET_KERNEL_ARGS_ERR CL_HPP_ERR_STR_(clSetKernelArg)
855 #define __CREATE_PROGRAM_WITH_SOURCE_ERR CL_HPP_ERR_STR_(clCreateProgramWithSource)
856 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
857 #define __CREATE_PROGRAM_WITH_IL_ERR CL_HPP_ERR_STR_(clCreateProgramWithIL)
858 #endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 200
859 #define __CREATE_PROGRAM_WITH_BINARY_ERR CL_HPP_ERR_STR_(clCreateProgramWithBinary)
860 #if CL_HPP_TARGET_OPENCL_VERSION >= 210
861 #define __CREATE_PROGRAM_WITH_IL_ERR CL_HPP_ERR_STR_(clCreateProgramWithIL)
862 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 210
863 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
864 #define __CREATE_PROGRAM_WITH_BUILT_IN_KERNELS_ERR CL_HPP_ERR_STR_(clCreateProgramWithBuiltInKernels)
865 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
866 #define __BUILD_PROGRAM_ERR CL_HPP_ERR_STR_(clBuildProgram)
867 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
868 #define __COMPILE_PROGRAM_ERR CL_HPP_ERR_STR_(clCompileProgram)
869 #define __LINK_PROGRAM_ERR CL_HPP_ERR_STR_(clLinkProgram)
870 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
871 #define __CREATE_KERNELS_IN_PROGRAM_ERR CL_HPP_ERR_STR_(clCreateKernelsInProgram)
873 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
874 #define __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR CL_HPP_ERR_STR_(clCreateCommandQueueWithProperties)
875 #define __CREATE_SAMPLER_WITH_PROPERTIES_ERR CL_HPP_ERR_STR_(clCreateSamplerWithProperties)
876 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 200
877 #define __SET_COMMAND_QUEUE_PROPERTY_ERR CL_HPP_ERR_STR_(clSetCommandQueueProperty)
878 #define __ENQUEUE_READ_BUFFER_ERR CL_HPP_ERR_STR_(clEnqueueReadBuffer)
879 #define __ENQUEUE_READ_BUFFER_RECT_ERR CL_HPP_ERR_STR_(clEnqueueReadBufferRect)
880 #define __ENQUEUE_WRITE_BUFFER_ERR CL_HPP_ERR_STR_(clEnqueueWriteBuffer)
881 #define __ENQUEUE_WRITE_BUFFER_RECT_ERR CL_HPP_ERR_STR_(clEnqueueWriteBufferRect)
882 #define __ENQEUE_COPY_BUFFER_ERR CL_HPP_ERR_STR_(clEnqueueCopyBuffer)
883 #define __ENQEUE_COPY_BUFFER_RECT_ERR CL_HPP_ERR_STR_(clEnqueueCopyBufferRect)
884 #define __ENQUEUE_FILL_BUFFER_ERR CL_HPP_ERR_STR_(clEnqueueFillBuffer)
885 #define __ENQUEUE_READ_IMAGE_ERR CL_HPP_ERR_STR_(clEnqueueReadImage)
886 #define __ENQUEUE_WRITE_IMAGE_ERR CL_HPP_ERR_STR_(clEnqueueWriteImage)
887 #define __ENQUEUE_COPY_IMAGE_ERR CL_HPP_ERR_STR_(clEnqueueCopyImage)
888 #define __ENQUEUE_FILL_IMAGE_ERR CL_HPP_ERR_STR_(clEnqueueFillImage)
889 #define __ENQUEUE_COPY_IMAGE_TO_BUFFER_ERR CL_HPP_ERR_STR_(clEnqueueCopyImageToBuffer)
890 #define __ENQUEUE_COPY_BUFFER_TO_IMAGE_ERR CL_HPP_ERR_STR_(clEnqueueCopyBufferToImage)
891 #define __ENQUEUE_MAP_BUFFER_ERR CL_HPP_ERR_STR_(clEnqueueMapBuffer)
892 #define __ENQUEUE_MAP_IMAGE_ERR CL_HPP_ERR_STR_(clEnqueueMapImage)
893 #define __ENQUEUE_UNMAP_MEM_OBJECT_ERR CL_HPP_ERR_STR_(clEnqueueUnMapMemObject)
894 #define __ENQUEUE_NDRANGE_KERNEL_ERR CL_HPP_ERR_STR_(clEnqueueNDRangeKernel)
895 #define __ENQUEUE_NATIVE_KERNEL CL_HPP_ERR_STR_(clEnqueueNativeKernel)
896 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
897 #define __ENQUEUE_MIGRATE_MEM_OBJECTS_ERR CL_HPP_ERR_STR_(clEnqueueMigrateMemObjects)
898 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
899 #if CL_HPP_TARGET_OPENCL_VERSION >= 210
900 #define __ENQUEUE_MIGRATE_SVM_ERR CL_HPP_ERR_STR_(clEnqueueSVMMigrateMem)
901 #define __SET_DEFAULT_DEVICE_COMMAND_QUEUE_ERR CL_HPP_ERR_STR_(clSetDefaultDeviceCommandQueue)
902 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 210
905 #define __ENQUEUE_ACQUIRE_GL_ERR CL_HPP_ERR_STR_(clEnqueueAcquireGLObjects)
906 #define __ENQUEUE_RELEASE_GL_ERR CL_HPP_ERR_STR_(clEnqueueReleaseGLObjects)
908 #define __CREATE_PIPE_ERR CL_HPP_ERR_STR_(clCreatePipe)
909 #define __GET_PIPE_INFO_ERR CL_HPP_ERR_STR_(clGetPipeInfo)
912 #define __RETAIN_ERR CL_HPP_ERR_STR_(Retain Object)
913 #define __RELEASE_ERR CL_HPP_ERR_STR_(Release Object)
914 #define __FLUSH_ERR CL_HPP_ERR_STR_(clFlush)
915 #define __FINISH_ERR CL_HPP_ERR_STR_(clFinish)
916 #define __VECTOR_CAPACITY_ERR CL_HPP_ERR_STR_(Vector capacity error)
918 #if CL_HPP_TARGET_OPENCL_VERSION >= 210
919 #define __GET_HOST_TIMER_ERR CL_HPP_ERR_STR_(clGetHostTimer)
920 #define __GET_DEVICE_AND_HOST_TIMER_ERR CL_HPP_ERR_STR_(clGetDeviceAndHostTimer)
922 #if CL_HPP_TARGET_OPENCL_VERSION >= 220
923 #define __SET_PROGRAM_RELEASE_CALLBACK_ERR CL_HPP_ERR_STR_(clSetProgramReleaseCallback)
924 #define __SET_PROGRAM_SPECIALIZATION_CONSTANT_ERR CL_HPP_ERR_STR_(clSetProgramSpecializationConstant)
931 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
932 #define __CREATE_SUB_DEVICES_ERR CL_HPP_ERR_STR_(clCreateSubDevices)
934 #define __CREATE_SUB_DEVICES_ERR CL_HPP_ERR_STR_(clCreateSubDevicesEXT)
935 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
940 #if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
941 #define __ENQUEUE_MARKER_ERR CL_HPP_ERR_STR_(clEnqueueMarker)
942 #define __ENQUEUE_WAIT_FOR_EVENTS_ERR CL_HPP_ERR_STR_(clEnqueueWaitForEvents)
943 #define __ENQUEUE_BARRIER_ERR CL_HPP_ERR_STR_(clEnqueueBarrier)
944 #define __UNLOAD_COMPILER_ERR CL_HPP_ERR_STR_(clUnloadCompiler)
945 #define __CREATE_GL_TEXTURE_2D_ERR CL_HPP_ERR_STR_(clCreateFromGLTexture2D)
946 #define __CREATE_GL_TEXTURE_3D_ERR CL_HPP_ERR_STR_(clCreateFromGLTexture3D)
947 #define __CREATE_IMAGE2D_ERR CL_HPP_ERR_STR_(clCreateImage2D)
948 #define __CREATE_IMAGE3D_ERR CL_HPP_ERR_STR_(clCreateImage3D)
949 #endif // #if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
954 #if defined(CL_USE_DEPRECATED_OPENCL_1_2_APIS)
955 #define __CREATE_COMMAND_QUEUE_ERR CL_HPP_ERR_STR_(clCreateCommandQueue)
956 #define __ENQUEUE_TASK_ERR CL_HPP_ERR_STR_(clEnqueueTask)
957 #define __CREATE_SAMPLER_ERR CL_HPP_ERR_STR_(clCreateSampler)
958 #endif // #if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
963 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
964 #define __ENQUEUE_MARKER_WAIT_LIST_ERR CL_HPP_ERR_STR_(clEnqueueMarkerWithWaitList)
965 #define __ENQUEUE_BARRIER_WAIT_LIST_ERR CL_HPP_ERR_STR_(clEnqueueBarrierWithWaitList)
966 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
968 #if CL_HPP_TARGET_OPENCL_VERSION >= 210
969 #define __CLONE_KERNEL_ERR CL_HPP_ERR_STR_(clCloneKernel)
970 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 210
972 #endif // CL_HPP_USER_OVERRIDE_ERROR_STRINGS
982 template<
typename Functor,
typename T>
983 inline cl_int getInfoHelper(Functor f, cl_uint name, T* param,
long)
985 return f(name,
sizeof(T), param, NULL);
990 template <
typename Func>
991 inline cl_int getInfoHelper(Func f, cl_uint name, vector<vector<unsigned char>>* param,
int)
993 if (name != CL_PROGRAM_BINARIES) {
994 return CL_INVALID_VALUE;
998 size_type numBinaries = param->size();
999 vector<unsigned char*> binariesPointers(numBinaries);
1001 for (size_type i = 0; i < numBinaries; ++i)
1003 binariesPointers[i] = (*param)[i].data();
1006 cl_int err = f(name, numBinaries *
sizeof(
unsigned char*), binariesPointers.data(), NULL);
1008 if (err != CL_SUCCESS) {
1018 template <
typename Func,
typename T>
1019 inline cl_int getInfoHelper(Func f, cl_uint name, vector<T>* param,
long)
1022 cl_int err = f(name, 0, NULL, &required);
1023 if (err != CL_SUCCESS) {
1026 const size_type elements = required /
sizeof(T);
1029 vector<T> localData(elements);
1030 err = f(name, required, localData.data(), NULL);
1031 if (err != CL_SUCCESS) {
1035 *param = std::move(localData);
1047 template <
typename Func,
typename T>
1048 inline cl_int getInfoHelper(
1049 Func f, cl_uint name, vector<T>* param,
int,
typename T::cl_type = 0)
1052 cl_int err = f(name, 0, NULL, &required);
1053 if (err != CL_SUCCESS) {
1057 const size_type elements = required /
sizeof(
typename T::cl_type);
1059 vector<typename T::cl_type> value(elements);
1060 err = f(name, required, value.data(), NULL);
1061 if (err != CL_SUCCESS) {
1067 param->resize(elements);
1071 for (size_type i = 0; i < elements; i++) {
1072 (*param)[i] = T(value[i],
true);
1079 template <
typename Func>
1080 inline cl_int getInfoHelper(Func f, cl_uint name,
string* param,
long)
1083 cl_int err = f(name, 0, NULL, &required);
1084 if (err != CL_SUCCESS) {
1091 vector<char> value(required);
1092 err = f(name, required, value.data(), NULL);
1093 if (err != CL_SUCCESS) {
1097 param->assign(begin(value), prev(end(value)));
1107 template <
typename Func,
size_type N>
1108 inline cl_int getInfoHelper(Func f, cl_uint name, array<size_type, N>* param,
long)
1111 cl_int err = f(name, 0, NULL, &required);
1112 if (err != CL_SUCCESS) {
1116 size_type elements = required /
sizeof(size_type);
1117 vector<size_type> value(elements, 0);
1119 err = f(name, required, value.data(), NULL);
1120 if (err != CL_SUCCESS) {
1129 for (size_type i = 0; i < elements; ++i) {
1130 (*param)[i] = value[i];
1136 template<
typename T>
struct ReferenceHandler;
1144 template<
typename Func,
typename T>
1145 inline cl_int getInfoHelper(Func f, cl_uint name, T* param,
int,
typename T::cl_type = 0)
1147 typename T::cl_type value;
1148 cl_int err = f(name,
sizeof(value), &value, NULL);
1149 if (err != CL_SUCCESS) {
1155 err = param->retain();
1156 if (err != CL_SUCCESS) {
1163 #define CL_HPP_PARAM_NAME_INFO_1_0_(F) \
1164 F(cl_platform_info, CL_PLATFORM_PROFILE, string) \
1165 F(cl_platform_info, CL_PLATFORM_VERSION, string) \
1166 F(cl_platform_info, CL_PLATFORM_NAME, string) \
1167 F(cl_platform_info, CL_PLATFORM_VENDOR, string) \
1168 F(cl_platform_info, CL_PLATFORM_EXTENSIONS, string) \
1170 F(cl_device_info, CL_DEVICE_TYPE, cl_device_type) \
1171 F(cl_device_info, CL_DEVICE_VENDOR_ID, cl_uint) \
1172 F(cl_device_info, CL_DEVICE_MAX_COMPUTE_UNITS, cl_uint) \
1173 F(cl_device_info, CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS, cl_uint) \
1174 F(cl_device_info, CL_DEVICE_MAX_WORK_GROUP_SIZE, size_type) \
1175 F(cl_device_info, CL_DEVICE_MAX_WORK_ITEM_SIZES, cl::vector<size_type>) \
1176 F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR, cl_uint) \
1177 F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT, cl_uint) \
1178 F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT, cl_uint) \
1179 F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG, cl_uint) \
1180 F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT, cl_uint) \
1181 F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE, cl_uint) \
1182 F(cl_device_info, CL_DEVICE_MAX_CLOCK_FREQUENCY, cl_uint) \
1183 F(cl_device_info, CL_DEVICE_ADDRESS_BITS, cl_uint) \
1184 F(cl_device_info, CL_DEVICE_MAX_READ_IMAGE_ARGS, cl_uint) \
1185 F(cl_device_info, CL_DEVICE_MAX_WRITE_IMAGE_ARGS, cl_uint) \
1186 F(cl_device_info, CL_DEVICE_MAX_MEM_ALLOC_SIZE, cl_ulong) \
1187 F(cl_device_info, CL_DEVICE_IMAGE2D_MAX_WIDTH, size_type) \
1188 F(cl_device_info, CL_DEVICE_IMAGE2D_MAX_HEIGHT, size_type) \
1189 F(cl_device_info, CL_DEVICE_IMAGE3D_MAX_WIDTH, size_type) \
1190 F(cl_device_info, CL_DEVICE_IMAGE3D_MAX_HEIGHT, size_type) \
1191 F(cl_device_info, CL_DEVICE_IMAGE3D_MAX_DEPTH, size_type) \
1192 F(cl_device_info, CL_DEVICE_IMAGE_SUPPORT, cl_bool) \
1193 F(cl_device_info, CL_DEVICE_MAX_PARAMETER_SIZE, size_type) \
1194 F(cl_device_info, CL_DEVICE_MAX_SAMPLERS, cl_uint) \
1195 F(cl_device_info, CL_DEVICE_MEM_BASE_ADDR_ALIGN, cl_uint) \
1196 F(cl_device_info, CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE, cl_uint) \
1197 F(cl_device_info, CL_DEVICE_SINGLE_FP_CONFIG, cl_device_fp_config) \
1198 F(cl_device_info, CL_DEVICE_DOUBLE_FP_CONFIG, cl_device_fp_config) \
1199 F(cl_device_info, CL_DEVICE_HALF_FP_CONFIG, cl_device_fp_config) \
1200 F(cl_device_info, CL_DEVICE_GLOBAL_MEM_CACHE_TYPE, cl_device_mem_cache_type) \
1201 F(cl_device_info, CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE, cl_uint)\
1202 F(cl_device_info, CL_DEVICE_GLOBAL_MEM_CACHE_SIZE, cl_ulong) \
1203 F(cl_device_info, CL_DEVICE_GLOBAL_MEM_SIZE, cl_ulong) \
1204 F(cl_device_info, CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE, cl_ulong) \
1205 F(cl_device_info, CL_DEVICE_MAX_CONSTANT_ARGS, cl_uint) \
1206 F(cl_device_info, CL_DEVICE_LOCAL_MEM_TYPE, cl_device_local_mem_type) \
1207 F(cl_device_info, CL_DEVICE_LOCAL_MEM_SIZE, cl_ulong) \
1208 F(cl_device_info, CL_DEVICE_ERROR_CORRECTION_SUPPORT, cl_bool) \
1209 F(cl_device_info, CL_DEVICE_PROFILING_TIMER_RESOLUTION, size_type) \
1210 F(cl_device_info, CL_DEVICE_ENDIAN_LITTLE, cl_bool) \
1211 F(cl_device_info, CL_DEVICE_AVAILABLE, cl_bool) \
1212 F(cl_device_info, CL_DEVICE_COMPILER_AVAILABLE, cl_bool) \
1213 F(cl_device_info, CL_DEVICE_EXECUTION_CAPABILITIES, cl_device_exec_capabilities) \
1214 F(cl_device_info, CL_DEVICE_PLATFORM, cl_platform_id) \
1215 F(cl_device_info, CL_DEVICE_NAME, string) \
1216 F(cl_device_info, CL_DEVICE_VENDOR, string) \
1217 F(cl_device_info, CL_DRIVER_VERSION, string) \
1218 F(cl_device_info, CL_DEVICE_PROFILE, string) \
1219 F(cl_device_info, CL_DEVICE_VERSION, string) \
1220 F(cl_device_info, CL_DEVICE_EXTENSIONS, string) \
1222 F(cl_context_info, CL_CONTEXT_REFERENCE_COUNT, cl_uint) \
1223 F(cl_context_info, CL_CONTEXT_DEVICES, cl::vector<Device>) \
1224 F(cl_context_info, CL_CONTEXT_PROPERTIES, cl::vector<cl_context_properties>) \
1226 F(cl_event_info, CL_EVENT_COMMAND_QUEUE, cl::CommandQueue) \
1227 F(cl_event_info, CL_EVENT_COMMAND_TYPE, cl_command_type) \
1228 F(cl_event_info, CL_EVENT_REFERENCE_COUNT, cl_uint) \
1229 F(cl_event_info, CL_EVENT_COMMAND_EXECUTION_STATUS, cl_int) \
1231 F(cl_profiling_info, CL_PROFILING_COMMAND_QUEUED, cl_ulong) \
1232 F(cl_profiling_info, CL_PROFILING_COMMAND_SUBMIT, cl_ulong) \
1233 F(cl_profiling_info, CL_PROFILING_COMMAND_START, cl_ulong) \
1234 F(cl_profiling_info, CL_PROFILING_COMMAND_END, cl_ulong) \
1236 F(cl_mem_info, CL_MEM_TYPE, cl_mem_object_type) \
1237 F(cl_mem_info, CL_MEM_FLAGS, cl_mem_flags) \
1238 F(cl_mem_info, CL_MEM_SIZE, size_type) \
1239 F(cl_mem_info, CL_MEM_HOST_PTR, void*) \
1240 F(cl_mem_info, CL_MEM_MAP_COUNT, cl_uint) \
1241 F(cl_mem_info, CL_MEM_REFERENCE_COUNT, cl_uint) \
1242 F(cl_mem_info, CL_MEM_CONTEXT, cl::Context) \
1244 F(cl_image_info, CL_IMAGE_FORMAT, cl_image_format) \
1245 F(cl_image_info, CL_IMAGE_ELEMENT_SIZE, size_type) \
1246 F(cl_image_info, CL_IMAGE_ROW_PITCH, size_type) \
1247 F(cl_image_info, CL_IMAGE_SLICE_PITCH, size_type) \
1248 F(cl_image_info, CL_IMAGE_WIDTH, size_type) \
1249 F(cl_image_info, CL_IMAGE_HEIGHT, size_type) \
1250 F(cl_image_info, CL_IMAGE_DEPTH, size_type) \
1252 F(cl_sampler_info, CL_SAMPLER_REFERENCE_COUNT, cl_uint) \
1253 F(cl_sampler_info, CL_SAMPLER_CONTEXT, cl::Context) \
1254 F(cl_sampler_info, CL_SAMPLER_NORMALIZED_COORDS, cl_bool) \
1255 F(cl_sampler_info, CL_SAMPLER_ADDRESSING_MODE, cl_addressing_mode) \
1256 F(cl_sampler_info, CL_SAMPLER_FILTER_MODE, cl_filter_mode) \
1258 F(cl_program_info, CL_PROGRAM_REFERENCE_COUNT, cl_uint) \
1259 F(cl_program_info, CL_PROGRAM_CONTEXT, cl::Context) \
1260 F(cl_program_info, CL_PROGRAM_NUM_DEVICES, cl_uint) \
1261 F(cl_program_info, CL_PROGRAM_DEVICES, cl::vector<Device>) \
1262 F(cl_program_info, CL_PROGRAM_SOURCE, string) \
1263 F(cl_program_info, CL_PROGRAM_BINARY_SIZES, cl::vector<size_type>) \
1264 F(cl_program_info, CL_PROGRAM_BINARIES, cl::vector<cl::vector<unsigned char>>) \
1266 F(cl_program_build_info, CL_PROGRAM_BUILD_STATUS, cl_build_status) \
1267 F(cl_program_build_info, CL_PROGRAM_BUILD_OPTIONS, string) \
1268 F(cl_program_build_info, CL_PROGRAM_BUILD_LOG, string) \
1270 F(cl_kernel_info, CL_KERNEL_FUNCTION_NAME, string) \
1271 F(cl_kernel_info, CL_KERNEL_NUM_ARGS, cl_uint) \
1272 F(cl_kernel_info, CL_KERNEL_REFERENCE_COUNT, cl_uint) \
1273 F(cl_kernel_info, CL_KERNEL_CONTEXT, cl::Context) \
1274 F(cl_kernel_info, CL_KERNEL_PROGRAM, cl::Program) \
1276 F(cl_kernel_work_group_info, CL_KERNEL_WORK_GROUP_SIZE, size_type) \
1277 F(cl_kernel_work_group_info, CL_KERNEL_COMPILE_WORK_GROUP_SIZE, cl::detail::size_t_array) \
1278 F(cl_kernel_work_group_info, CL_KERNEL_LOCAL_MEM_SIZE, cl_ulong) \
1280 F(cl_command_queue_info, CL_QUEUE_CONTEXT, cl::Context) \
1281 F(cl_command_queue_info, CL_QUEUE_DEVICE, cl::Device) \
1282 F(cl_command_queue_info, CL_QUEUE_REFERENCE_COUNT, cl_uint) \
1283 F(cl_command_queue_info, CL_QUEUE_PROPERTIES, cl_command_queue_properties)
1286 #define CL_HPP_PARAM_NAME_INFO_1_1_(F) \
1287 F(cl_context_info, CL_CONTEXT_NUM_DEVICES, cl_uint)\
1288 F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF, cl_uint) \
1289 F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR, cl_uint) \
1290 F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT, cl_uint) \
1291 F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_INT, cl_uint) \
1292 F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG, cl_uint) \
1293 F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT, cl_uint) \
1294 F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE, cl_uint) \
1295 F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF, cl_uint) \
1296 F(cl_device_info, CL_DEVICE_OPENCL_C_VERSION, string) \
1298 F(cl_mem_info, CL_MEM_ASSOCIATED_MEMOBJECT, cl::Memory) \
1299 F(cl_mem_info, CL_MEM_OFFSET, size_type) \
1301 F(cl_kernel_work_group_info, CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE, size_type) \
1302 F(cl_kernel_work_group_info, CL_KERNEL_PRIVATE_MEM_SIZE, cl_ulong) \
1304 F(cl_event_info, CL_EVENT_CONTEXT, cl::Context)
1306 #define CL_HPP_PARAM_NAME_INFO_1_2_(F) \
1307 F(cl_program_info, CL_PROGRAM_NUM_KERNELS, size_type) \
1308 F(cl_program_info, CL_PROGRAM_KERNEL_NAMES, string) \
1310 F(cl_program_build_info, CL_PROGRAM_BINARY_TYPE, cl_program_binary_type) \
1312 F(cl_kernel_info, CL_KERNEL_ATTRIBUTES, string) \
1314 F(cl_kernel_arg_info, CL_KERNEL_ARG_ADDRESS_QUALIFIER, cl_kernel_arg_address_qualifier) \
1315 F(cl_kernel_arg_info, CL_KERNEL_ARG_ACCESS_QUALIFIER, cl_kernel_arg_access_qualifier) \
1316 F(cl_kernel_arg_info, CL_KERNEL_ARG_TYPE_NAME, string) \
1317 F(cl_kernel_arg_info, CL_KERNEL_ARG_NAME, string) \
1318 F(cl_kernel_arg_info, CL_KERNEL_ARG_TYPE_QUALIFIER, cl_kernel_arg_type_qualifier) \
1320 F(cl_device_info, CL_DEVICE_PARENT_DEVICE, cl::Device) \
1321 F(cl_device_info, CL_DEVICE_PARTITION_MAX_SUB_DEVICES, cl_uint) \
1322 F(cl_device_info, CL_DEVICE_PARTITION_PROPERTIES, cl::vector<cl_device_partition_property>) \
1323 F(cl_device_info, CL_DEVICE_PARTITION_TYPE, cl::vector<cl_device_partition_property>) \
1324 F(cl_device_info, CL_DEVICE_REFERENCE_COUNT, cl_uint) \
1325 F(cl_device_info, CL_DEVICE_PREFERRED_INTEROP_USER_SYNC, size_type) \
1326 F(cl_device_info, CL_DEVICE_PARTITION_AFFINITY_DOMAIN, cl_device_affinity_domain) \
1327 F(cl_device_info, CL_DEVICE_BUILT_IN_KERNELS, string) \
1329 F(cl_image_info, CL_IMAGE_ARRAY_SIZE, size_type) \
1330 F(cl_image_info, CL_IMAGE_NUM_MIP_LEVELS, cl_uint) \
1331 F(cl_image_info, CL_IMAGE_NUM_SAMPLES, cl_uint)
1333 #define CL_HPP_PARAM_NAME_INFO_2_0_(F) \
1334 F(cl_device_info, CL_DEVICE_QUEUE_ON_HOST_PROPERTIES, cl_command_queue_properties) \
1335 F(cl_device_info, CL_DEVICE_QUEUE_ON_DEVICE_PROPERTIES, cl_command_queue_properties) \
1336 F(cl_device_info, CL_DEVICE_QUEUE_ON_DEVICE_PREFERRED_SIZE, cl_uint) \
1337 F(cl_device_info, CL_DEVICE_QUEUE_ON_DEVICE_MAX_SIZE, cl_uint) \
1338 F(cl_device_info, CL_DEVICE_MAX_ON_DEVICE_QUEUES, cl_uint) \
1339 F(cl_device_info, CL_DEVICE_MAX_ON_DEVICE_EVENTS, cl_uint) \
1340 F(cl_device_info, CL_DEVICE_MAX_PIPE_ARGS, cl_uint) \
1341 F(cl_device_info, CL_DEVICE_PIPE_MAX_ACTIVE_RESERVATIONS, cl_uint) \
1342 F(cl_device_info, CL_DEVICE_PIPE_MAX_PACKET_SIZE, cl_uint) \
1343 F(cl_device_info, CL_DEVICE_SVM_CAPABILITIES, cl_device_svm_capabilities) \
1344 F(cl_device_info, CL_DEVICE_PREFERRED_PLATFORM_ATOMIC_ALIGNMENT, cl_uint) \
1345 F(cl_device_info, CL_DEVICE_PREFERRED_GLOBAL_ATOMIC_ALIGNMENT, cl_uint) \
1346 F(cl_device_info, CL_DEVICE_PREFERRED_LOCAL_ATOMIC_ALIGNMENT, cl_uint) \
1347 F(cl_profiling_info, CL_PROFILING_COMMAND_COMPLETE, cl_ulong) \
1348 F(cl_kernel_exec_info, CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM, cl_bool) \
1349 F(cl_kernel_exec_info, CL_KERNEL_EXEC_INFO_SVM_PTRS, void**) \
1350 F(cl_command_queue_info, CL_QUEUE_SIZE, cl_uint) \
1351 F(cl_mem_info, CL_MEM_USES_SVM_POINTER, cl_bool) \
1352 F(cl_program_build_info, CL_PROGRAM_BUILD_GLOBAL_VARIABLE_TOTAL_SIZE, size_type) \
1353 F(cl_pipe_info, CL_PIPE_PACKET_SIZE, cl_uint) \
1354 F(cl_pipe_info, CL_PIPE_MAX_PACKETS, cl_uint)
1356 #define CL_HPP_PARAM_NAME_INFO_SUBGROUP_KHR_(F) \
1357 F(cl_kernel_sub_group_info, CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE_KHR, size_type) \
1358 F(cl_kernel_sub_group_info, CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE_KHR, size_type)
1360 #define CL_HPP_PARAM_NAME_INFO_IL_KHR_(F) \
1361 F(cl_device_info, CL_DEVICE_IL_VERSION_KHR, string) \
1362 F(cl_program_info, CL_PROGRAM_IL_KHR, cl::vector<unsigned char>)
1364 #define CL_HPP_PARAM_NAME_INFO_2_1_(F) \
1365 F(cl_platform_info, CL_PLATFORM_HOST_TIMER_RESOLUTION, size_type) \
1366 F(cl_program_info, CL_PROGRAM_IL, cl::vector<unsigned char>) \
1367 F(cl_kernel_info, CL_KERNEL_MAX_NUM_SUB_GROUPS, size_type) \
1368 F(cl_kernel_info, CL_KERNEL_COMPILE_NUM_SUB_GROUPS, size_type) \
1369 F(cl_device_info, CL_DEVICE_MAX_NUM_SUB_GROUPS, cl_uint) \
1370 F(cl_device_info, CL_DEVICE_IL_VERSION, string) \
1371 F(cl_device_info, CL_DEVICE_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS, cl_bool) \
1372 F(cl_command_queue_info, CL_QUEUE_DEVICE_DEFAULT, cl::DeviceCommandQueue) \
1373 F(cl_kernel_sub_group_info, CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE, size_type) \
1374 F(cl_kernel_sub_group_info, CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE, size_type) \
1375 F(cl_kernel_sub_group_info, CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT, cl::detail::size_t_array)
1377 #define CL_HPP_PARAM_NAME_INFO_2_2_(F) \
1378 F(cl_program_info, CL_PROGRAM_SCOPE_GLOBAL_CTORS_PRESENT, cl_bool) \
1379 F(cl_program_info, CL_PROGRAM_SCOPE_GLOBAL_DTORS_PRESENT, cl_bool)
1381 #define CL_HPP_PARAM_NAME_DEVICE_FISSION_(F) \
1382 F(cl_device_info, CL_DEVICE_PARENT_DEVICE_EXT, cl_device_id) \
1383 F(cl_device_info, CL_DEVICE_PARTITION_TYPES_EXT, cl::vector<cl_device_partition_property_ext>) \
1384 F(cl_device_info, CL_DEVICE_AFFINITY_DOMAINS_EXT, cl::vector<cl_device_partition_property_ext>) \
1385 F(cl_device_info, CL_DEVICE_REFERENCE_COUNT_EXT , cl_uint) \
1386 F(cl_device_info, CL_DEVICE_PARTITION_STYLE_EXT, cl::vector<cl_device_partition_property_ext>)
1388 #define CL_HPP_PARAM_NAME_CL_KHR_EXTENDED_VERSIONING_CL3_SHARED_(F) \
1389 F(cl_platform_info, CL_PLATFORM_NUMERIC_VERSION_KHR, cl_version_khr) \
1390 F(cl_platform_info, CL_PLATFORM_EXTENSIONS_WITH_VERSION_KHR, cl::vector<cl_name_version_khr>) \
1392 F(cl_device_info, CL_DEVICE_NUMERIC_VERSION_KHR, cl_version_khr) \
1393 F(cl_device_info, CL_DEVICE_EXTENSIONS_WITH_VERSION_KHR, cl::vector<cl_name_version_khr>) \
1394 F(cl_device_info, CL_DEVICE_ILS_WITH_VERSION_KHR, cl::vector<cl_name_version_khr>) \
1395 F(cl_device_info, CL_DEVICE_BUILT_IN_KERNELS_WITH_VERSION_KHR, cl::vector<cl_name_version_khr>)
1397 #define CL_HPP_PARAM_NAME_CL_KHR_EXTENDED_VERSIONING_KHRONLY_(F) \
1398 F(cl_device_info, CL_DEVICE_OPENCL_C_NUMERIC_VERSION_KHR, cl_version_khr)
1400 #define CL_HPP_PARAM_NAME_INFO_3_0_(F) \
1401 F(cl_platform_info, CL_PLATFORM_NUMERIC_VERSION, cl_version) \
1402 F(cl_platform_info, CL_PLATFORM_EXTENSIONS_WITH_VERSION, cl::vector<cl_name_version>) \
1404 F(cl_device_info, CL_DEVICE_NUMERIC_VERSION, cl_version) \
1405 F(cl_device_info, CL_DEVICE_EXTENSIONS_WITH_VERSION, cl::vector<cl_name_version>) \
1406 F(cl_device_info, CL_DEVICE_ILS_WITH_VERSION, cl::vector<cl_name_version>) \
1407 F(cl_device_info, CL_DEVICE_BUILT_IN_KERNELS_WITH_VERSION, cl::vector<cl_name_version>) \
1408 F(cl_device_info, CL_DEVICE_ATOMIC_MEMORY_CAPABILITIES, cl_device_atomic_capabilities) \
1409 F(cl_device_info, CL_DEVICE_ATOMIC_FENCE_CAPABILITIES, cl_device_atomic_capabilities) \
1410 F(cl_device_info, CL_DEVICE_NON_UNIFORM_WORK_GROUP_SUPPORT, cl_bool) \
1411 F(cl_device_info, CL_DEVICE_OPENCL_C_ALL_VERSIONS, cl::vector<cl_name_version>) \
1412 F(cl_device_info, CL_DEVICE_PREFERRED_WORK_GROUP_SIZE_MULTIPLE, size_type) \
1413 F(cl_device_info, CL_DEVICE_WORK_GROUP_COLLECTIVE_FUNCTIONS_SUPPORT, cl_bool) \
1414 F(cl_device_info, CL_DEVICE_GENERIC_ADDRESS_SPACE_SUPPORT, cl_bool) \
1415 F(cl_device_info, CL_DEVICE_OPENCL_C_FEATURES, cl::vector<cl_name_version>) \
1416 F(cl_device_info, CL_DEVICE_DEVICE_ENQUEUE_CAPABILITIES, cl_device_device_enqueue_capabilities) \
1417 F(cl_device_info, CL_DEVICE_PIPE_SUPPORT, cl_bool) \
1418 F(cl_device_info, CL_DEVICE_LATEST_CONFORMANCE_VERSION_PASSED, string) \
1420 F(cl_command_queue_info, CL_QUEUE_PROPERTIES_ARRAY, cl::vector<cl_queue_properties>) \
1421 F(cl_mem_info, CL_MEM_PROPERTIES, cl::vector<cl_mem_properties>) \
1422 F(cl_pipe_info, CL_PIPE_PROPERTIES, cl::vector<cl_pipe_properties>) \
1423 F(cl_sampler_info, CL_SAMPLER_PROPERTIES, cl::vector<cl_sampler_properties>)
1425 template <
typename enum_type, cl_
int Name>
1428 #define CL_HPP_DECLARE_PARAM_TRAITS_(token, param_name, T) \
1431 struct param_traits<detail:: token,param_name> \
1433 enum { value = param_name }; \
1434 typedef T param_type; \
1437 CL_HPP_PARAM_NAME_INFO_1_0_(CL_HPP_DECLARE_PARAM_TRAITS_)
1438 #if CL_HPP_TARGET_OPENCL_VERSION >= 110
1439 CL_HPP_PARAM_NAME_INFO_1_1_(CL_HPP_DECLARE_PARAM_TRAITS_)
1440 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 110
1441 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
1442 CL_HPP_PARAM_NAME_INFO_1_2_(CL_HPP_DECLARE_PARAM_TRAITS_)
1443 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
1444 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
1445 CL_HPP_PARAM_NAME_INFO_2_0_(CL_HPP_DECLARE_PARAM_TRAITS_)
1446 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 200
1447 #if CL_HPP_TARGET_OPENCL_VERSION >= 210
1448 CL_HPP_PARAM_NAME_INFO_2_1_(CL_HPP_DECLARE_PARAM_TRAITS_)
1449 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 210
1450 #if CL_HPP_TARGET_OPENCL_VERSION >= 220
1451 CL_HPP_PARAM_NAME_INFO_2_2_(CL_HPP_DECLARE_PARAM_TRAITS_)
1452 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 220
1453 #if CL_HPP_TARGET_OPENCL_VERSION >= 300
1454 CL_HPP_PARAM_NAME_INFO_3_0_(CL_HPP_DECLARE_PARAM_TRAITS_)
1455 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 300
1457 #if defined(CL_HPP_USE_CL_SUB_GROUPS_KHR) && CL_HPP_TARGET_OPENCL_VERSION < 210
1458 CL_HPP_PARAM_NAME_INFO_SUBGROUP_KHR_(CL_HPP_DECLARE_PARAM_TRAITS_)
1459 #endif // #if defined(CL_HPP_USE_CL_SUB_GROUPS_KHR) && CL_HPP_TARGET_OPENCL_VERSION < 210
1461 #if defined(CL_HPP_USE_IL_KHR)
1462 CL_HPP_PARAM_NAME_INFO_IL_KHR_(CL_HPP_DECLARE_PARAM_TRAITS_)
1463 #endif // #if defined(CL_HPP_USE_IL_KHR)
1467 #define CL_HPP_PARAM_NAME_INFO_1_0_DEPRECATED_IN_2_0_(F) \
1468 F(cl_device_info, CL_DEVICE_QUEUE_PROPERTIES, cl_command_queue_properties)
1470 #define CL_HPP_PARAM_NAME_INFO_1_1_DEPRECATED_IN_2_0_(F) \
1471 F(cl_device_info, CL_DEVICE_HOST_UNIFIED_MEMORY, cl_bool)
1473 #define CL_HPP_PARAM_NAME_INFO_1_2_DEPRECATED_IN_2_0_(F) \
1474 F(cl_image_info, CL_IMAGE_BUFFER, cl::Buffer)
1478 #if CL_HPP_TARGET_OPENCL_VERSION > 100 && CL_HPP_MINIMUM_OPENCL_VERSION < 200 && CL_HPP_TARGET_OPENCL_VERSION < 200
1479 CL_HPP_PARAM_NAME_INFO_1_0_DEPRECATED_IN_2_0_(CL_HPP_DECLARE_PARAM_TRAITS_)
1480 #endif // CL_HPP_MINIMUM_OPENCL_VERSION < 110
1481 #if CL_HPP_TARGET_OPENCL_VERSION > 110 && CL_HPP_MINIMUM_OPENCL_VERSION < 200
1482 CL_HPP_PARAM_NAME_INFO_1_1_DEPRECATED_IN_2_0_(CL_HPP_DECLARE_PARAM_TRAITS_)
1483 #endif // CL_HPP_MINIMUM_OPENCL_VERSION < 120
1484 #if CL_HPP_TARGET_OPENCL_VERSION > 120 && CL_HPP_MINIMUM_OPENCL_VERSION < 200
1485 CL_HPP_PARAM_NAME_INFO_1_2_DEPRECATED_IN_2_0_(CL_HPP_DECLARE_PARAM_TRAITS_)
1486 #endif // CL_HPP_MINIMUM_OPENCL_VERSION < 200
1488 #if defined(CL_HPP_USE_CL_DEVICE_FISSION)
1489 CL_HPP_PARAM_NAME_DEVICE_FISSION_(CL_HPP_DECLARE_PARAM_TRAITS_);
1490 #endif // CL_HPP_USE_CL_DEVICE_FISSION
1492 #if defined(cl_khr_extended_versioning)
1493 #if CL_HPP_TARGET_OPENCL_VERSION < 300
1494 CL_HPP_PARAM_NAME_CL_KHR_EXTENDED_VERSIONING_CL3_SHARED_(CL_HPP_DECLARE_PARAM_TRAITS_);
1495 #endif // CL_HPP_TARGET_OPENCL_VERSION < 300
1496 CL_HPP_PARAM_NAME_CL_KHR_EXTENDED_VERSIONING_KHRONLY_(CL_HPP_DECLARE_PARAM_TRAITS_);
1497 #endif // cl_khr_extended_versioning
1499 #ifdef CL_PLATFORM_ICD_SUFFIX_KHR
1500 CL_HPP_DECLARE_PARAM_TRAITS_(cl_platform_info, CL_PLATFORM_ICD_SUFFIX_KHR,
string)
1503 #ifdef CL_DEVICE_PROFILING_TIMER_OFFSET_AMD
1504 CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_PROFILING_TIMER_OFFSET_AMD, cl_ulong)
1507 #ifdef CL_DEVICE_GLOBAL_FREE_MEMORY_AMD
1508 CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_GLOBAL_FREE_MEMORY_AMD, vector<size_type>)
1510 #ifdef CL_DEVICE_SIMD_PER_COMPUTE_UNIT_AMD
1511 CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_SIMD_PER_COMPUTE_UNIT_AMD, cl_uint)
1513 #ifdef CL_DEVICE_SIMD_WIDTH_AMD
1514 CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_SIMD_WIDTH_AMD, cl_uint)
1516 #ifdef CL_DEVICE_SIMD_INSTRUCTION_WIDTH_AMD
1517 CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_SIMD_INSTRUCTION_WIDTH_AMD, cl_uint)
1519 #ifdef CL_DEVICE_WAVEFRONT_WIDTH_AMD
1520 CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_WAVEFRONT_WIDTH_AMD, cl_uint)
1522 #ifdef CL_DEVICE_GLOBAL_MEM_CHANNELS_AMD
1523 CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_GLOBAL_MEM_CHANNELS_AMD, cl_uint)
1525 #ifdef CL_DEVICE_GLOBAL_MEM_CHANNEL_BANKS_AMD
1526 CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_GLOBAL_MEM_CHANNEL_BANKS_AMD, cl_uint)
1528 #ifdef CL_DEVICE_GLOBAL_MEM_CHANNEL_BANK_WIDTH_AMD
1529 CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_GLOBAL_MEM_CHANNEL_BANK_WIDTH_AMD, cl_uint)
1531 #ifdef CL_DEVICE_LOCAL_MEM_SIZE_PER_COMPUTE_UNIT_AMD
1532 CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_LOCAL_MEM_SIZE_PER_COMPUTE_UNIT_AMD, cl_uint)
1534 #ifdef CL_DEVICE_LOCAL_MEM_BANKS_AMD
1535 CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_LOCAL_MEM_BANKS_AMD, cl_uint)
1538 #ifdef CL_DEVICE_COMPUTE_UNITS_BITFIELD_ARM
1539 CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_COMPUTE_UNITS_BITFIELD_ARM, cl_ulong)
1541 #ifdef CL_DEVICE_JOB_SLOTS_ARM
1542 CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_JOB_SLOTS_ARM, cl_uint)
1544 #ifdef CL_DEVICE_SCHEDULING_CONTROLS_CAPABILITIES_ARM
1545 CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_SCHEDULING_CONTROLS_CAPABILITIES_ARM, cl_bitfield)
1547 #ifdef CL_KERNEL_EXEC_INFO_WORKGROUP_BATCH_SIZE_ARM
1548 CL_HPP_DECLARE_PARAM_TRAITS_(cl_kernel_exec_info, CL_KERNEL_EXEC_INFO_WORKGROUP_BATCH_SIZE_ARM, cl_uint)
1550 #ifdef CL_KERNEL_EXEC_INFO_WORKGROUP_BATCH_SIZE_MODIFIER_ARM
1551 CL_HPP_DECLARE_PARAM_TRAITS_(cl_kernel_exec_info, CL_KERNEL_EXEC_INFO_WORKGROUP_BATCH_SIZE_MODIFIER_ARM, cl_int)
1554 #ifdef CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV
1555 CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV, cl_uint)
1557 #ifdef CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV
1558 CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV, cl_uint)
1560 #ifdef CL_DEVICE_REGISTERS_PER_BLOCK_NV
1561 CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_REGISTERS_PER_BLOCK_NV, cl_uint)
1563 #ifdef CL_DEVICE_WARP_SIZE_NV
1564 CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_WARP_SIZE_NV, cl_uint)
1566 #ifdef CL_DEVICE_GPU_OVERLAP_NV
1567 CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_GPU_OVERLAP_NV, cl_bool)
1569 #ifdef CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV
1570 CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV, cl_bool)
1572 #ifdef CL_DEVICE_INTEGRATED_MEMORY_NV
1573 CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_INTEGRATED_MEMORY_NV, cl_bool)
1578 template <
typename Func,
typename T>
1580 getInfo(Func f, cl_uint name, T* param)
1582 return getInfoHelper(f, name, param, 0);
1585 template <
typename Func,
typename Arg0>
1588 Func f_;
const Arg0& arg0_;
1590 cl_uint param, size_type size,
void* value, size_type* size_ret)
1591 {
return f_(arg0_, param, size, value, size_ret); }
1594 template <
typename Func,
typename Arg0,
typename Arg1>
1597 Func f_;
const Arg0& arg0_;
const Arg1& arg1_;
1599 cl_uint param, size_type size,
void* value, size_type* size_ret)
1600 {
return f_(arg0_, arg1_, param, size, value, size_ret); }
1603 template <
typename Func,
typename Arg0,
typename T>
1605 getInfo(Func f,
const Arg0& arg0, cl_uint name, T* param)
1608 return getInfoHelper(f0, name, param, 0);
1611 template <
typename Func,
typename Arg0,
typename Arg1,
typename T>
1613 getInfo(Func f,
const Arg0& arg0,
const Arg1& arg1, cl_uint name, T* param)
1615 GetInfoFunctor1<Func, Arg0, Arg1> f0 = { f, arg0, arg1 };
1616 return getInfoHelper(f0, name, param, 0);
1620 template<
typename T>
1624 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
1641 { return ::clRetainDevice(device); }
1652 { return ::clReleaseDevice(device); }
1654 #else // CL_HPP_TARGET_OPENCL_VERSION >= 120
1659 struct ReferenceHandler<cl_device_id>
1662 static cl_int retain(cl_device_id)
1663 {
return CL_SUCCESS; }
1665 static cl_int release(cl_device_id)
1666 {
return CL_SUCCESS; }
1668 #endif // ! (CL_HPP_TARGET_OPENCL_VERSION >= 120)
1674 static cl_int retain(cl_platform_id)
1675 {
return CL_SUCCESS; }
1677 static cl_int release(cl_platform_id)
1678 {
return CL_SUCCESS; }
1684 static cl_int retain(cl_context context)
1685 { return ::clRetainContext(context); }
1686 static cl_int release(cl_context context)
1687 { return ::clReleaseContext(context); }
1693 static cl_int retain(cl_command_queue queue)
1694 { return ::clRetainCommandQueue(queue); }
1695 static cl_int release(cl_command_queue queue)
1696 { return ::clReleaseCommandQueue(queue); }
1702 static cl_int retain(cl_mem memory)
1703 { return ::clRetainMemObject(memory); }
1704 static cl_int release(cl_mem memory)
1705 { return ::clReleaseMemObject(memory); }
1711 static cl_int retain(cl_sampler sampler)
1712 { return ::clRetainSampler(sampler); }
1713 static cl_int release(cl_sampler sampler)
1714 { return ::clReleaseSampler(sampler); }
1720 static cl_int retain(cl_program program)
1721 { return ::clRetainProgram(program); }
1722 static cl_int release(cl_program program)
1723 { return ::clReleaseProgram(program); }
1729 static cl_int retain(cl_kernel kernel)
1730 { return ::clRetainKernel(kernel); }
1731 static cl_int release(cl_kernel kernel)
1732 { return ::clReleaseKernel(kernel); }
1738 static cl_int retain(cl_event event)
1739 { return ::clRetainEvent(event); }
1740 static cl_int release(cl_event event)
1741 { return ::clReleaseEvent(event); }
1745 #if CL_HPP_TARGET_OPENCL_VERSION >= 120 && CL_HPP_MINIMUM_OPENCL_VERSION < 120
1747 static cl_uint getVersion(
const vector<char> &versionInfo)
1749 int highVersion = 0;
1752 while(versionInfo[index] !=
'.' ) {
1754 highVersion += versionInfo[index]-
'0';
1758 while(versionInfo[index] !=
' ' && versionInfo[index] !=
'\0') {
1760 lowVersion += versionInfo[index]-
'0';
1763 return (highVersion << 16) | lowVersion;
1766 static cl_uint getPlatformVersion(cl_platform_id platform)
1769 clGetPlatformInfo(platform, CL_PLATFORM_VERSION, 0, NULL, &size);
1771 vector<char> versionInfo(size);
1772 clGetPlatformInfo(platform, CL_PLATFORM_VERSION, size, versionInfo.data(), &size);
1773 return getVersion(versionInfo);
1776 static cl_uint getDevicePlatformVersion(cl_device_id device)
1778 cl_platform_id platform;
1779 clGetDeviceInfo(device, CL_DEVICE_PLATFORM,
sizeof(platform), &platform, NULL);
1780 return getPlatformVersion(platform);
1783 static cl_uint getContextPlatformVersion(cl_context context)
1788 clGetContextInfo(context, CL_CONTEXT_DEVICES, 0, NULL, &size);
1791 vector<cl_device_id> devices(size/
sizeof(cl_device_id));
1792 clGetContextInfo(context, CL_CONTEXT_DEVICES, size, devices.data(), NULL);
1793 return getDevicePlatformVersion(devices[0]);
1795 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120 && CL_HPP_MINIMUM_OPENCL_VERSION < 120
1797 template <
typename T>
1809 Wrapper(
const cl_type &obj,
bool retainObject) : object_(obj)
1812 detail::errHandler(retain(), __RETAIN_ERR);
1818 if (object_ != NULL) { release(); }
1823 object_ = rhs.object_;
1824 detail::errHandler(retain(), __RETAIN_ERR);
1829 object_ = rhs.object_;
1836 detail::errHandler(release(), __RELEASE_ERR);
1837 object_ = rhs.object_;
1838 detail::errHandler(retain(), __RETAIN_ERR);
1846 detail::errHandler(release(), __RELEASE_ERR);
1847 object_ = rhs.object_;
1855 detail::errHandler(release(), __RELEASE_ERR);
1860 const cl_type& operator ()()
const {
return object_; }
1862 cl_type& operator ()() {
return object_; }
1864 cl_type get()
const {
return object_; }
1867 template<
typename Func,
typename U>
1868 friend inline cl_int getInfoHelper(Func, cl_uint, U*,
int,
typename U::cl_type);
1870 cl_int retain()
const
1872 if (object_ !=
nullptr) {
1880 cl_int release()
const
1882 if (object_ !=
nullptr) {
1895 typedef cl_device_id cl_type;
1899 bool referenceCountable_;
1901 static bool isReferenceCountable(cl_device_id device)
1903 bool retVal =
false;
1904 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
1905 #if CL_HPP_MINIMUM_OPENCL_VERSION < 120
1906 if (device != NULL) {
1907 int version = getDevicePlatformVersion(device);
1908 if(version > ((1 << 16) + 1)) {
1912 #else // CL_HPP_MINIMUM_OPENCL_VERSION < 120
1914 #endif // CL_HPP_MINIMUM_OPENCL_VERSION < 120
1915 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
1920 Wrapper() : object_(NULL), referenceCountable_(
false)
1924 Wrapper(
const cl_type &obj,
bool retainObject) :
1926 referenceCountable_(
false)
1928 referenceCountable_ = isReferenceCountable(obj);
1931 detail::errHandler(retain(), __RETAIN_ERR);
1942 object_ = rhs.object_;
1943 referenceCountable_ = isReferenceCountable(object_);
1944 detail::errHandler(retain(), __RETAIN_ERR);
1949 object_ = rhs.object_;
1950 referenceCountable_ = rhs.referenceCountable_;
1952 rhs.referenceCountable_ =
false;
1958 detail::errHandler(release(), __RELEASE_ERR);
1959 object_ = rhs.object_;
1960 referenceCountable_ = rhs.referenceCountable_;
1961 detail::errHandler(retain(), __RETAIN_ERR);
1969 detail::errHandler(release(), __RELEASE_ERR);
1970 object_ = rhs.object_;
1971 referenceCountable_ = rhs.referenceCountable_;
1973 rhs.referenceCountable_ =
false;
1980 detail::errHandler(release(), __RELEASE_ERR);
1982 referenceCountable_ = isReferenceCountable(object_);
1986 const cl_type& operator ()()
const {
return object_; }
1988 cl_type& operator ()() {
return object_; }
1990 cl_type get()
const {
return object_; }
1993 template<
typename Func,
typename U>
1994 friend inline cl_int getInfoHelper(Func, cl_uint, U*,
int,
typename U::cl_type);
1996 template<
typename Func,
typename U>
1997 friend inline cl_int getInfoHelper(Func, cl_uint, vector<U>*,
int,
typename U::cl_type);
1999 cl_int retain()
const
2001 if( object_ !=
nullptr && referenceCountable_ ) {
2009 cl_int release()
const
2011 if (object_ !=
nullptr && referenceCountable_) {
2020 template <
typename T>
2023 return lhs() == rhs();
2026 template <
typename T>
2027 inline bool operator!=(
const Wrapper<T> &lhs,
const Wrapper<T> &rhs)
2029 return !operator==(lhs, rhs);
2036 using BuildLogType = vector<std::pair<cl::Device, typename detail::param_traits<detail::cl_program_build_info, CL_PROGRAM_BUILD_LOG>::param_type>>;
2037 #if defined(CL_HPP_ENABLE_EXCEPTIONS)
2041 class BuildError :
public Error
2044 BuildLogType buildLogs;
2046 BuildError(cl_int err,
const char * errStr,
const BuildLogType &vec) : Error(err, errStr), buildLogs(vec)
2050 BuildLogType getBuildLog()
const
2056 static inline cl_int buildErrHandler(
2058 const char * errStr,
2059 const BuildLogType &buildLogs)
2061 if (err != CL_SUCCESS) {
2062 throw BuildError(err, errStr, buildLogs);
2070 static inline cl_int buildErrHandler(
2072 const char * errStr,
2073 const BuildLogType &buildLogs)
2080 #endif // #if defined(CL_HPP_ENABLE_EXCEPTIONS)
2096 image_channel_order = order;
2097 image_channel_data_type = type;
2104 this->image_channel_data_type = rhs.image_channel_data_type;
2105 this->image_channel_order = rhs.image_channel_order;
2121 static std::once_flag default_initialized_;
2123 static cl_int default_error_;
2130 static void makeDefault();
2137 static void makeDefaultProvided(
const Device &p) {
2142 #ifdef CL_HPP_UNIT_TEST_ENABLE
2149 static void unitTestClearDefault() {
2152 #endif // #ifdef CL_HPP_UNIT_TEST_ENABLE
2161 explicit Device(
const cl_device_id &device,
bool retainObject =
false) :
2162 detail::Wrapper<cl_type>(device, retainObject) { }
2169 cl_int *errResult = NULL)
2171 std::call_once(default_initialized_, makeDefault);
2172 detail::errHandler(default_error_);
2173 if (errResult != NULL) {
2174 *errResult = default_error_;
2188 std::call_once(default_initialized_, makeDefaultProvided, std::cref(default_device));
2189 detail::errHandler(default_error_);
2232 template <
typename T>
2233 cl_int
getInfo(cl_device_info name, T* param)
const
2235 return detail::errHandler(
2236 detail::getInfo(&::clGetDeviceInfo, object_, name, param),
2237 __GET_DEVICE_INFO_ERR);
2241 template <cl_device_info name>
typename
2246 detail::cl_device_info, name>::param_type param;
2247 cl_int result =
getInfo(name, ¶m);
2255 #if CL_HPP_TARGET_OPENCL_VERSION >= 210
2264 cl_ulong retVal = 0;
2266 clGetHostTimer(this->get(), &retVal);
2269 __GET_HOST_TIMER_ERR);
2288 std::pair<cl_ulong, cl_ulong> retVal;
2290 clGetDeviceAndHostTimer(this->get(), &(retVal.first), &(retVal.second));
2293 __GET_DEVICE_AND_HOST_TIMER_ERR);
2299 #endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 210
2304 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
2307 const cl_device_partition_property * properties,
2308 vector<Device>* devices)
2311 cl_int err = clCreateSubDevices(object_, properties, 0, NULL, &n);
2312 if (err != CL_SUCCESS) {
2313 return detail::errHandler(err, __CREATE_SUB_DEVICES_ERR);
2316 vector<cl_device_id> ids(n);
2317 err = clCreateSubDevices(object_, properties, n, ids.data(), NULL);
2318 if (err != CL_SUCCESS) {
2319 return detail::errHandler(err, __CREATE_SUB_DEVICES_ERR);
2325 devices->resize(ids.size());
2329 for (size_type i = 0; i < ids.size(); i++) {
2332 (*devices)[i] =
Device(ids[i],
false);
2338 #elif defined(CL_HPP_USE_CL_DEVICE_FISSION)
2344 const cl_device_partition_property_ext * properties,
2345 vector<Device>* devices)
2347 typedef CL_API_ENTRY cl_int
2348 ( CL_API_CALL * PFN_clCreateSubDevicesEXT)(
2350 const cl_device_partition_property_ext * ,
2353 cl_uint * ) CL_EXT_SUFFIX__VERSION_1_1;
2355 static PFN_clCreateSubDevicesEXT pfn_clCreateSubDevicesEXT = NULL;
2356 CL_HPP_INIT_CL_EXT_FCN_PTR_(clCreateSubDevicesEXT);
2359 cl_int err = pfn_clCreateSubDevicesEXT(object_, properties, 0, NULL, &n);
2360 if (err != CL_SUCCESS) {
2361 return detail::errHandler(err, __CREATE_SUB_DEVICES_ERR);
2364 vector<cl_device_id> ids(n);
2365 err = pfn_clCreateSubDevicesEXT(object_, properties, n, ids.data(), NULL);
2366 if (err != CL_SUCCESS) {
2367 return detail::errHandler(err, __CREATE_SUB_DEVICES_ERR);
2372 devices->resize(ids.size());
2376 for (size_type i = 0; i < ids.size(); i++) {
2379 (*devices)[i] =
Device(ids[i],
false);
2384 #endif // defined(CL_HPP_USE_CL_DEVICE_FISSION)
2387 CL_HPP_DEFINE_STATIC_MEMBER_ std::once_flag Device::default_initialized_;
2388 CL_HPP_DEFINE_STATIC_MEMBER_ Device Device::default_;
2389 CL_HPP_DEFINE_STATIC_MEMBER_ cl_int Device::default_error_ = CL_SUCCESS;
2401 static std::once_flag default_initialized_;
2403 static cl_int default_error_;
2410 static void makeDefault() {
2414 #if defined(CL_HPP_ENABLE_EXCEPTIONS)
2422 cl_int err = ::clGetPlatformIDs(0, NULL, &n);
2423 if (err != CL_SUCCESS) {
2424 default_error_ = err;
2428 default_error_ = CL_INVALID_PLATFORM;
2432 vector<cl_platform_id> ids(n);
2433 err = ::clGetPlatformIDs(n, ids.data(), NULL);
2434 if (err != CL_SUCCESS) {
2435 default_error_ = err;
2441 #if defined(CL_HPP_ENABLE_EXCEPTIONS)
2442 catch (cl::Error &e) {
2443 default_error_ = e.err();
2453 static void makeDefaultProvided(
const Platform &p) {
2458 #ifdef CL_HPP_UNIT_TEST_ENABLE
2465 static void unitTestClearDefault() {
2468 #endif // #ifdef CL_HPP_UNIT_TEST_ENABLE
2480 explicit Platform(
const cl_platform_id &platform,
bool retainObject =
false) :
2481 detail::Wrapper<cl_type>(platform, retainObject) { }
2494 cl_int *errResult = NULL)
2496 std::call_once(default_initialized_, makeDefault);
2497 detail::errHandler(default_error_);
2498 if (errResult != NULL) {
2499 *errResult = default_error_;
2513 std::call_once(default_initialized_, makeDefaultProvided, std::cref(default_platform));
2514 detail::errHandler(default_error_);
2519 template <
typename T>
2520 cl_int
getInfo(cl_platform_info name, T* param)
const
2522 return detail::errHandler(
2523 detail::getInfo(&::clGetPlatformInfo, object_, name, param),
2524 __GET_PLATFORM_INFO_ERR);
2528 template <cl_platform_info name>
typename
2533 detail::cl_platform_info, name>::param_type param;
2534 cl_int result =
getInfo(name, ¶m);
2546 cl_device_type type,
2547 vector<Device>* devices)
const
2550 if( devices == NULL ) {
2551 return detail::errHandler(CL_INVALID_ARG_VALUE, __GET_DEVICE_IDS_ERR);
2553 cl_int err = ::clGetDeviceIDs(object_, type, 0, NULL, &n);
2554 if (err != CL_SUCCESS && err != CL_DEVICE_NOT_FOUND) {
2555 return detail::errHandler(err, __GET_DEVICE_IDS_ERR);
2558 vector<cl_device_id> ids(n);
2560 err = ::clGetDeviceIDs(object_, type, n, ids.data(), NULL);
2561 if (err != CL_SUCCESS) {
2562 return detail::errHandler(err, __GET_DEVICE_IDS_ERR);
2571 devices->resize(ids.size());
2575 for (size_type i = 0; i < ids.size(); i++) {
2576 (*devices)[i] =
Device(ids[i],
true);
2582 #if defined(CL_HPP_USE_DX_INTEROP)
2607 cl_d3d10_device_source_khr d3d_device_source,
2609 cl_d3d10_device_set_khr d3d_device_set,
2610 vector<Device>* devices)
const
2612 typedef CL_API_ENTRY cl_int (CL_API_CALL *PFN_clGetDeviceIDsFromD3D10KHR)(
2613 cl_platform_id platform,
2614 cl_d3d10_device_source_khr d3d_device_source,
2616 cl_d3d10_device_set_khr d3d_device_set,
2617 cl_uint num_entries,
2618 cl_device_id * devices,
2619 cl_uint* num_devices);
2621 if( devices == NULL ) {
2622 return detail::errHandler(CL_INVALID_ARG_VALUE, __GET_DEVICE_IDS_ERR);
2625 static PFN_clGetDeviceIDsFromD3D10KHR pfn_clGetDeviceIDsFromD3D10KHR = NULL;
2626 CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_(object_, clGetDeviceIDsFromD3D10KHR);
2629 cl_int err = pfn_clGetDeviceIDsFromD3D10KHR(
2637 if (err != CL_SUCCESS) {
2638 return detail::errHandler(err, __GET_DEVICE_IDS_ERR);
2641 vector<cl_device_id> ids(n);
2642 err = pfn_clGetDeviceIDsFromD3D10KHR(
2650 if (err != CL_SUCCESS) {
2651 return detail::errHandler(err, __GET_DEVICE_IDS_ERR);
2659 devices->resize(ids.size());
2663 for (size_type i = 0; i < ids.size(); i++) {
2664 (*devices)[i] = Device(ids[i],
true);
2676 vector<Platform>* platforms)
2680 if( platforms == NULL ) {
2681 return detail::errHandler(CL_INVALID_ARG_VALUE, __GET_PLATFORM_IDS_ERR);
2684 cl_int err = ::clGetPlatformIDs(0, NULL, &n);
2685 if (err != CL_SUCCESS) {
2686 return detail::errHandler(err, __GET_PLATFORM_IDS_ERR);
2689 vector<cl_platform_id> ids(n);
2690 err = ::clGetPlatformIDs(n, ids.data(), NULL);
2691 if (err != CL_SUCCESS) {
2692 return detail::errHandler(err, __GET_PLATFORM_IDS_ERR);
2696 platforms->resize(ids.size());
2699 for (size_type i = 0; i < ids.size(); i++) {
2700 (*platforms)[i] =
Platform(ids[i]);
2714 Platform default_platform = Platform::getDefault(&err);
2716 *platform = default_platform;
2730 cl_int * errResult = NULL)
2733 Platform default_platform = Platform::getDefault(&err);
2737 return default_platform;
2740 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
2745 return ::clUnloadPlatformCompiler(object_);
2747 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
2750 CL_HPP_DEFINE_STATIC_MEMBER_ std::once_flag Platform::default_initialized_;
2751 CL_HPP_DEFINE_STATIC_MEMBER_ Platform Platform::default_;
2752 CL_HPP_DEFINE_STATIC_MEMBER_ cl_int Platform::default_error_ = CL_SUCCESS;
2758 #if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
2763 inline CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_int
2768 return ::clUnloadCompiler();
2770 #endif // #if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
2784 static std::once_flag default_initialized_;
2786 static cl_int default_error_;
2793 static void makeDefault() {
2797 #if defined(CL_HPP_ENABLE_EXCEPTIONS)
2801 #if !defined(__APPLE__) && !defined(__MACOS)
2802 const Platform &p = Platform::getDefault();
2803 cl_platform_id defaultPlatform = p();
2804 cl_context_properties properties[3] = {
2805 CL_CONTEXT_PLATFORM, (cl_context_properties)defaultPlatform, 0
2807 #else // #if !defined(__APPLE__) && !defined(__MACOS)
2808 cl_context_properties *properties =
nullptr;
2809 #endif // #if !defined(__APPLE__) && !defined(__MACOS)
2812 CL_DEVICE_TYPE_DEFAULT,
2818 #if defined(CL_HPP_ENABLE_EXCEPTIONS)
2819 catch (cl::Error &e) {
2820 default_error_ = e.err();
2831 static void makeDefaultProvided(
const Context &c) {
2836 #ifdef CL_HPP_UNIT_TEST_ENABLE
2843 static void unitTestClearDefault() {
2846 #endif // #ifdef CL_HPP_UNIT_TEST_ENABLE
2853 const vector<Device>& devices,
2854 cl_context_properties* properties = NULL,
2855 void (CL_CALLBACK * notifyFptr)(
2865 size_type numDevices = devices.size();
2866 vector<cl_device_id> deviceIDs(numDevices);
2868 for( size_type deviceIndex = 0; deviceIndex < numDevices; ++deviceIndex ) {
2869 deviceIDs[deviceIndex] = (devices[deviceIndex])();
2872 object_ = ::clCreateContext(
2873 properties, (cl_uint) numDevices,
2875 notifyFptr, data, &error);
2877 detail::errHandler(error, __CREATE_CONTEXT_ERR);
2889 cl_context_properties* properties = NULL,
2890 void (CL_CALLBACK * notifyFptr)(
2900 cl_device_id deviceID = device();
2902 object_ = ::clCreateContext(
2905 notifyFptr, data, &error);
2907 detail::errHandler(error, __CREATE_CONTEXT_ERR);
2918 cl_device_type type,
2919 cl_context_properties* properties = NULL,
2920 void (CL_CALLBACK * notifyFptr)(
2930 #if !defined(__APPLE__) && !defined(__MACOS)
2931 cl_context_properties prop[4] = {CL_CONTEXT_PLATFORM, 0, 0, 0 };
2933 if (properties == NULL) {
2935 vector<Platform> platforms;
2936 error = Platform::get(&platforms);
2937 if (error != CL_SUCCESS) {
2938 detail::errHandler(error, __CREATE_CONTEXT_FROM_TYPE_ERR);
2946 cl_context_properties platform_id = 0;
2947 for (
unsigned int i = 0; i < platforms.size(); i++) {
2949 vector<Device> devices;
2951 #if defined(CL_HPP_ENABLE_EXCEPTIONS)
2955 error = platforms[i].getDevices(type, &devices);
2957 #if defined(CL_HPP_ENABLE_EXCEPTIONS)
2958 }
catch (cl::Error& e) {
2966 if (error != CL_SUCCESS && error != CL_DEVICE_NOT_FOUND) {
2967 detail::errHandler(error, __CREATE_CONTEXT_FROM_TYPE_ERR);
2973 if (devices.size() > 0) {
2974 platform_id = (cl_context_properties)platforms[i]();
2979 if (platform_id == 0) {
2980 detail::errHandler(CL_DEVICE_NOT_FOUND, __CREATE_CONTEXT_FROM_TYPE_ERR);
2982 *err = CL_DEVICE_NOT_FOUND;
2987 prop[1] = platform_id;
2988 properties = &prop[0];
2991 object_ = ::clCreateContextFromType(
2992 properties, type, notifyFptr, data, &error);
2994 detail::errHandler(error, __CREATE_CONTEXT_FROM_TYPE_ERR);
3035 std::call_once(default_initialized_, makeDefault);
3036 detail::errHandler(default_error_);
3038 *err = default_error_;
3052 std::call_once(default_initialized_, makeDefaultProvided, std::cref(default_context));
3053 detail::errHandler(default_error_);
3065 explicit Context(
const cl_context& context,
bool retainObject =
false) :
3066 detail::Wrapper<cl_type>(context, retainObject) { }
3080 template <
typename T>
3081 cl_int
getInfo(cl_context_info name, T* param)
const
3083 return detail::errHandler(
3084 detail::getInfo(&::clGetContextInfo, object_, name, param),
3085 __GET_CONTEXT_INFO_ERR);
3089 template <cl_context_info name>
typename
3094 detail::cl_context_info, name>::param_type param;
3095 cl_int result =
getInfo(name, ¶m);
3108 cl_mem_object_type type,
3109 vector<ImageFormat>* formats)
const
3117 cl_int err = ::clGetSupportedImageFormats(
3124 if (err != CL_SUCCESS) {
3125 return detail::errHandler(err, __GET_SUPPORTED_IMAGE_FORMATS_ERR);
3128 if (numEntries > 0) {
3129 vector<ImageFormat> value(numEntries);
3130 err = ::clGetSupportedImageFormats(
3135 (cl_image_format*)value.data(),
3137 if (err != CL_SUCCESS) {
3138 return detail::errHandler(err, __GET_SUPPORTED_IMAGE_FORMATS_ERR);
3141 formats->assign(begin(value), end(value));
3152 inline void Device::makeDefault()
3157 #if defined(CL_HPP_ENABLE_EXCEPTIONS)
3164 detail::errHandler(error, __CREATE_CONTEXT_ERR);
3166 if (error != CL_SUCCESS) {
3167 default_error_ = error;
3170 default_ = context.
getInfo<CL_CONTEXT_DEVICES>()[0];
3171 default_error_ = CL_SUCCESS;
3174 #if defined(CL_HPP_ENABLE_EXCEPTIONS)
3175 catch (cl::Error &e) {
3176 default_error_ = e.err();
3181 CL_HPP_DEFINE_STATIC_MEMBER_ std::once_flag Context::default_initialized_;
3182 CL_HPP_DEFINE_STATIC_MEMBER_ Context Context::default_;
3183 CL_HPP_DEFINE_STATIC_MEMBER_ cl_int Context::default_error_ = CL_SUCCESS;
3197 Event() : detail::Wrapper<cl_type>() { }
3207 explicit Event(
const cl_event& event,
bool retainObject =
false) :
3208 detail::Wrapper<cl_type>(event, retainObject) { }
3222 template <
typename T>
3223 cl_int
getInfo(cl_event_info name, T* param)
const
3225 return detail::errHandler(
3226 detail::getInfo(&::clGetEventInfo, object_, name, param),
3227 __GET_EVENT_INFO_ERR);
3231 template <cl_event_info name>
typename
3236 detail::cl_event_info, name>::param_type param;
3237 cl_int result =
getInfo(name, ¶m);
3245 template <
typename T>
3248 return detail::errHandler(detail::getInfo(
3249 &::clGetEventProfilingInfo, object_, name, param),
3250 __GET_EVENT_PROFILE_INFO_ERR);
3254 template <cl_profiling_info name>
typename
3259 detail::cl_profiling_info, name>::param_type param;
3273 return detail::errHandler(
3274 ::clWaitForEvents(1, &object_),
3275 __WAIT_FOR_EVENTS_ERR);
3278 #if CL_HPP_TARGET_OPENCL_VERSION >= 110
3285 void (CL_CALLBACK * pfn_notify)(cl_event, cl_int,
void *),
3286 void * user_data = NULL)
3288 return detail::errHandler(
3289 ::clSetEventCallback(
3294 __SET_EVENT_CALLBACK_ERR);
3296 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 110
3305 return detail::errHandler(
3307 (cl_uint) events.size(), (events.size() > 0) ? (cl_event*)&events.front() : NULL),
3308 __WAIT_FOR_EVENTS_ERR);
3312 #if CL_HPP_TARGET_OPENCL_VERSION >= 110
3326 cl_int * err = NULL)
3329 object_ = ::clCreateUserEvent(
3333 detail::errHandler(error, __CREATE_USER_EVENT_ERR);
3348 return detail::errHandler(
3349 ::clSetUserEventStatus(object_,status),
3350 __SET_USER_EVENT_STATUS_ERR);
3353 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 110
3359 inline static cl_int
3360 WaitForEvents(
const vector<Event>& events)
3362 return detail::errHandler(
3364 (cl_uint) events.size(), (events.size() > 0) ? (cl_event*)&events.front() : NULL),
3365 __WAIT_FOR_EVENTS_ERR);
3393 explicit Memory(
const cl_mem& memory,
bool retainObject) :
3394 detail::Wrapper<cl_type>(memory, retainObject) { }
3437 template <
typename T>
3440 return detail::errHandler(
3441 detail::getInfo(&::clGetMemObjectInfo, object_, name, param),
3442 __GET_MEM_OBJECT_INFO_ERR);
3446 template <cl_mem_info name>
typename
3451 detail::cl_mem_info, name>::param_type param;
3452 cl_int result =
getInfo(name, ¶m);
3459 #if CL_HPP_TARGET_OPENCL_VERSION >= 110
3474 void (CL_CALLBACK * pfn_notify)(cl_mem,
void *),
3475 void * user_data = NULL)
3477 return detail::errHandler(
3478 ::clSetMemObjectDestructorCallback(
3482 __SET_MEM_OBJECT_DESTRUCTOR_CALLBACK_ERR);
3484 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 110
3490 template<
typename IteratorType >
3491 cl_int
copy( IteratorType startIterator, IteratorType endIterator,
cl::Buffer &buffer );
3492 template<
typename IteratorType >
3493 cl_int
copy(
const cl::Buffer &buffer, IteratorType startIterator, IteratorType endIterator );
3494 template<
typename IteratorType >
3495 cl_int
copy(
const CommandQueue &queue, IteratorType startIterator, IteratorType endIterator,
cl::Buffer &buffer );
3496 template<
typename IteratorType >
3497 cl_int
copy(
const CommandQueue &queue,
const cl::Buffer &buffer, IteratorType startIterator, IteratorType endIterator );
3500 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
3506 static cl_svm_mem_flags getSVMMemFlags()
3513 template<
class Trait = detail::SVMTraitNull>
3517 static cl_svm_mem_flags getSVMMemFlags()
3519 return CL_MEM_READ_WRITE |
3520 Trait::getSVMMemFlags();
3524 template<
class Trait = detail::SVMTraitNull>
3528 static cl_svm_mem_flags getSVMMemFlags()
3530 return CL_MEM_READ_ONLY |
3531 Trait::getSVMMemFlags();
3535 template<
class Trait = detail::SVMTraitNull>
3539 static cl_svm_mem_flags getSVMMemFlags()
3541 return CL_MEM_WRITE_ONLY |
3542 Trait::getSVMMemFlags();
3546 template<
class Trait = SVMTraitReadWrite<>>
3550 static cl_svm_mem_flags getSVMMemFlags()
3552 return Trait::getSVMMemFlags();
3556 template<
class Trait = SVMTraitReadWrite<>>
3560 static cl_svm_mem_flags getSVMMemFlags()
3562 return CL_MEM_SVM_FINE_GRAIN_BUFFER |
3563 Trait::getSVMMemFlags();
3567 template<
class Trait = SVMTraitReadWrite<>>
3571 static cl_svm_mem_flags getSVMMemFlags()
3574 CL_MEM_SVM_FINE_GRAIN_BUFFER |
3575 CL_MEM_SVM_ATOMICS |
3576 Trait::getSVMMemFlags();
3581 template<
typename T>
3587 const vector<Event>* events = NULL,
3588 Event* event = NULL);
3601 template<
typename T,
class SVMTrait>
3607 typedef T value_type;
3608 typedef value_type* pointer;
3609 typedef const value_type* const_pointer;
3610 typedef value_type& reference;
3611 typedef const value_type& const_reference;
3612 typedef std::size_t size_type;
3613 typedef std::ptrdiff_t difference_type;
3615 template<
typename U>
3621 template<
typename U,
typename V>
3625 context_(
Context::getDefault())
3635 SVMAllocator(
const SVMAllocator &other) :
3636 context_(other.context_)
3640 template<
typename U>
3641 SVMAllocator(
const SVMAllocator<U, SVMTrait> &other) :
3642 context_(other.context_)
3650 pointer address(reference r) CL_HPP_NOEXCEPT_
3652 return std::addressof(r);
3655 const_pointer address(const_reference r) CL_HPP_NOEXCEPT_
3657 return std::addressof(r);
3674 SVMTrait::getSVMMemFlags(),
3677 pointer retValue =
reinterpret_cast<pointer
>(
3679 #if defined(CL_HPP_ENABLE_EXCEPTIONS)
3681 std::bad_alloc excep;
3684 #endif // #if defined(CL_HPP_ENABLE_EXCEPTIONS)
3687 if (!(SVMTrait::getSVMMemFlags() & CL_MEM_SVM_FINE_GRAIN_BUFFER)) {
3688 cl_int err =
enqueueMapSVM(retValue, CL_TRUE, CL_MAP_READ | CL_MAP_WRITE, size*
sizeof(T));
3689 if (err != CL_SUCCESS) {
3690 std::bad_alloc excep;
3699 void deallocate(pointer p, size_type)
3701 clSVMFree(context_(), p);
3710 size_type maxSize = std::numeric_limits<size_type>::max() /
sizeof(T);
3712 for (
const Device &d : context_.
getInfo<CL_CONTEXT_DEVICES>()) {
3715 static_cast<size_type
>(d.getInfo<CL_DEVICE_MAX_MEM_ALLOC_SIZE>()));
3721 template<
class U,
class... Args >
3722 void construct(U* p, Args&&... args)
3738 return (context_==rhs.context_);
3748 template<
class SVMTrait>
3751 typedef void value_type;
3752 typedef value_type* pointer;
3753 typedef const value_type* const_pointer;
3755 template<
typename U>
3761 template<
typename U,
typename V>
3765 #if !defined(CL_HPP_NO_STD_UNIQUE_PTR)
3768 template<
class Alloc>
3775 typedef typename std::allocator_traits<Alloc>::pointer pointer;
3777 Deleter(
const Alloc &alloc, size_type copies) : alloc_{ alloc }, copies_{ copies }
3781 void operator()(pointer ptr)
const {
3782 Alloc tmpAlloc{ alloc_ };
3783 std::allocator_traits<Alloc>::destroy(tmpAlloc, std::addressof(*ptr));
3784 std::allocator_traits<Alloc>::deallocate(tmpAlloc, ptr, copies_);
3795 template <
class T,
class Alloc,
class... Args>
3798 Alloc alloc(alloc_);
3799 static const size_type copies = 1;
3804 T* tmp = std::allocator_traits<Alloc>::allocate(alloc, copies);
3806 std::bad_alloc excep;
3810 std::allocator_traits<Alloc>::construct(
3812 std::addressof(*tmp),
3813 std::forward<Args>(args)...);
3817 catch (std::bad_alloc& b)
3819 std::allocator_traits<Alloc>::deallocate(alloc, tmp, copies);
3824 template<
class T,
class SVMTrait,
class... Args >
3825 cl::pointer<T, detail::Deleter<SVMAllocator<T, SVMTrait>>> allocate_svm(Args... args)
3827 SVMAllocator<T, SVMTrait> alloc;
3828 return cl::allocate_pointer<T>(alloc, args...);
3831 template<
class T,
class SVMTrait,
class... Args >
3832 cl::pointer<T, detail::Deleter<SVMAllocator<T, SVMTrait>>> allocate_svm(
const cl::Context &c, Args... args)
3834 SVMAllocator<T, SVMTrait> alloc(c);
3835 return cl::allocate_pointer<T>(alloc, args...);
3837 #endif // #if !defined(CL_HPP_NO_STD_UNIQUE_PTR)
3842 template <
class T >
3848 template <
class T >
3854 template <
class T >
3857 #endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 200
3881 void* host_ptr = NULL,
3885 object_ = ::clCreateBuffer(context(), flags, size, host_ptr, &error);
3887 detail::errHandler(error, __CREATE_BUFFER_ERR);
3905 void* host_ptr = NULL,
3912 object_ = ::clCreateBuffer(context(), flags, size, host_ptr, &error);
3914 detail::errHandler(error, __CREATE_BUFFER_ERR);
3925 template<
typename IteratorType >
3927 IteratorType startIterator,
3928 IteratorType endIterator,
3930 bool useHostPtr =
false,
3933 typedef typename std::iterator_traits<IteratorType>::value_type DataType;
3936 cl_mem_flags flags = 0;
3938 flags |= CL_MEM_READ_ONLY;
3941 flags |= CL_MEM_READ_WRITE;
3944 flags |= CL_MEM_USE_HOST_PTR;
3947 size_type size =
sizeof(DataType)*(endIterator - startIterator);
3952 object_ = ::clCreateBuffer(context(), flags, size,
static_cast<DataType*
>(&*startIterator), &error);
3954 object_ = ::clCreateBuffer(context(), flags, size, 0, &error);
3957 detail::errHandler(error, __CREATE_BUFFER_ERR);
3963 error =
cl::copy(startIterator, endIterator, *
this);
3964 detail::errHandler(error, __CREATE_BUFFER_ERR);
3976 template<
typename IteratorType >
3977 Buffer(
const Context &context, IteratorType startIterator, IteratorType endIterator,
3978 bool readOnly,
bool useHostPtr =
false, cl_int* err = NULL);
3984 template<
typename IteratorType >
3985 Buffer(
const CommandQueue &queue, IteratorType startIterator, IteratorType endIterator,
3986 bool readOnly,
bool useHostPtr =
false, cl_int* err = NULL);
3998 explicit Buffer(
const cl_mem& buffer,
bool retainObject =
false) :
3999 Memory(buffer, retainObject) { }
4039 #if CL_HPP_TARGET_OPENCL_VERSION >= 110
4046 cl_buffer_create_type buffer_create_type,
4047 const void * buffer_create_info,
4048 cl_int * err = NULL)
4052 result.object_ = ::clCreateSubBuffer(
4059 detail::errHandler(error, __CREATE_SUBBUFFER_ERR);
4066 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 110
4069 #if defined (CL_HPP_USE_DX_INTEROP)
4078 class BufferD3D10 :
public Buffer
4089 const Context& context,
4091 ID3D10Buffer* bufobj,
4092 cl_int * err = NULL) : pfn_clCreateFromD3D10BufferKHR(nullptr)
4094 typedef CL_API_ENTRY cl_mem (CL_API_CALL *PFN_clCreateFromD3D10BufferKHR)(
4095 cl_context context, cl_mem_flags flags, ID3D10Buffer* buffer,
4096 cl_int* errcode_ret);
4097 PFN_clCreateFromD3D10BufferKHR pfn_clCreateFromD3D10BufferKHR;
4098 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
4099 vector<cl_context_properties> props = context.getInfo<CL_CONTEXT_PROPERTIES>();
4100 cl_platform platform = -1;
4101 for(
int i = 0; i < props.size(); ++i ) {
4102 if( props[i] == CL_CONTEXT_PLATFORM ) {
4103 platform = props[i+1];
4106 CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_(platform, clCreateFromD3D10BufferKHR);
4107 #elif CL_HPP_TARGET_OPENCL_VERSION >= 110
4108 CL_HPP_INIT_CL_EXT_FCN_PTR_(clCreateFromD3D10BufferKHR);
4112 object_ = pfn_clCreateFromD3D10BufferKHR(
4118 detail::errHandler(error, __CREATE_GL_BUFFER_ERR);
4125 BufferD3D10() : Buffer() { }
4134 explicit BufferD3D10(
const cl_mem& buffer,
bool retainObject =
false) :
4135 Buffer(buffer, retainObject) { }
4141 BufferD3D10& operator = (
const cl_mem& rhs)
4150 BufferD3D10(
const BufferD3D10& buf) :
4156 BufferD3D10& operator = (
const BufferD3D10 &buf)
4165 BufferD3D10(BufferD3D10&& buf) CL_HPP_NOEXCEPT_ : Buffer(std::move(buf)) {}
4170 BufferD3D10& operator = (BufferD3D10 &&buf)
4198 cl_int * err = NULL)
4201 object_ = ::clCreateFromGLBuffer(
4207 detail::errHandler(error, __CREATE_GL_BUFFER_ERR);
4223 explicit BufferGL(
const cl_mem& buffer,
bool retainObject =
false) :
4224 Buffer(buffer, retainObject) { }
4266 cl_gl_object_type *type,
4267 cl_GLuint * gl_object_name)
4269 return detail::errHandler(
4270 ::clGetGLObjectInfo(object_,type,gl_object_name),
4271 __GET_GL_OBJECT_INFO_ERR);
4295 cl_int * err = NULL)
4298 object_ = ::clCreateFromGLRenderbuffer(
4304 detail::errHandler(error, __CREATE_GL_RENDER_BUFFER_ERR);
4321 Buffer(buffer, retainObject) { }
4363 cl_gl_object_type *type,
4364 cl_GLuint * gl_object_name)
4366 return detail::errHandler(
4367 ::clGetGLObjectInfo(object_,type,gl_object_name),
4368 __GET_GL_OBJECT_INFO_ERR);
4391 explicit Image(
const cl_mem& image,
bool retainObject =
false) :
4392 Memory(image, retainObject) { }
4435 template <
typename T>
4438 return detail::errHandler(
4439 detail::getInfo(&::clGetImageInfo, object_, name, param),
4440 __GET_IMAGE_INFO_ERR);
4444 template <cl_image_info name>
typename
4449 detail::cl_image_info, name>::param_type param;
4458 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
4477 void* host_ptr = NULL,
4481 cl_image_desc desc =
4483 CL_MEM_OBJECT_IMAGE1D,
4485 0, 0, 0, 0, 0, 0, 0, 0
4487 object_ = ::clCreateImage(
4495 detail::errHandler(error, __CREATE_IMAGE_ERR);
4511 explicit Image1D(
const cl_mem& image1D,
bool retainObject =
false) :
4512 Image(image1D, retainObject) { }
4569 cl_image_desc desc =
4571 CL_MEM_OBJECT_IMAGE1D_BUFFER,
4573 0, 0, 0, 0, 0, 0, 0,
4576 object_ = ::clCreateImage(
4584 detail::errHandler(error, __CREATE_IMAGE_ERR);
4600 Image(image1D, retainObject) { }
4648 size_type arraySize,
4651 void* host_ptr = NULL,
4655 cl_image_desc desc =
4657 CL_MEM_OBJECT_IMAGE1D_ARRAY,
4664 object_ = ::clCreateImage(
4672 detail::errHandler(error, __CREATE_IMAGE_ERR);
4687 explicit Image1DArray(
const cl_mem& imageArray,
bool retainObject =
false) :
4688 Image(imageArray, retainObject) { }
4726 #endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 120
4748 size_type row_pitch = 0,
4749 void* host_ptr = NULL,
4753 bool useCreateImage;
4755 #if CL_HPP_TARGET_OPENCL_VERSION >= 120 && CL_HPP_MINIMUM_OPENCL_VERSION < 120
4758 cl_uint version = detail::getContextPlatformVersion(context());
4759 useCreateImage = (version >= 0x10002);
4761 #elif CL_HPP_TARGET_OPENCL_VERSION >= 120
4762 useCreateImage =
true;
4764 useCreateImage =
false;
4767 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
4770 cl_image_desc desc =
4772 CL_MEM_OBJECT_IMAGE2D,
4779 object_ = ::clCreateImage(
4787 detail::errHandler(error, __CREATE_IMAGE_ERR);
4792 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
4793 #if CL_HPP_MINIMUM_OPENCL_VERSION < 120
4794 if (!useCreateImage)
4796 object_ = ::clCreateImage2D(
4797 context(), flags,&format, width, height, row_pitch, host_ptr, &error);
4799 detail::errHandler(error, __CREATE_IMAGE2D_ERR);
4804 #endif // CL_HPP_MINIMUM_OPENCL_VERSION < 120
4807 #if CL_HPP_TARGET_OPENCL_VERSION >= 200 || defined(CL_HPP_USE_CL_IMAGE2D_FROM_BUFFER_KHR)
4816 const Buffer &sourceBuffer,
4819 size_type row_pitch = 0,
4820 cl_int* err =
nullptr)
4824 cl_image_desc desc =
4826 CL_MEM_OBJECT_IMAGE2D,
4835 object_ = ::clCreateImage(
4843 detail::errHandler(error, __CREATE_IMAGE_ERR);
4844 if (err !=
nullptr) {
4848 #endif //#if CL_HPP_TARGET_OPENCL_VERSION >= 200 || defined(CL_HPP_USE_CL_IMAGE2D_FROM_BUFFER_KHR)
4850 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
4865 cl_channel_order order,
4866 const Image &sourceImage,
4867 cl_int* err =
nullptr)
4872 size_type sourceWidth =
4874 size_type sourceHeight =
4876 size_type sourceRowPitch =
4878 cl_uint sourceNumMIPLevels =
4880 cl_uint sourceNumSamples =
4882 cl_image_format sourceFormat =
4887 sourceFormat.image_channel_order = order;
4888 cl_image_desc desc =
4890 CL_MEM_OBJECT_IMAGE2D,
4901 object_ = ::clCreateImage(
4909 detail::errHandler(error, __CREATE_IMAGE_ERR);
4910 if (err !=
nullptr) {
4914 #endif //#if CL_HPP_TARGET_OPENCL_VERSION >= 200
4926 explicit Image2D(
const cl_mem& image2D,
bool retainObject =
false) :
4927 Image(image2D, retainObject) { }
4970 #if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
4994 cl_int * err = NULL)
4997 object_ = ::clCreateFromGLTexture2D(
5005 detail::errHandler(error, __CREATE_GL_TEXTURE_2D_ERR);
5022 explicit Image2DGL(
const cl_mem& image,
bool retainObject =
false) :
5023 Image2D(image, retainObject) { }
5063 } CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
5064 #endif // CL_USE_DEPRECATED_OPENCL_1_1_APIS
5066 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
5077 size_type arraySize,
5081 size_type slicePitch,
5082 void* host_ptr = NULL,
5086 cl_image_desc desc =
5088 CL_MEM_OBJECT_IMAGE2D_ARRAY,
5097 object_ = ::clCreateImage(
5105 detail::errHandler(error, __CREATE_IMAGE_ERR);
5120 explicit Image2DArray(
const cl_mem& imageArray,
bool retainObject =
false) :
Image(imageArray, retainObject) { }
5156 #endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 120
5178 size_type row_pitch = 0,
5179 size_type slice_pitch = 0,
5180 void* host_ptr = NULL,
5184 bool useCreateImage;
5186 #if CL_HPP_TARGET_OPENCL_VERSION >= 120 && CL_HPP_MINIMUM_OPENCL_VERSION < 120
5189 cl_uint version = detail::getContextPlatformVersion(context());
5190 useCreateImage = (version >= 0x10002);
5192 #elif CL_HPP_TARGET_OPENCL_VERSION >= 120
5193 useCreateImage =
true;
5195 useCreateImage =
false;
5198 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
5201 cl_image_desc desc =
5203 CL_MEM_OBJECT_IMAGE3D,
5212 object_ = ::clCreateImage(
5220 detail::errHandler(error, __CREATE_IMAGE_ERR);
5225 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
5226 #if CL_HPP_MINIMUM_OPENCL_VERSION < 120
5227 if (!useCreateImage)
5229 object_ = ::clCreateImage3D(
5230 context(), flags, &format, width, height, depth, row_pitch,
5231 slice_pitch, host_ptr, &error);
5233 detail::errHandler(error, __CREATE_IMAGE3D_ERR);
5238 #endif // CL_HPP_MINIMUM_OPENCL_VERSION < 120
5251 explicit Image3D(
const cl_mem& image3D,
bool retainObject =
false) :
5252 Image(image3D, retainObject) { }
5293 #if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
5316 cl_int * err = NULL)
5319 object_ = ::clCreateFromGLTexture3D(
5327 detail::errHandler(error, __CREATE_GL_TEXTURE_3D_ERR);
5343 explicit Image3DGL(
const cl_mem& image,
bool retainObject =
false) :
5344 Image3D(image, retainObject) { }
5384 #endif // CL_USE_DEPRECATED_OPENCL_1_1_APIS
5386 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
5402 cl_int * err = NULL)
5405 object_ = ::clCreateFromGLTexture(
5413 detail::errHandler(error, __CREATE_GL_TEXTURE_ERR);
5428 explicit ImageGL(
const cl_mem& image,
bool retainObject =
false) :
5429 Image(image, retainObject) { }
5431 ImageGL& operator = (
const cl_mem& rhs)
5465 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
5469 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
5491 cl_uint packet_size,
5492 cl_uint max_packets,
5497 cl_mem_flags flags = CL_MEM_READ_WRITE | CL_MEM_HOST_NO_ACCESS;
5498 object_ = ::clCreatePipe(context(), flags, packet_size, max_packets,
nullptr, &error);
5500 detail::errHandler(error, __CREATE_PIPE_ERR);
5515 cl_uint packet_size,
5516 cl_uint max_packets,
5523 cl_mem_flags flags = CL_MEM_READ_WRITE | CL_MEM_HOST_NO_ACCESS;
5524 object_ = ::clCreatePipe(context(), flags, packet_size, max_packets,
nullptr, &error);
5526 detail::errHandler(error, __CREATE_PIPE_ERR);
5542 explicit Pipe(
const cl_mem& pipe,
bool retainObject =
false) :
5543 Memory(pipe, retainObject) { }
5584 template <
typename T>
5587 return detail::errHandler(
5588 detail::getInfo(&::clGetPipeInfo, object_, name, param),
5589 __GET_PIPE_INFO_ERR);
5593 template <cl_pipe_info name>
typename
5598 detail::cl_pipe_info, name>::param_type param;
5599 cl_int result =
getInfo(name, ¶m);
5606 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 200
5629 cl_bool normalized_coords,
5630 cl_addressing_mode addressing_mode,
5631 cl_filter_mode filter_mode,
5636 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
5637 cl_sampler_properties sampler_properties[] = {
5638 CL_SAMPLER_NORMALIZED_COORDS, normalized_coords,
5639 CL_SAMPLER_ADDRESSING_MODE, addressing_mode,
5640 CL_SAMPLER_FILTER_MODE, filter_mode,
5642 object_ = ::clCreateSamplerWithProperties(
5647 detail::errHandler(error, __CREATE_SAMPLER_WITH_PROPERTIES_ERR);
5652 object_ = ::clCreateSampler(
5659 detail::errHandler(error, __CREATE_SAMPLER_ERR);
5674 explicit Sampler(
const cl_sampler& sampler,
bool retainObject =
false) :
5675 detail::Wrapper<cl_type>(sampler, retainObject) { }
5717 template <
typename T>
5718 cl_int
getInfo(cl_sampler_info name, T* param)
const
5720 return detail::errHandler(
5721 detail::getInfo(&::clGetSamplerInfo, object_, name, param),
5722 __GET_SAMPLER_INFO_ERR);
5726 template <cl_sampler_info name>
typename
5731 detail::cl_sampler_info, name>::param_type param;
5732 cl_int result =
getInfo(name, ¶m);
5742 class DeviceCommandQueue;
5749 size_type sizes_[3];
5750 cl_uint dimensions_;
5781 NDRange(size_type size0, size_type size1, size_type size2)
5793 operator const size_type*()
const {
5807 return dimensions_*
sizeof(size_type);
5815 const size_type* get()
const
5822 static const NDRange NullRange;
5832 template <
typename T,
class Enable =
void>
5837 template <
typename T>
5840 static size_type size(
const T&) {
return sizeof(T); }
5841 static const T* ptr(
const T& value) {
return &value; }
5846 template <
typename T>
5849 static size_type size(
const T&) {
return sizeof(cl_mem); }
5850 static const cl_mem* ptr(
const T& value) {
return &(value()); }
5858 static size_type size(
const LocalSpaceArg& value) {
return value.size_; }
5859 static const void* ptr(
const LocalSpaceArg&) {
return NULL; }
5886 inline Kernel(
const Program& program,
const char* name, cl_int* err = NULL);
5899 explicit Kernel(
const cl_kernel& kernel,
bool retainObject =
false) :
5900 detail::Wrapper<cl_type>(kernel, retainObject) { }
5941 template <
typename T>
5942 cl_int getInfo(cl_kernel_info name, T* param)
const
5944 return detail::errHandler(
5945 detail::getInfo(&::clGetKernelInfo, object_, name, param),
5946 __GET_KERNEL_INFO_ERR);
5949 template <cl_kernel_info name>
typename
5950 detail::param_traits<detail::cl_kernel_info, name>::param_type
5951 getInfo(cl_int* err = NULL)
const
5953 typename detail::param_traits<
5954 detail::cl_kernel_info, name>::param_type param;
5955 cl_int result = getInfo(name, ¶m);
5962 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
5963 template <
typename T>
5964 cl_int getArgInfo(cl_uint argIndex, cl_kernel_arg_info name, T* param)
const
5966 return detail::errHandler(
5967 detail::getInfo(&::clGetKernelArgInfo, object_, argIndex, name, param),
5968 __GET_KERNEL_ARG_INFO_ERR);
5971 template <cl_kernel_arg_info name>
typename
5972 detail::param_traits<detail::cl_kernel_arg_info, name>::param_type
5973 getArgInfo(cl_uint argIndex, cl_int* err = NULL)
const
5975 typename detail::param_traits<
5976 detail::cl_kernel_arg_info, name>::param_type param;
5977 cl_int result = getArgInfo(argIndex, name, ¶m);
5983 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
5985 template <
typename T>
5986 cl_int getWorkGroupInfo(
5987 const Device& device, cl_kernel_work_group_info name, T* param)
const
5989 return detail::errHandler(
5991 &::clGetKernelWorkGroupInfo, object_, device(), name, param),
5992 __GET_KERNEL_WORK_GROUP_INFO_ERR);
5995 template <cl_kernel_work_group_info name>
typename
5996 detail::param_traits<detail::cl_kernel_work_group_info, name>::param_type
5997 getWorkGroupInfo(
const Device& device, cl_int* err = NULL)
const
5999 typename detail::param_traits<
6000 detail::cl_kernel_work_group_info, name>::param_type param;
6001 cl_int result = getWorkGroupInfo(device, name, ¶m);
6008 #if (CL_HPP_TARGET_OPENCL_VERSION >= 200 && defined(CL_HPP_USE_CL_SUB_GROUPS_KHR)) || CL_HPP_TARGET_OPENCL_VERSION >= 210
6009 cl_int getSubGroupInfo(
const cl::Device &dev, cl_kernel_sub_group_info name,
const cl::NDRange &range, size_type* param)
const
6011 #if CL_HPP_TARGET_OPENCL_VERSION >= 210
6013 return detail::errHandler(
6014 clGetKernelSubGroupInfo(object_, dev(), name, range.
size(), range.get(),
sizeof(size_type), param,
nullptr),
6015 __GET_KERNEL_SUB_GROUP_INFO_ERR);
6017 #else // #if CL_HPP_TARGET_OPENCL_VERSION >= 210
6019 typedef clGetKernelSubGroupInfoKHR_fn PFN_clGetKernelSubGroupInfoKHR;
6020 static PFN_clGetKernelSubGroupInfoKHR pfn_clGetKernelSubGroupInfoKHR = NULL;
6021 CL_HPP_INIT_CL_EXT_FCN_PTR_(clGetKernelSubGroupInfoKHR);
6023 return detail::errHandler(
6024 pfn_clGetKernelSubGroupInfoKHR(object_, dev(), name, range.
size(), range.get(),
sizeof(size_type), param,
nullptr),
6025 __GET_KERNEL_SUB_GROUP_INFO_ERR);
6027 #endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 210
6030 template <cl_kernel_sub_group_info name>
6031 size_type getSubGroupInfo(
const cl::Device &dev,
const cl::NDRange &range, cl_int* err = NULL)
const
6034 cl_int result = getSubGroupInfo(dev, name, range, ¶m);
6040 #endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 200
6042 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
6045 template<
typename T,
class D>
6046 cl_int
setArg(cl_uint index,
const cl::pointer<T, D> &argPtr)
6048 return detail::errHandler(
6049 ::clSetKernelArgSVMPointer(object_, index, argPtr.get()),
6050 __SET_KERNEL_ARGS_ERR);
6055 template<
typename T,
class Alloc>
6056 cl_int
setArg(cl_uint index,
const cl::vector<T, Alloc> &argPtr)
6058 return detail::errHandler(
6059 ::clSetKernelArgSVMPointer(object_, index, argPtr.data()),
6060 __SET_KERNEL_ARGS_ERR);
6065 template<
typename T>
6066 typename std::enable_if<std::is_pointer<T>::value, cl_int>::type
6069 return detail::errHandler(
6070 ::clSetKernelArgSVMPointer(object_, index, argPtr),
6071 __SET_KERNEL_ARGS_ERR);
6073 #endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 200
6077 template <
typename T>
6078 typename std::enable_if<!std::is_pointer<T>::value, cl_int>::type
6081 return detail::errHandler(
6087 __SET_KERNEL_ARGS_ERR);
6090 cl_int
setArg(cl_uint index, size_type size,
const void* argPtr)
6092 return detail::errHandler(
6093 ::clSetKernelArg(object_, index, size, argPtr),
6094 __SET_KERNEL_ARGS_ERR);
6097 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
6104 return detail::errHandler(
6105 ::clSetKernelExecInfo(
6107 CL_KERNEL_EXEC_INFO_SVM_PTRS,
6108 sizeof(
void*)*pointerList.size(),
6109 pointerList.data()));
6116 template<
int ArrayLength>
6119 return detail::errHandler(
6120 ::clSetKernelExecInfo(
6122 CL_KERNEL_EXEC_INFO_SVM_PTRS,
6123 sizeof(
void*)*pointerList.size(),
6124 pointerList.data()));
6140 cl_bool svmEnabled_ = svmEnabled ? CL_TRUE : CL_FALSE;
6141 return detail::errHandler(
6142 ::clSetKernelExecInfo(
6144 CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM,
6151 template<
int index,
int ArrayLength,
class D,
typename T0,
typename T1,
typename... Ts>
6152 void setSVMPointersHelper(std::array<void*, ArrayLength> &pointerList,
const pointer<T0, D> &t0,
const pointer<T1, D> &t1, Ts & ... ts)
6154 pointerList[index] =
static_cast<void*
>(t0.get());
6155 setSVMPointersHelper<index + 1, ArrayLength>(pointerList, t1, ts...);
6158 template<
int index,
int ArrayLength,
typename T0,
typename T1,
typename... Ts>
6159 typename std::enable_if<std::is_pointer<T0>::value,
void>::type
6160 setSVMPointersHelper(std::array<void*, ArrayLength> &pointerList, T0 t0, T1 t1, Ts... ts)
6162 pointerList[index] =
static_cast<void*
>(t0);
6163 setSVMPointersHelper<index + 1, ArrayLength>(pointerList, t1, ts...);
6166 template<
int index,
int ArrayLength,
typename T0,
class D>
6167 void setSVMPointersHelper(std::array<void*, ArrayLength> &pointerList,
const pointer<T0, D> &t0)
6169 pointerList[index] =
static_cast<void*
>(t0.get());
6173 template<
int index,
int ArrayLength,
typename T0>
6174 typename std::enable_if<std::is_pointer<T0>::value,
void>::type
6175 setSVMPointersHelper(std::array<void*, ArrayLength> &pointerList, T0 t0)
6177 pointerList[index] =
static_cast<void*
>(t0);
6180 template<
typename T0,
typename... Ts>
6183 std::array<
void*, 1 +
sizeof...(Ts)> pointerList;
6185 setSVMPointersHelper<0, 1 +
sizeof...(Ts)>(pointerList, t0, ts...);
6186 return detail::errHandler(
6187 ::clSetKernelExecInfo(
6189 CL_KERNEL_EXEC_INFO_SVM_PTRS,
6190 sizeof(
void*)*(1 +
sizeof...(Ts)),
6191 pointerList.data()));
6194 template<
typename T>
6195 cl_int setExecInfo(cl_kernel_exec_info param_name,
const T& val)
6197 return detail::errHandler(
6198 ::clSetKernelExecInfo(
6205 template<cl_kernel_exec_info name>
6206 cl_int setExecInfo(
typename detail::param_traits<detail::cl_kernel_exec_info, name>::param_type& val)
6208 return setExecInfo(name, val);
6210 #endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 200
6212 #if CL_HPP_TARGET_OPENCL_VERSION >= 210
6221 Kernel retValue(clCloneKernel(this->get(), &error));
6223 detail::errHandler(error, __CLONE_KERNEL_ERR);
6226 #endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 210
6235 #if !defined(CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY)
6236 typedef vector<vector<unsigned char>> Binaries;
6237 typedef vector<string> Sources;
6238 #else // #if !defined(CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY)
6239 typedef vector<std::pair<const void*, size_type> > Binaries;
6240 typedef vector<std::pair<const char*, size_type> > Sources;
6241 #endif // #if !defined(CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY)
6244 const string& source,
6250 const char * strings = source.c_str();
6251 const size_type length = source.size();
6255 object_ = ::clCreateProgramWithSource(
6256 context(), (cl_uint)1, &strings, &length, &error);
6258 detail::errHandler(error, __CREATE_PROGRAM_WITH_SOURCE_ERR);
6260 if (error == CL_SUCCESS && build) {
6262 error = ::clBuildProgram(
6266 #
if !defined(CL_HPP_CL_1_2_DEFAULT_BUILD)
6274 detail::buildErrHandler(error, __BUILD_PROGRAM_ERR, getBuildInfo<CL_PROGRAM_BUILD_LOG>());
6284 const string& source,
6290 const char * strings = source.c_str();
6291 const size_type length = source.size();
6293 object_ = ::clCreateProgramWithSource(
6294 context(), (cl_uint)1, &strings, &length, &error);
6296 detail::errHandler(error, __CREATE_PROGRAM_WITH_SOURCE_ERR);
6298 if (error == CL_SUCCESS && build) {
6299 error = ::clBuildProgram(
6303 #
if !defined(CL_HPP_CL_1_2_DEFAULT_BUILD)
6311 detail::buildErrHandler(error, __BUILD_PROGRAM_ERR, getBuildInfo<CL_PROGRAM_BUILD_LOG>());
6324 const Sources& sources,
6330 const size_type n = (size_type)sources.size();
6332 vector<size_type> lengths(n);
6333 vector<const char*> strings(n);
6335 for (size_type i = 0; i < n; ++i) {
6336 #if !defined(CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY)
6337 strings[i] = sources[(int)i].data();
6338 lengths[i] = sources[(int)i].length();
6339 #else // #if !defined(CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY)
6340 strings[i] = sources[(int)i].first;
6341 lengths[i] = sources[(int)i].second;
6342 #endif // #if !defined(CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY)
6345 object_ = ::clCreateProgramWithSource(
6346 context(), (cl_uint)n, strings.data(), lengths.data(), &error);
6348 detail::errHandler(error, __CREATE_PROGRAM_WITH_SOURCE_ERR);
6360 const Sources& sources,
6365 const size_type n = (size_type)sources.size();
6367 vector<size_type> lengths(n);
6368 vector<const char*> strings(n);
6370 for (size_type i = 0; i < n; ++i) {
6371 #if !defined(CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY)
6372 strings[i] = sources[(int)i].data();
6373 lengths[i] = sources[(int)i].length();
6374 #else // #if !defined(CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY)
6375 strings[i] = sources[(int)i].first;
6376 lengths[i] = sources[(int)i].second;
6377 #endif // #if !defined(CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY)
6380 object_ = ::clCreateProgramWithSource(
6381 context(), (cl_uint)n, strings.data(), lengths.data(), &error);
6383 detail::errHandler(error, __CREATE_PROGRAM_WITH_SOURCE_ERR);
6390 #if CL_HPP_TARGET_OPENCL_VERSION >= 210 || (CL_HPP_TARGET_OPENCL_VERSION==200 && defined(CL_HPP_USE_IL_KHR))
6396 const vector<char>& IL,
6404 #if CL_HPP_TARGET_OPENCL_VERSION >= 210
6406 object_ = ::clCreateProgramWithIL(
6407 context(),
static_cast<const void*
>(IL.data()), IL.size(), &error);
6409 #else // #if CL_HPP_TARGET_OPENCL_VERSION >= 210
6411 typedef clCreateProgramWithILKHR_fn PFN_clCreateProgramWithILKHR;
6412 static PFN_clCreateProgramWithILKHR pfn_clCreateProgramWithILKHR = NULL;
6413 CL_HPP_INIT_CL_EXT_FCN_PTR_(clCreateProgramWithILKHR);
6415 return detail::errHandler(
6416 pfn_clCreateProgramWithILKHR(
6417 context(),
static_cast<const void*
>(IL.data()), IL.size(), &error);
6421 detail::errHandler(error, __CREATE_PROGRAM_WITH_IL_ERR);
6423 if (error == CL_SUCCESS && build) {
6425 error = ::clBuildProgram(
6429 #
if !defined(CL_HPP_CL_1_2_DEFAULT_BUILD)
6437 detail::buildErrHandler(error, __BUILD_PROGRAM_ERR, getBuildInfo<CL_PROGRAM_BUILD_LOG>());
6452 const vector<char>& IL,
6458 #if CL_HPP_TARGET_OPENCL_VERSION >= 210
6460 object_ = ::clCreateProgramWithIL(
6461 context(),
static_cast<const void*
>(IL.data()), IL.size(), &error);
6463 #else // #if CL_HPP_TARGET_OPENCL_VERSION >= 210
6465 typedef clCreateProgramWithILKHR_fn PFN_clCreateProgramWithILKHR;
6466 static PFN_clCreateProgramWithILKHR pfn_clCreateProgramWithILKHR = NULL;
6467 CL_HPP_INIT_CL_EXT_FCN_PTR_(clCreateProgramWithILKHR);
6469 return detail::errHandler(
6470 pfn_clCreateProgramWithILKHR(
6471 context(),
static_cast<const void*
>(IL.data()), IL.size(), &error);
6475 detail::errHandler(error, __CREATE_PROGRAM_WITH_IL_ERR);
6477 if (error == CL_SUCCESS && build) {
6478 error = ::clBuildProgram(
6482 #
if !defined(CL_HPP_CL_1_2_DEFAULT_BUILD)
6490 detail::buildErrHandler(error, __BUILD_PROGRAM_ERR, getBuildInfo<CL_PROGRAM_BUILD_LOG>());
6497 #endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 210
6520 const vector<Device>& devices,
6521 const Binaries& binaries,
6522 vector<cl_int>* binaryStatus = NULL,
6527 const size_type numDevices = devices.size();
6530 if(binaries.size() != numDevices) {
6531 error = CL_INVALID_VALUE;
6532 detail::errHandler(error, __CREATE_PROGRAM_WITH_BINARY_ERR);
6540 vector<size_type> lengths(numDevices);
6541 vector<const unsigned char*> images(numDevices);
6542 #if !defined(CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY)
6543 for (size_type i = 0; i < numDevices; ++i) {
6544 images[i] = binaries[i].data();
6545 lengths[i] = binaries[(int)i].size();
6547 #else // #if !defined(CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY)
6548 for (size_type i = 0; i < numDevices; ++i) {
6549 images[i] = (
const unsigned char*)binaries[i].first;
6550 lengths[i] = binaries[(int)i].second;
6552 #endif // #if !defined(CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY)
6554 vector<cl_device_id> deviceIDs(numDevices);
6555 for( size_type deviceIndex = 0; deviceIndex < numDevices; ++deviceIndex ) {
6556 deviceIDs[deviceIndex] = (devices[deviceIndex])();
6560 binaryStatus->resize(numDevices);
6563 object_ = ::clCreateProgramWithBinary(
6564 context(), (cl_uint) devices.size(),
6566 lengths.data(), images.data(), (binaryStatus != NULL && numDevices > 0)
6567 ? &binaryStatus->front()
6570 detail::errHandler(error, __CREATE_PROGRAM_WITH_BINARY_ERR);
6577 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
6584 const vector<Device>& devices,
6585 const string& kernelNames,
6591 size_type numDevices = devices.size();
6592 vector<cl_device_id> deviceIDs(numDevices);
6593 for( size_type deviceIndex = 0; deviceIndex < numDevices; ++deviceIndex ) {
6594 deviceIDs[deviceIndex] = (devices[deviceIndex])();
6597 object_ = ::clCreateProgramWithBuiltInKernels(
6599 (cl_uint) devices.size(),
6601 kernelNames.c_str(),
6604 detail::errHandler(error, __CREATE_PROGRAM_WITH_BUILT_IN_KERNELS_ERR);
6609 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
6620 explicit Program(
const cl_program& program,
bool retainObject =
false) :
6621 detail::Wrapper<cl_type>(program, retainObject) { }
6623 Program& operator = (
const cl_program& rhs)
6658 const vector<Device>& devices,
6659 const char* options = NULL,
6660 void (CL_CALLBACK * notifyFptr)(cl_program,
void *) = NULL,
6661 void* data = NULL)
const
6663 size_type numDevices = devices.size();
6664 vector<cl_device_id> deviceIDs(numDevices);
6666 for( size_type deviceIndex = 0; deviceIndex < numDevices; ++deviceIndex ) {
6667 deviceIDs[deviceIndex] = (devices[deviceIndex])();
6670 cl_int buildError = ::clBuildProgram(
6679 return detail::buildErrHandler(buildError, __BUILD_PROGRAM_ERR, getBuildInfo<CL_PROGRAM_BUILD_LOG>());
6683 const Device& device,
6684 const char* options = NULL,
6685 void (CL_CALLBACK * notifyFptr)(cl_program,
void *) = NULL,
6686 void* data = NULL)
const
6688 cl_device_id deviceID = device();
6690 cl_int buildError = ::clBuildProgram(
6698 BuildLogType buildLog(1);
6699 buildLog.push_back(std::make_pair(device, getBuildInfo<CL_PROGRAM_BUILD_LOG>(device)));
6700 return detail::buildErrHandler(buildError, __BUILD_PROGRAM_ERR, buildLog);
6704 const char* options = NULL,
6705 void (CL_CALLBACK * notifyFptr)(cl_program,
void *) = NULL,
6706 void* data = NULL)
const
6708 cl_int buildError = ::clBuildProgram(
6716 return detail::buildErrHandler(buildError, __BUILD_PROGRAM_ERR, getBuildInfo<CL_PROGRAM_BUILD_LOG>());
6719 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
6721 const char* options = NULL,
6722 void (CL_CALLBACK * notifyFptr)(cl_program,
void *) = NULL,
6723 void* data = NULL)
const
6725 cl_int error = ::clCompileProgram(
6735 return detail::buildErrHandler(error, __COMPILE_PROGRAM_ERR, getBuildInfo<CL_PROGRAM_BUILD_LOG>());
6737 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
6739 template <
typename T>
6740 cl_int getInfo(cl_program_info name, T* param)
const
6742 return detail::errHandler(
6743 detail::getInfo(&::clGetProgramInfo, object_, name, param),
6744 __GET_PROGRAM_INFO_ERR);
6747 template <cl_program_info name>
typename
6748 detail::param_traits<detail::cl_program_info, name>::param_type
6749 getInfo(cl_int* err = NULL)
const
6751 typename detail::param_traits<
6752 detail::cl_program_info, name>::param_type param;
6753 cl_int result = getInfo(name, ¶m);
6760 template <
typename T>
6761 cl_int getBuildInfo(
6762 const Device& device, cl_program_build_info name, T* param)
const
6764 return detail::errHandler(
6766 &::clGetProgramBuildInfo, object_, device(), name, param),
6767 __GET_PROGRAM_BUILD_INFO_ERR);
6770 template <cl_program_build_info name>
typename
6771 detail::param_traits<detail::cl_program_build_info, name>::param_type
6772 getBuildInfo(
const Device& device, cl_int* err = NULL)
const
6774 typename detail::param_traits<
6775 detail::cl_program_build_info, name>::param_type param;
6776 cl_int result = getBuildInfo(device, name, ¶m);
6788 template <cl_program_build_info name>
6789 vector<std::pair<cl::Device, typename detail::param_traits<detail::cl_program_build_info, name>::param_type>>
6792 cl_int result = CL_SUCCESS;
6794 auto devs = getInfo<CL_PROGRAM_DEVICES>(&result);
6795 vector<std::pair<cl::Device, typename detail::param_traits<detail::cl_program_build_info, name>::param_type>>
6799 if (result != CL_SUCCESS) {
6808 detail::cl_program_build_info, name>::param_type param;
6809 result = getBuildInfo(d, name, ¶m);
6813 if (result != CL_SUCCESS) {
6821 if (result != CL_SUCCESS) {
6827 cl_int createKernels(vector<Kernel>* kernels)
6830 cl_int err = ::clCreateKernelsInProgram(object_, 0, NULL, &numKernels);
6831 if (err != CL_SUCCESS) {
6832 return detail::errHandler(err, __CREATE_KERNELS_IN_PROGRAM_ERR);
6835 vector<cl_kernel> value(numKernels);
6837 err = ::clCreateKernelsInProgram(
6838 object_, numKernels, value.data(), NULL);
6839 if (err != CL_SUCCESS) {
6840 return detail::errHandler(err, __CREATE_KERNELS_IN_PROGRAM_ERR);
6844 kernels->resize(value.size());
6848 for (size_type i = 0; i < value.size(); i++) {
6851 (*kernels)[i] = Kernel(value[i],
false);
6857 #if CL_HPP_TARGET_OPENCL_VERSION >= 220
6858 #if defined(CL_USE_DEPRECATED_OPENCL_2_2_APIS)
6870 void (CL_CALLBACK * pfn_notify)(cl_program program,
void * user_data),
6871 void * user_data = NULL) CL_EXT_SUFFIX__VERSION_2_2_DEPRECATED
6873 return detail::errHandler(
6874 ::clSetProgramReleaseCallback(
6878 __SET_PROGRAM_RELEASE_CALLBACK_ERR);
6880 #endif // #if defined(CL_USE_DEPRECATED_OPENCL_2_2_APIS)
6886 template <
typename T>
6887 typename std::enable_if<!std::is_pointer<T>::value, cl_int>::type
6890 return detail::errHandler(
6891 ::clSetProgramSpecializationConstant(
6896 __SET_PROGRAM_SPECIALIZATION_CONSTANT_ERR);
6905 return detail::errHandler(
6906 ::clSetProgramSpecializationConstant(
6911 __SET_PROGRAM_SPECIALIZATION_CONSTANT_ERR);
6913 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 220
6916 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
6917 inline Program linkProgram(
6920 const char* options = NULL,
6921 void (CL_CALLBACK * notifyFptr)(cl_program,
void *) = NULL,
6925 cl_int error_local = CL_SUCCESS;
6927 cl_program programs[2] = { input1(), input2() };
6929 Context ctx = input1.getInfo<CL_PROGRAM_CONTEXT>(&error_local);
6930 if(error_local!=CL_SUCCESS) {
6931 detail::errHandler(error_local, __LINK_PROGRAM_ERR);
6934 cl_program prog = ::clLinkProgram(
6945 detail::errHandler(error_local,__COMPILE_PROGRAM_ERR);
6950 return Program(prog);
6953 inline Program linkProgram(
6954 vector<Program> inputPrograms,
6955 const char* options = NULL,
6956 void (CL_CALLBACK * notifyFptr)(cl_program,
void *) = NULL,
6960 cl_int error_local = CL_SUCCESS;
6962 vector<cl_program> programs(inputPrograms.size());
6964 for (
unsigned int i = 0; i < inputPrograms.size(); i++) {
6965 programs[i] = inputPrograms[i]();
6969 if(inputPrograms.size() > 0) {
6970 ctx = inputPrograms[0].getInfo<CL_PROGRAM_CONTEXT>(&error_local);
6971 if(error_local!=CL_SUCCESS) {
6972 detail::errHandler(error_local, __LINK_PROGRAM_ERR);
6975 cl_program prog = ::clLinkProgram(
6980 (cl_uint)inputPrograms.size(),
6986 detail::errHandler(error_local,__COMPILE_PROGRAM_ERR);
6991 return Program(prog,
false);
6993 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
6997 inline cl_int cl::Program::getInfo(cl_program_info name, vector<vector<unsigned char>>* param)
const
6999 if (name != CL_PROGRAM_BINARIES) {
7000 return CL_INVALID_VALUE;
7006 vector<size_type> sizes = getInfo<CL_PROGRAM_BINARY_SIZES>();
7007 size_type numBinaries = sizes.size();
7010 param->resize(numBinaries);
7011 for (size_type i = 0; i < numBinaries; ++i) {
7012 (*param)[i].resize(sizes[i]);
7015 return detail::errHandler(
7016 detail::getInfo(&::clGetProgramInfo, object_, name, param),
7017 __GET_PROGRAM_INFO_ERR);
7024 inline vector<vector<unsigned char>> cl::Program::getInfo<CL_PROGRAM_BINARIES>(cl_int* err)
const
7026 vector<vector<unsigned char>> binariesVectors;
7028 cl_int result = getInfo(CL_PROGRAM_BINARIES, &binariesVectors);
7032 return binariesVectors;
7035 #if CL_HPP_TARGET_OPENCL_VERSION >= 220
7040 cl_uchar ucValue = value ? CL_UCHAR_MAX : 0;
7041 return detail::errHandler(
7042 ::clSetProgramSpecializationConstant(
7047 __SET_PROGRAM_SPECIALIZATION_CONSTANT_ERR);
7049 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 220
7051 inline Kernel::Kernel(
const Program& program,
const char* name, cl_int* err)
7055 object_ = ::clCreateKernel(program(), name, &error);
7056 detail::errHandler(error, __CREATE_KERNEL_ERR);
7064 enum class QueueProperties : cl_command_queue_properties
7067 Profiling = CL_QUEUE_PROFILING_ENABLE,
7068 OutOfOrder = CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE,
7071 inline QueueProperties operator|(QueueProperties lhs, QueueProperties rhs)
7073 return static_cast<QueueProperties
>(
static_cast<cl_command_queue_properties
>(lhs) |
static_cast<cl_command_queue_properties
>(rhs));
7082 static std::once_flag default_initialized_;
7084 static cl_int default_error_;
7091 static void makeDefault()
7096 #if defined(CL_HPP_ENABLE_EXCEPTIONS)
7103 if (error != CL_SUCCESS) {
7104 default_error_ = error;
7108 default_ =
CommandQueue(context, device, 0, &default_error_);
7111 #if defined(CL_HPP_ENABLE_EXCEPTIONS)
7112 catch (cl::Error &e) {
7113 default_error_ = e.err();
7123 static void makeDefaultProvided(
const CommandQueue &c) {
7128 #ifdef CL_HPP_UNIT_TEST_ENABLE
7135 static void unitTestClearDefault() {
7138 #endif // #ifdef CL_HPP_UNIT_TEST_ENABLE
7146 cl_command_queue_properties properties,
7152 detail::errHandler(error, __CREATE_CONTEXT_ERR);
7154 if (error != CL_SUCCESS) {
7161 bool useWithProperties;
7163 #if CL_HPP_TARGET_OPENCL_VERSION >= 200 && CL_HPP_MINIMUM_OPENCL_VERSION < 200
7166 cl_uint version = detail::getContextPlatformVersion(context());
7167 useWithProperties = (version >= 0x20000);
7169 #elif CL_HPP_TARGET_OPENCL_VERSION >= 200
7170 useWithProperties =
true;
7172 useWithProperties =
false;
7175 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
7176 if (useWithProperties) {
7177 cl_queue_properties queue_properties[] = {
7178 CL_QUEUE_PROPERTIES, properties, 0 };
7179 if ((properties & CL_QUEUE_ON_DEVICE) == 0) {
7180 object_ = ::clCreateCommandQueueWithProperties(
7181 context(), device(), queue_properties, &error);
7184 error = CL_INVALID_QUEUE_PROPERTIES;
7187 detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
7192 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 200
7193 #if CL_HPP_MINIMUM_OPENCL_VERSION < 200
7194 if (!useWithProperties) {
7195 object_ = ::clCreateCommandQueue(
7196 context(), device(), properties, &error);
7198 detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
7203 #endif // CL_HPP_MINIMUM_OPENCL_VERSION < 200
7212 QueueProperties properties,
7218 detail::errHandler(error, __CREATE_CONTEXT_ERR);
7220 if (error != CL_SUCCESS) {
7227 bool useWithProperties;
7229 #if CL_HPP_TARGET_OPENCL_VERSION >= 200 && CL_HPP_MINIMUM_OPENCL_VERSION < 200
7232 cl_uint version = detail::getContextPlatformVersion(context());
7233 useWithProperties = (version >= 0x20000);
7235 #elif CL_HPP_TARGET_OPENCL_VERSION >= 200
7236 useWithProperties =
true;
7238 useWithProperties =
false;
7241 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
7242 if (useWithProperties) {
7243 cl_queue_properties queue_properties[] = {
7244 CL_QUEUE_PROPERTIES,
static_cast<cl_queue_properties
>(properties), 0 };
7246 object_ = ::clCreateCommandQueueWithProperties(
7247 context(), device(), queue_properties, &error);
7249 detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
7254 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 200
7255 #if CL_HPP_MINIMUM_OPENCL_VERSION < 200
7256 if (!useWithProperties) {
7257 object_ = ::clCreateCommandQueue(
7258 context(), device(),
static_cast<cl_command_queue_properties
>(properties), &error);
7260 detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
7265 #endif // CL_HPP_MINIMUM_OPENCL_VERSION < 200
7276 cl_command_queue_properties properties = 0,
7280 bool useWithProperties;
7281 vector<cl::Device> devices;
7282 error = context.
getInfo(CL_CONTEXT_DEVICES, &devices);
7284 detail::errHandler(error, __CREATE_CONTEXT_ERR);
7286 if (error != CL_SUCCESS)
7294 #if CL_HPP_TARGET_OPENCL_VERSION >= 200 && CL_HPP_MINIMUM_OPENCL_VERSION < 200
7297 cl_uint version = detail::getContextPlatformVersion(context());
7298 useWithProperties = (version >= 0x20000);
7300 #elif CL_HPP_TARGET_OPENCL_VERSION >= 200
7301 useWithProperties =
true;
7303 useWithProperties =
false;
7306 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
7307 if (useWithProperties) {
7308 cl_queue_properties queue_properties[] = {
7309 CL_QUEUE_PROPERTIES, properties, 0 };
7310 if ((properties & CL_QUEUE_ON_DEVICE) == 0) {
7311 object_ = ::clCreateCommandQueueWithProperties(
7312 context(), devices[0](), queue_properties, &error);
7315 error = CL_INVALID_QUEUE_PROPERTIES;
7318 detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
7323 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 200
7324 #if CL_HPP_MINIMUM_OPENCL_VERSION < 200
7325 if (!useWithProperties) {
7326 object_ = ::clCreateCommandQueue(
7327 context(), devices[0](), properties, &error);
7329 detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
7334 #endif // CL_HPP_MINIMUM_OPENCL_VERSION < 200
7343 QueueProperties properties,
7347 bool useWithProperties;
7348 vector<cl::Device> devices;
7349 error = context.
getInfo(CL_CONTEXT_DEVICES, &devices);
7351 detail::errHandler(error, __CREATE_CONTEXT_ERR);
7353 if (error != CL_SUCCESS)
7361 #if CL_HPP_TARGET_OPENCL_VERSION >= 200 && CL_HPP_MINIMUM_OPENCL_VERSION < 200
7364 cl_uint version = detail::getContextPlatformVersion(context());
7365 useWithProperties = (version >= 0x20000);
7367 #elif CL_HPP_TARGET_OPENCL_VERSION >= 200
7368 useWithProperties =
true;
7370 useWithProperties =
false;
7373 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
7374 if (useWithProperties) {
7375 cl_queue_properties queue_properties[] = {
7376 CL_QUEUE_PROPERTIES,
static_cast<cl_queue_properties
>(properties), 0 };
7377 object_ = ::clCreateCommandQueueWithProperties(
7378 context(), devices[0](), queue_properties, &error);
7380 detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
7385 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 200
7386 #if CL_HPP_MINIMUM_OPENCL_VERSION < 200
7387 if (!useWithProperties) {
7388 object_ = ::clCreateCommandQueue(
7389 context(), devices[0](),
static_cast<cl_command_queue_properties
>(properties), &error);
7391 detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
7396 #endif // CL_HPP_MINIMUM_OPENCL_VERSION < 200
7406 cl_command_queue_properties properties = 0,
7410 bool useWithProperties;
7412 #if CL_HPP_TARGET_OPENCL_VERSION >= 200 && CL_HPP_MINIMUM_OPENCL_VERSION < 200
7415 cl_uint version = detail::getContextPlatformVersion(context());
7416 useWithProperties = (version >= 0x20000);
7418 #elif CL_HPP_TARGET_OPENCL_VERSION >= 200
7419 useWithProperties =
true;
7421 useWithProperties =
false;
7424 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
7425 if (useWithProperties) {
7426 cl_queue_properties queue_properties[] = {
7427 CL_QUEUE_PROPERTIES, properties, 0 };
7428 object_ = ::clCreateCommandQueueWithProperties(
7429 context(), device(), queue_properties, &error);
7431 detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
7436 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 200
7437 #if CL_HPP_MINIMUM_OPENCL_VERSION < 200
7438 if (!useWithProperties) {
7439 object_ = ::clCreateCommandQueue(
7440 context(), device(), properties, &error);
7442 detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
7447 #endif // CL_HPP_MINIMUM_OPENCL_VERSION < 200
7457 QueueProperties properties,
7461 bool useWithProperties;
7463 #if CL_HPP_TARGET_OPENCL_VERSION >= 200 && CL_HPP_MINIMUM_OPENCL_VERSION < 200
7466 cl_uint version = detail::getContextPlatformVersion(context());
7467 useWithProperties = (version >= 0x20000);
7469 #elif CL_HPP_TARGET_OPENCL_VERSION >= 200
7470 useWithProperties =
true;
7472 useWithProperties =
false;
7475 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
7476 if (useWithProperties) {
7477 cl_queue_properties queue_properties[] = {
7478 CL_QUEUE_PROPERTIES,
static_cast<cl_queue_properties
>(properties), 0 };
7479 object_ = ::clCreateCommandQueueWithProperties(
7480 context(), device(), queue_properties, &error);
7482 detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
7487 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 200
7488 #if CL_HPP_MINIMUM_OPENCL_VERSION < 200
7489 if (!useWithProperties) {
7490 object_ = ::clCreateCommandQueue(
7491 context(), device(),
static_cast<cl_command_queue_properties
>(properties), &error);
7493 detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
7498 #endif // CL_HPP_MINIMUM_OPENCL_VERSION < 200
7503 std::call_once(default_initialized_, makeDefault);
7504 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
7505 detail::errHandler(default_error_, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
7506 #else // CL_HPP_TARGET_OPENCL_VERSION >= 200
7507 detail::errHandler(default_error_, __CREATE_COMMAND_QUEUE_ERR);
7508 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 200
7510 *err = default_error_;
7524 std::call_once(default_initialized_, makeDefaultProvided, std::cref(default_queue));
7525 detail::errHandler(default_error_);
7538 explicit CommandQueue(
const cl_command_queue& commandQueue,
bool retainObject =
false) :
7539 detail::Wrapper<cl_type>(commandQueue, retainObject) { }
7575 template <
typename T>
7576 cl_int getInfo(cl_command_queue_info name, T* param)
const
7578 return detail::errHandler(
7580 &::clGetCommandQueueInfo, object_, name, param),
7581 __GET_COMMAND_QUEUE_INFO_ERR);
7584 template <cl_command_queue_info name>
typename
7585 detail::param_traits<detail::cl_command_queue_info, name>::param_type
7586 getInfo(cl_int* err = NULL)
const
7588 typename detail::param_traits<
7589 detail::cl_command_queue_info, name>::param_type param;
7590 cl_int result = getInfo(name, ¶m);
7597 cl_int enqueueReadBuffer(
7598 const Buffer& buffer,
7603 const vector<Event>* events = NULL,
7604 Event* event = NULL)
const
7607 cl_int err = detail::errHandler(
7608 ::clEnqueueReadBuffer(
7609 object_, buffer(), blocking, offset, size,
7611 (events != NULL) ? (cl_uint) events->size() : 0,
7612 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
7613 (event != NULL) ? &tmp : NULL),
7614 __ENQUEUE_READ_BUFFER_ERR);
7616 if (event != NULL && err == CL_SUCCESS)
7622 cl_int enqueueWriteBuffer(
7623 const Buffer& buffer,
7628 const vector<Event>* events = NULL,
7629 Event* event = NULL)
const
7632 cl_int err = detail::errHandler(
7633 ::clEnqueueWriteBuffer(
7634 object_, buffer(), blocking, offset, size,
7636 (events != NULL) ? (cl_uint) events->size() : 0,
7637 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
7638 (event != NULL) ? &tmp : NULL),
7639 __ENQUEUE_WRITE_BUFFER_ERR);
7641 if (event != NULL && err == CL_SUCCESS)
7647 cl_int enqueueCopyBuffer(
7650 size_type src_offset,
7651 size_type dst_offset,
7653 const vector<Event>* events = NULL,
7654 Event* event = NULL)
const
7657 cl_int err = detail::errHandler(
7658 ::clEnqueueCopyBuffer(
7659 object_, src(), dst(), src_offset, dst_offset, size,
7660 (events != NULL) ? (cl_uint) events->size() : 0,
7661 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
7662 (event != NULL) ? &tmp : NULL),
7663 __ENQEUE_COPY_BUFFER_ERR);
7665 if (event != NULL && err == CL_SUCCESS)
7670 #if CL_HPP_TARGET_OPENCL_VERSION >= 110
7671 cl_int enqueueReadBufferRect(
7672 const Buffer& buffer,
7674 const array<size_type, 3>& buffer_offset,
7675 const array<size_type, 3>& host_offset,
7676 const array<size_type, 3>& region,
7677 size_type buffer_row_pitch,
7678 size_type buffer_slice_pitch,
7679 size_type host_row_pitch,
7680 size_type host_slice_pitch,
7682 const vector<Event>* events = NULL,
7683 Event* event = NULL)
const
7686 cl_int err = detail::errHandler(
7687 ::clEnqueueReadBufferRect(
7691 buffer_offset.data(),
7699 (events != NULL) ? (cl_uint) events->size() : 0,
7700 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
7701 (event != NULL) ? &tmp : NULL),
7702 __ENQUEUE_READ_BUFFER_RECT_ERR);
7704 if (event != NULL && err == CL_SUCCESS)
7710 cl_int enqueueWriteBufferRect(
7711 const Buffer& buffer,
7713 const array<size_type, 3>& buffer_offset,
7714 const array<size_type, 3>& host_offset,
7715 const array<size_type, 3>& region,
7716 size_type buffer_row_pitch,
7717 size_type buffer_slice_pitch,
7718 size_type host_row_pitch,
7719 size_type host_slice_pitch,
7721 const vector<Event>* events = NULL,
7722 Event* event = NULL)
const
7725 cl_int err = detail::errHandler(
7726 ::clEnqueueWriteBufferRect(
7730 buffer_offset.data(),
7738 (events != NULL) ? (cl_uint) events->size() : 0,
7739 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
7740 (event != NULL) ? &tmp : NULL),
7741 __ENQUEUE_WRITE_BUFFER_RECT_ERR);
7743 if (event != NULL && err == CL_SUCCESS)
7749 cl_int enqueueCopyBufferRect(
7752 const array<size_type, 3>& src_origin,
7753 const array<size_type, 3>& dst_origin,
7754 const array<size_type, 3>& region,
7755 size_type src_row_pitch,
7756 size_type src_slice_pitch,
7757 size_type dst_row_pitch,
7758 size_type dst_slice_pitch,
7759 const vector<Event>* events = NULL,
7760 Event* event = NULL)
const
7763 cl_int err = detail::errHandler(
7764 ::clEnqueueCopyBufferRect(
7775 (events != NULL) ? (cl_uint) events->size() : 0,
7776 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
7777 (event != NULL) ? &tmp : NULL),
7778 __ENQEUE_COPY_BUFFER_RECT_ERR);
7780 if (event != NULL && err == CL_SUCCESS)
7785 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 110
7786 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
7798 template<
typename PatternType>
7801 PatternType pattern,
7804 const vector<Event>* events = NULL,
7805 Event* event = NULL)
const
7808 cl_int err = detail::errHandler(
7809 ::clEnqueueFillBuffer(
7812 static_cast<void*
>(&pattern),
7813 sizeof(PatternType),
7816 (events != NULL) ? (cl_uint) events->size() : 0,
7817 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
7818 (event != NULL) ? &tmp : NULL),
7819 __ENQUEUE_FILL_BUFFER_ERR);
7821 if (event != NULL && err == CL_SUCCESS)
7826 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
7828 cl_int enqueueReadImage(
7831 const array<size_type, 3>& origin,
7832 const array<size_type, 3>& region,
7833 size_type row_pitch,
7834 size_type slice_pitch,
7836 const vector<Event>* events = NULL,
7837 Event* event = NULL)
const
7840 cl_int err = detail::errHandler(
7841 ::clEnqueueReadImage(
7850 (events != NULL) ? (cl_uint) events->size() : 0,
7851 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
7852 (event != NULL) ? &tmp : NULL),
7853 __ENQUEUE_READ_IMAGE_ERR);
7855 if (event != NULL && err == CL_SUCCESS)
7861 cl_int enqueueWriteImage(
7864 const array<size_type, 3>& origin,
7865 const array<size_type, 3>& region,
7866 size_type row_pitch,
7867 size_type slice_pitch,
7869 const vector<Event>* events = NULL,
7870 Event* event = NULL)
const
7873 cl_int err = detail::errHandler(
7874 ::clEnqueueWriteImage(
7883 (events != NULL) ? (cl_uint) events->size() : 0,
7884 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
7885 (event != NULL) ? &tmp : NULL),
7886 __ENQUEUE_WRITE_IMAGE_ERR);
7888 if (event != NULL && err == CL_SUCCESS)
7894 cl_int enqueueCopyImage(
7897 const array<size_type, 3>& src_origin,
7898 const array<size_type, 3>& dst_origin,
7899 const array<size_type, 3>& region,
7900 const vector<Event>* events = NULL,
7901 Event* event = NULL)
const
7904 cl_int err = detail::errHandler(
7905 ::clEnqueueCopyImage(
7912 (events != NULL) ? (cl_uint) events->size() : 0,
7913 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
7914 (event != NULL) ? &tmp : NULL),
7915 __ENQUEUE_COPY_IMAGE_ERR);
7917 if (event != NULL && err == CL_SUCCESS)
7923 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
7933 cl_float4 fillColor,
7934 const array<size_type, 3>& origin,
7935 const array<size_type, 3>& region,
7936 const vector<Event>* events = NULL,
7937 Event* event = NULL)
const
7940 cl_int err = detail::errHandler(
7941 ::clEnqueueFillImage(
7944 static_cast<void*
>(&fillColor),
7947 (events != NULL) ? (cl_uint) events->size() : 0,
7948 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
7949 (event != NULL) ? &tmp : NULL),
7950 __ENQUEUE_FILL_IMAGE_ERR);
7952 if (event != NULL && err == CL_SUCCESS)
7968 const array<size_type, 3>& origin,
7969 const array<size_type, 3>& region,
7970 const vector<Event>* events = NULL,
7971 Event* event = NULL)
const
7974 cl_int err = detail::errHandler(
7975 ::clEnqueueFillImage(
7978 static_cast<void*
>(&fillColor),
7981 (events != NULL) ? (cl_uint) events->size() : 0,
7982 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
7983 (event != NULL) ? &tmp : NULL),
7984 __ENQUEUE_FILL_IMAGE_ERR);
7986 if (event != NULL && err == CL_SUCCESS)
8002 const array<size_type, 3>& origin,
8003 const array<size_type, 3>& region,
8004 const vector<Event>* events = NULL,
8005 Event* event = NULL)
const
8008 cl_int err = detail::errHandler(
8009 ::clEnqueueFillImage(
8012 static_cast<void*
>(&fillColor),
8015 (events != NULL) ? (cl_uint) events->size() : 0,
8016 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
8017 (event != NULL) ? &tmp : NULL),
8018 __ENQUEUE_FILL_IMAGE_ERR);
8020 if (event != NULL && err == CL_SUCCESS)
8025 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
8027 cl_int enqueueCopyImageToBuffer(
8030 const array<size_type, 3>& src_origin,
8031 const array<size_type, 3>& region,
8032 size_type dst_offset,
8033 const vector<Event>* events = NULL,
8034 Event* event = NULL)
const
8037 cl_int err = detail::errHandler(
8038 ::clEnqueueCopyImageToBuffer(
8045 (events != NULL) ? (cl_uint) events->size() : 0,
8046 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
8047 (event != NULL) ? &tmp : NULL),
8048 __ENQUEUE_COPY_IMAGE_TO_BUFFER_ERR);
8050 if (event != NULL && err == CL_SUCCESS)
8056 cl_int enqueueCopyBufferToImage(
8059 size_type src_offset,
8060 const array<size_type, 3>& dst_origin,
8061 const array<size_type, 3>& region,
8062 const vector<Event>* events = NULL,
8063 Event* event = NULL)
const
8066 cl_int err = detail::errHandler(
8067 ::clEnqueueCopyBufferToImage(
8074 (events != NULL) ? (cl_uint) events->size() : 0,
8075 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
8076 (event != NULL) ? &tmp : NULL),
8077 __ENQUEUE_COPY_BUFFER_TO_IMAGE_ERR);
8079 if (event != NULL && err == CL_SUCCESS)
8085 void* enqueueMapBuffer(
8086 const Buffer& buffer,
8091 const vector<Event>* events = NULL,
8092 Event* event = NULL,
8093 cl_int* err = NULL)
const
8097 void * result = ::clEnqueueMapBuffer(
8098 object_, buffer(), blocking, flags, offset, size,
8099 (events != NULL) ? (cl_uint) events->size() : 0,
8100 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
8101 (event != NULL) ? &tmp : NULL,
8104 detail::errHandler(error, __ENQUEUE_MAP_BUFFER_ERR);
8108 if (event != NULL && error == CL_SUCCESS)
8114 void* enqueueMapImage(
8115 const Image& buffer,
8118 const array<size_type, 3>& origin,
8119 const array<size_type, 3>& region,
8120 size_type * row_pitch,
8121 size_type * slice_pitch,
8122 const vector<Event>* events = NULL,
8123 Event* event = NULL,
8124 cl_int* err = NULL)
const
8128 void * result = ::clEnqueueMapImage(
8129 object_, buffer(), blocking, flags,
8132 row_pitch, slice_pitch,
8133 (events != NULL) ? (cl_uint) events->size() : 0,
8134 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
8135 (event != NULL) ? &tmp : NULL,
8138 detail::errHandler(error, __ENQUEUE_MAP_IMAGE_ERR);
8142 if (event != NULL && error == CL_SUCCESS)
8147 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
8152 template<
typename T>
8158 const vector<Event>* events = NULL,
8159 Event* event = NULL)
const
8162 cl_int err = detail::errHandler(::clEnqueueSVMMap(
8163 object_, blocking, flags,
static_cast<void*
>(ptr), size,
8164 (events != NULL) ? (cl_uint)events->size() : 0,
8165 (events != NULL && events->size() > 0) ? (cl_event*)&events->front() : NULL,
8166 (event != NULL) ? &tmp : NULL),
8167 __ENQUEUE_MAP_BUFFER_ERR);
8169 if (event != NULL && err == CL_SUCCESS)
8180 template<
typename T,
class D>
8182 cl::pointer<T, D> &ptr,
8186 const vector<Event>* events = NULL,
8187 Event* event = NULL)
const
8190 cl_int err = detail::errHandler(::clEnqueueSVMMap(
8191 object_, blocking, flags,
static_cast<void*
>(ptr.get()), size,
8192 (events != NULL) ? (cl_uint)events->size() : 0,
8193 (events != NULL && events->size() > 0) ? (cl_event*)&events->front() : NULL,
8194 (event != NULL) ? &tmp : NULL),
8195 __ENQUEUE_MAP_BUFFER_ERR);
8197 if (event != NULL && err == CL_SUCCESS)
8207 template<
typename T,
class Alloc>
8209 cl::vector<T, Alloc> &container,
8212 const vector<Event>* events = NULL,
8213 Event* event = NULL)
const
8216 cl_int err = detail::errHandler(::clEnqueueSVMMap(
8217 object_, blocking, flags,
static_cast<void*
>(container.data()), container.size()*
sizeof(T),
8218 (events != NULL) ? (cl_uint)events->size() : 0,
8219 (events != NULL && events->size() > 0) ? (cl_event*)&events->front() : NULL,
8220 (event != NULL) ? &tmp : NULL),
8221 __ENQUEUE_MAP_BUFFER_ERR);
8223 if (event != NULL && err == CL_SUCCESS)
8228 #endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 200
8230 cl_int enqueueUnmapMemObject(
8233 const vector<Event>* events = NULL,
8234 Event* event = NULL)
const
8237 cl_int err = detail::errHandler(
8238 ::clEnqueueUnmapMemObject(
8239 object_, memory(), mapped_ptr,
8240 (events != NULL) ? (cl_uint) events->size() : 0,
8241 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
8242 (event != NULL) ? &tmp : NULL),
8243 __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
8245 if (event != NULL && err == CL_SUCCESS)
8252 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
8257 template<
typename T>
8260 const vector<Event>* events = NULL,
8261 Event* event = NULL)
const
8264 cl_int err = detail::errHandler(
8265 ::clEnqueueSVMUnmap(
8266 object_,
static_cast<void*
>(ptr),
8267 (events != NULL) ? (cl_uint)events->size() : 0,
8268 (events != NULL && events->size() > 0) ? (cl_event*)&events->front() : NULL,
8269 (event != NULL) ? &tmp : NULL),
8270 __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
8272 if (event != NULL && err == CL_SUCCESS)
8282 template<
typename T,
class D>
8284 cl::pointer<T, D> &ptr,
8285 const vector<Event>* events = NULL,
8286 Event* event = NULL)
const
8289 cl_int err = detail::errHandler(
8290 ::clEnqueueSVMUnmap(
8291 object_,
static_cast<void*
>(ptr.get()),
8292 (events != NULL) ? (cl_uint)events->size() : 0,
8293 (events != NULL && events->size() > 0) ? (cl_event*)&events->front() : NULL,
8294 (event != NULL) ? &tmp : NULL),
8295 __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
8297 if (event != NULL && err == CL_SUCCESS)
8307 template<
typename T,
class Alloc>
8309 cl::vector<T, Alloc> &container,
8310 const vector<Event>* events = NULL,
8311 Event* event = NULL)
const
8314 cl_int err = detail::errHandler(
8315 ::clEnqueueSVMUnmap(
8316 object_,
static_cast<void*
>(container.data()),
8317 (events != NULL) ? (cl_uint)events->size() : 0,
8318 (events != NULL && events->size() > 0) ? (cl_event*)&events->front() : NULL,
8319 (event != NULL) ? &tmp : NULL),
8320 __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
8322 if (event != NULL && err == CL_SUCCESS)
8327 #endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 200
8329 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
8342 const vector<Event> *events = 0,
8343 Event *event = 0)
const
8346 cl_int err = detail::errHandler(
8347 ::clEnqueueMarkerWithWaitList(
8349 (events != NULL) ? (cl_uint) events->size() : 0,
8350 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
8351 (event != NULL) ? &tmp : NULL),
8352 __ENQUEUE_MARKER_WAIT_LIST_ERR);
8354 if (event != NULL && err == CL_SUCCESS)
8372 const vector<Event> *events = 0,
8373 Event *event = 0)
const
8376 cl_int err = detail::errHandler(
8377 ::clEnqueueBarrierWithWaitList(
8379 (events != NULL) ? (cl_uint) events->size() : 0,
8380 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
8381 (event != NULL) ? &tmp : NULL),
8382 __ENQUEUE_BARRIER_WAIT_LIST_ERR);
8384 if (event != NULL && err == CL_SUCCESS)
8395 const vector<Memory> &memObjects,
8396 cl_mem_migration_flags flags,
8397 const vector<Event>* events = NULL,
8403 vector<cl_mem> localMemObjects(memObjects.size());
8405 for(
int i = 0; i < (int)memObjects.size(); ++i ) {
8406 localMemObjects[i] = memObjects[i]();
8409 cl_int err = detail::errHandler(
8410 ::clEnqueueMigrateMemObjects(
8412 (cl_uint)memObjects.size(),
8413 localMemObjects.data(),
8415 (events != NULL) ? (cl_uint) events->size() : 0,
8416 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
8417 (event != NULL) ? &tmp : NULL),
8418 __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
8420 if (event != NULL && err == CL_SUCCESS)
8425 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
8428 #if CL_HPP_TARGET_OPENCL_VERSION >= 210
8434 template<
typename T>
8436 const cl::vector<T*> &svmRawPointers,
8437 const cl::vector<size_type> &sizes,
8438 cl_mem_migration_flags flags = 0,
8439 const vector<Event>* events = NULL,
8440 Event* event = NULL)
const
8443 cl_int err = detail::errHandler(::clEnqueueSVMMigrateMem(
8445 svmRawPointers.size(),
static_cast<void**
>(svmRawPointers.data()),
8448 (events != NULL) ? (cl_uint)events->size() : 0,
8449 (events != NULL && events->size() > 0) ? (cl_event*)&events->front() : NULL,
8450 (event != NULL) ? &tmp : NULL),
8451 __ENQUEUE_MIGRATE_SVM_ERR);
8453 if (event != NULL && err == CL_SUCCESS)
8463 template<
typename T>
8465 const cl::vector<T*> &svmRawPointers,
8466 cl_mem_migration_flags flags = 0,
8467 const vector<Event>* events = NULL,
8468 Event* event = NULL)
const
8470 return enqueueMigrateSVM(svmRawPointers, cl::vector<size_type>(svmRawPointers.size()), flags, events, event);
8479 template<
typename T,
class D>
8481 const cl::vector<cl::pointer<T, D>> &svmPointers,
8482 const cl::vector<size_type> &sizes,
8483 cl_mem_migration_flags flags = 0,
8484 const vector<Event>* events = NULL,
8485 Event* event = NULL)
const
8487 cl::vector<void*> svmRawPointers;
8488 svmRawPointers.reserve(svmPointers.size());
8489 for (
auto p : svmPointers) {
8490 svmRawPointers.push_back(
static_cast<void*
>(p.get()));
8501 template<
typename T,
class D>
8503 const cl::vector<cl::pointer<T, D>> &svmPointers,
8504 cl_mem_migration_flags flags = 0,
8505 const vector<Event>* events = NULL,
8506 Event* event = NULL)
const
8508 return enqueueMigrateSVM(svmPointers, cl::vector<size_type>(svmPointers.size()), flags, events, event);
8516 template<
typename T,
class Alloc>
8518 const cl::vector<cl::vector<T, Alloc>> &svmContainers,
8519 const cl::vector<size_type> &sizes,
8520 cl_mem_migration_flags flags = 0,
8521 const vector<Event>* events = NULL,
8522 Event* event = NULL)
const
8524 cl::vector<void*> svmRawPointers;
8525 svmRawPointers.reserve(svmContainers.size());
8526 for (
auto p : svmContainers) {
8527 svmRawPointers.push_back(
static_cast<void*
>(p.data()));
8537 template<
typename T,
class Alloc>
8539 const cl::vector<cl::vector<T, Alloc>> &svmContainers,
8540 cl_mem_migration_flags flags = 0,
8541 const vector<Event>* events = NULL,
8542 Event* event = NULL)
const
8544 return enqueueMigrateSVM(svmContainers, cl::vector<size_type>(svmContainers.size()), flags, events, event);
8547 #endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 210
8549 cl_int enqueueNDRangeKernel(
8553 const NDRange& local = NullRange,
8554 const vector<Event>* events = NULL,
8555 Event* event = NULL)
const
8558 cl_int err = detail::errHandler(
8559 ::clEnqueueNDRangeKernel(
8560 object_, kernel(), (cl_uint) global.
dimensions(),
8561 offset.
dimensions() != 0 ? (
const size_type*) offset : NULL,
8562 (
const size_type*) global,
8563 local.dimensions() != 0 ? (
const size_type*) local : NULL,
8564 (events != NULL) ? (cl_uint) events->size() : 0,
8565 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
8566 (event != NULL) ? &tmp : NULL),
8567 __ENQUEUE_NDRANGE_KERNEL_ERR);
8569 if (event != NULL && err == CL_SUCCESS)
8575 #if defined(CL_USE_DEPRECATED_OPENCL_1_2_APIS)
8576 CL_EXT_PREFIX__VERSION_1_2_DEPRECATED cl_int enqueueTask(
8577 const Kernel& kernel,
8578 const vector<Event>* events = NULL,
8579 Event* event = NULL)
const CL_EXT_SUFFIX__VERSION_1_2_DEPRECATED
8582 cl_int err = detail::errHandler(
8585 (events != NULL) ? (cl_uint) events->size() : 0,
8586 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
8587 (event != NULL) ? &tmp : NULL),
8588 __ENQUEUE_TASK_ERR);
8590 if (event != NULL && err == CL_SUCCESS)
8595 #endif // #if defined(CL_USE_DEPRECATED_OPENCL_1_2_APIS)
8597 cl_int enqueueNativeKernel(
8598 void (CL_CALLBACK *userFptr)(
void *),
8599 std::pair<void*, size_type> args,
8600 const vector<Memory>* mem_objects = NULL,
8601 const vector<const void*>* mem_locs = NULL,
8602 const vector<Event>* events = NULL,
8603 Event* event = NULL)
const
8605 size_type elements = 0;
8606 if (mem_objects != NULL) {
8607 elements = mem_objects->size();
8609 vector<cl_mem> mems(elements);
8610 for (
unsigned int i = 0; i < elements; i++) {
8611 mems[i] = ((*mem_objects)[i])();
8615 cl_int err = detail::errHandler(
8616 ::clEnqueueNativeKernel(
8617 object_, userFptr, args.first, args.second,
8618 (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
8620 (mem_locs != NULL && mem_locs->size() > 0) ? (
const void **) &mem_locs->front() : NULL,
8621 (events != NULL) ? (cl_uint) events->size() : 0,
8622 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
8623 (event != NULL) ? &tmp : NULL),
8624 __ENQUEUE_NATIVE_KERNEL);
8626 if (event != NULL && err == CL_SUCCESS)
8635 #if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
8636 CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
8640 cl_int err = detail::errHandler(
8643 (event != NULL) ? &tmp : NULL),
8644 __ENQUEUE_MARKER_ERR);
8646 if (event != NULL && err == CL_SUCCESS)
8652 CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
8653 cl_int enqueueWaitForEvents(
const vector<Event>& events)
const CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
8655 return detail::errHandler(
8656 ::clEnqueueWaitForEvents(
8658 (cl_uint) events.size(),
8659 events.size() > 0 ? (
const cl_event*) &events.front() : NULL),
8660 __ENQUEUE_WAIT_FOR_EVENTS_ERR);
8662 #endif // defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
8664 cl_int enqueueAcquireGLObjects(
8665 const vector<Memory>* mem_objects = NULL,
8666 const vector<Event>* events = NULL,
8667 Event* event = NULL)
const
8670 cl_int err = detail::errHandler(
8671 ::clEnqueueAcquireGLObjects(
8673 (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
8674 (mem_objects != NULL && mem_objects->size() > 0) ? (
const cl_mem *) &mem_objects->front(): NULL,
8675 (events != NULL) ? (cl_uint) events->size() : 0,
8676 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
8677 (event != NULL) ? &tmp : NULL),
8678 __ENQUEUE_ACQUIRE_GL_ERR);
8680 if (event != NULL && err == CL_SUCCESS)
8686 cl_int enqueueReleaseGLObjects(
8687 const vector<Memory>* mem_objects = NULL,
8688 const vector<Event>* events = NULL,
8689 Event* event = NULL)
const
8692 cl_int err = detail::errHandler(
8693 ::clEnqueueReleaseGLObjects(
8695 (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
8696 (mem_objects != NULL && mem_objects->size() > 0) ? (
const cl_mem *) &mem_objects->front(): NULL,
8697 (events != NULL) ? (cl_uint) events->size() : 0,
8698 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
8699 (event != NULL) ? &tmp : NULL),
8700 __ENQUEUE_RELEASE_GL_ERR);
8702 if (event != NULL && err == CL_SUCCESS)
8708 #if defined (CL_HPP_USE_DX_INTEROP)
8709 typedef CL_API_ENTRY cl_int (CL_API_CALL *PFN_clEnqueueAcquireD3D10ObjectsKHR)(
8710 cl_command_queue command_queue, cl_uint num_objects,
8711 const cl_mem* mem_objects, cl_uint num_events_in_wait_list,
8712 const cl_event* event_wait_list, cl_event* event);
8713 typedef CL_API_ENTRY cl_int (CL_API_CALL *PFN_clEnqueueReleaseD3D10ObjectsKHR)(
8714 cl_command_queue command_queue, cl_uint num_objects,
8715 const cl_mem* mem_objects, cl_uint num_events_in_wait_list,
8716 const cl_event* event_wait_list, cl_event* event);
8718 cl_int enqueueAcquireD3D10Objects(
8719 const vector<Memory>* mem_objects = NULL,
8720 const vector<Event>* events = NULL,
8721 Event* event = NULL)
const
8723 static PFN_clEnqueueAcquireD3D10ObjectsKHR pfn_clEnqueueAcquireD3D10ObjectsKHR = NULL;
8724 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
8725 cl_context context = getInfo<CL_QUEUE_CONTEXT>();
8726 cl::Device device(getInfo<CL_QUEUE_DEVICE>());
8727 cl_platform_id platform = device.getInfo<CL_DEVICE_PLATFORM>();
8728 CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_(platform, clEnqueueAcquireD3D10ObjectsKHR);
8730 #if CL_HPP_TARGET_OPENCL_VERSION >= 110
8731 CL_HPP_INIT_CL_EXT_FCN_PTR_(clEnqueueAcquireD3D10ObjectsKHR);
8735 cl_int err = detail::errHandler(
8736 pfn_clEnqueueAcquireD3D10ObjectsKHR(
8738 (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
8739 (mem_objects != NULL && mem_objects->size() > 0) ? (
const cl_mem *) &mem_objects->front(): NULL,
8740 (events != NULL) ? (cl_uint) events->size() : 0,
8741 (events != NULL) ? (cl_event*) &events->front() : NULL,
8742 (event != NULL) ? &tmp : NULL),
8743 __ENQUEUE_ACQUIRE_GL_ERR);
8745 if (event != NULL && err == CL_SUCCESS)
8751 cl_int enqueueReleaseD3D10Objects(
8752 const vector<Memory>* mem_objects = NULL,
8753 const vector<Event>* events = NULL,
8754 Event* event = NULL)
const
8756 static PFN_clEnqueueReleaseD3D10ObjectsKHR pfn_clEnqueueReleaseD3D10ObjectsKHR = NULL;
8757 #if CL_HPP_TARGET_OPENCL_VERSION >= 120
8758 cl_context context = getInfo<CL_QUEUE_CONTEXT>();
8759 cl::Device device(getInfo<CL_QUEUE_DEVICE>());
8760 cl_platform_id platform = device.getInfo<CL_DEVICE_PLATFORM>();
8761 CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_(platform, clEnqueueReleaseD3D10ObjectsKHR);
8762 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
8763 #if CL_HPP_TARGET_OPENCL_VERSION >= 110
8764 CL_HPP_INIT_CL_EXT_FCN_PTR_(clEnqueueReleaseD3D10ObjectsKHR);
8765 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 110
8768 cl_int err = detail::errHandler(
8769 pfn_clEnqueueReleaseD3D10ObjectsKHR(
8771 (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
8772 (mem_objects != NULL && mem_objects->size() > 0) ? (
const cl_mem *) &mem_objects->front(): NULL,
8773 (events != NULL) ? (cl_uint) events->size() : 0,
8774 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
8775 (event != NULL) ? &tmp : NULL),
8776 __ENQUEUE_RELEASE_GL_ERR);
8778 if (event != NULL && err == CL_SUCCESS)
8788 #if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
8789 CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
8792 return detail::errHandler(
8793 ::clEnqueueBarrier(object_),
8794 __ENQUEUE_BARRIER_ERR);
8796 #endif // CL_USE_DEPRECATED_OPENCL_1_1_APIS
8798 cl_int flush()
const
8800 return detail::errHandler(::clFlush(object_), __FLUSH_ERR);
8803 cl_int finish()
const
8805 return detail::errHandler(::clFinish(object_), __FINISH_ERR);
8809 CL_HPP_DEFINE_STATIC_MEMBER_ std::once_flag CommandQueue::default_initialized_;
8810 CL_HPP_DEFINE_STATIC_MEMBER_ CommandQueue CommandQueue::default_;
8811 CL_HPP_DEFINE_STATIC_MEMBER_ cl_int CommandQueue::default_error_ = CL_SUCCESS;
8814 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
8815 enum class DeviceQueueProperties : cl_command_queue_properties
8818 Profiling = CL_QUEUE_PROFILING_ENABLE,
8821 inline DeviceQueueProperties operator|(DeviceQueueProperties lhs, DeviceQueueProperties rhs)
8823 return static_cast<DeviceQueueProperties
>(
static_cast<cl_command_queue_properties
>(lhs) |
static_cast<cl_command_queue_properties
>(rhs));
8847 cl_command_queue_properties mergedProperties =
8848 CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE |
static_cast<cl_command_queue_properties
>(properties);
8850 cl_queue_properties queue_properties[] = {
8851 CL_QUEUE_PROPERTIES, mergedProperties, 0 };
8852 object_ = ::clCreateCommandQueueWithProperties(
8853 context(), device(), queue_properties, &error);
8855 detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
8867 DeviceQueueProperties properties = DeviceQueueProperties::None,
8872 cl_command_queue_properties mergedProperties =
8873 CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE |
static_cast<cl_command_queue_properties
>(properties);
8874 cl_queue_properties queue_properties[] = {
8875 CL_QUEUE_PROPERTIES, mergedProperties, 0 };
8876 object_ = ::clCreateCommandQueueWithProperties(
8877 context(), device(), queue_properties, &error);
8879 detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
8892 DeviceQueueProperties properties = DeviceQueueProperties::None,
8897 cl_command_queue_properties mergedProperties =
8898 CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE |
static_cast<cl_command_queue_properties
>(properties);
8899 cl_queue_properties queue_properties[] = {
8900 CL_QUEUE_PROPERTIES, mergedProperties,
8901 CL_QUEUE_SIZE, queueSize,
8903 object_ = ::clCreateCommandQueueWithProperties(
8904 context(), device(), queue_properties, &error);
8906 detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
8919 detail::Wrapper<cl_type>(commandQueue, retainObject) { }
8955 template <
typename T>
8956 cl_int getInfo(cl_command_queue_info name, T* param)
const
8958 return detail::errHandler(
8960 &::clGetCommandQueueInfo, object_, name, param),
8961 __GET_COMMAND_QUEUE_INFO_ERR);
8964 template <cl_command_queue_info name>
typename
8965 detail::param_traits<detail::cl_command_queue_info, name>::param_type
8966 getInfo(cl_int* err = NULL)
const
8968 typename detail::param_traits<
8969 detail::cl_command_queue_info, name>::param_type param;
8970 cl_int result = getInfo(name, ¶m);
8984 cl_int *err =
nullptr)
8990 cl_command_queue_properties properties =
8991 CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE | CL_QUEUE_ON_DEVICE_DEFAULT;
8992 cl_queue_properties queue_properties[] = {
8993 CL_QUEUE_PROPERTIES, properties,
8996 ::clCreateCommandQueueWithProperties(
8997 context(), device(), queue_properties, &error));
8999 detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
9014 const Context &context,
const Device &device, cl_int *err =
nullptr)
9018 cl_command_queue_properties properties =
9019 CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE | CL_QUEUE_ON_DEVICE_DEFAULT;
9020 cl_queue_properties queue_properties[] = {
9021 CL_QUEUE_PROPERTIES, properties,
9024 ::clCreateCommandQueueWithProperties(
9025 context(), device(), queue_properties, &error));
9027 detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
9042 const Context &context,
const Device &device, cl_uint queueSize, cl_int *err =
nullptr)
9046 cl_command_queue_properties properties =
9047 CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE | CL_QUEUE_ON_DEVICE_DEFAULT;
9048 cl_queue_properties queue_properties[] = {
9049 CL_QUEUE_PROPERTIES, properties,
9050 CL_QUEUE_SIZE, queueSize,
9053 ::clCreateCommandQueueWithProperties(
9054 context(), device(), queue_properties, &error));
9056 detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
9066 #if CL_HPP_TARGET_OPENCL_VERSION >= 210
9076 error = clSetDefaultDeviceCommandQueue(context.get(), device.get(), default_queue.get());
9078 detail::errHandler(error, __SET_DEFAULT_DEVICE_COMMAND_QUEUE_ERR);
9082 return default_queue;
9090 return queue.getInfo<CL_QUEUE_DEVICE_DEFAULT>(err);
9093 #endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 210
9107 #endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 200
9110 template<
typename IteratorType >
9113 IteratorType startIterator,
9114 IteratorType endIterator,
9119 typedef typename std::iterator_traits<IteratorType>::value_type DataType;
9122 cl_mem_flags flags = 0;
9124 flags |= CL_MEM_READ_ONLY;
9127 flags |= CL_MEM_READ_WRITE;
9130 flags |= CL_MEM_USE_HOST_PTR;
9133 size_type size =
sizeof(DataType)*(endIterator - startIterator);
9136 object_ = ::clCreateBuffer(context(), flags, size,
static_cast<DataType*
>(&*startIterator), &error);
9138 object_ = ::clCreateBuffer(context(), flags, size, 0, &error);
9141 detail::errHandler(error, __CREATE_BUFFER_ERR);
9148 detail::errHandler(error, __CREATE_BUFFER_ERR);
9153 error =
cl::copy(queue, startIterator, endIterator, *
this);
9154 detail::errHandler(error, __CREATE_BUFFER_ERR);
9161 template<
typename IteratorType >
9164 IteratorType startIterator,
9165 IteratorType endIterator,
9170 typedef typename std::iterator_traits<IteratorType>::value_type DataType;
9173 cl_mem_flags flags = 0;
9175 flags |= CL_MEM_READ_ONLY;
9178 flags |= CL_MEM_READ_WRITE;
9181 flags |= CL_MEM_USE_HOST_PTR;
9184 size_type size =
sizeof(DataType)*(endIterator - startIterator);
9186 Context context = queue.getInfo<CL_QUEUE_CONTEXT>();
9189 object_ = ::clCreateBuffer(context(), flags, size,
static_cast<DataType*
>(&*startIterator), &error);
9192 object_ = ::clCreateBuffer(context(), flags, size, 0, &error);
9195 detail::errHandler(error, __CREATE_BUFFER_ERR);
9201 error =
cl::copy(queue, startIterator, endIterator, *
this);
9202 detail::errHandler(error, __CREATE_BUFFER_ERR);
9209 inline cl_int enqueueReadBuffer(
9215 const vector<Event>* events = NULL,
9216 Event* event = NULL)
9221 if (error != CL_SUCCESS) {
9225 return queue.enqueueReadBuffer(buffer, blocking, offset, size, ptr, events, event);
9228 inline cl_int enqueueWriteBuffer(
9229 const Buffer& buffer,
9234 const vector<Event>* events = NULL,
9235 Event* event = NULL)
9238 CommandQueue queue = CommandQueue::getDefault(&error);
9240 if (error != CL_SUCCESS) {
9244 return queue.enqueueWriteBuffer(buffer, blocking, offset, size, ptr, events, event);
9247 inline void* enqueueMapBuffer(
9248 const Buffer& buffer,
9253 const vector<Event>* events = NULL,
9254 Event* event = NULL,
9258 CommandQueue queue = CommandQueue::getDefault(&error);
9259 detail::errHandler(error, __ENQUEUE_MAP_BUFFER_ERR);
9264 void * result = ::clEnqueueMapBuffer(
9265 queue(), buffer(), blocking, flags, offset, size,
9266 (events != NULL) ? (cl_uint) events->size() : 0,
9267 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
9271 detail::errHandler(error, __ENQUEUE_MAP_BUFFER_ERR);
9279 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
9285 template<
typename T>
9291 const vector<Event>* events,
9296 if (error != CL_SUCCESS) {
9297 return detail::errHandler(error, __ENQUEUE_MAP_BUFFER_ERR);
9301 ptr, blocking, flags, size, events, event);
9309 template<
typename T,
class D>
9311 cl::pointer<T, D> ptr,
9315 const vector<Event>* events = NULL,
9316 Event* event = NULL)
9320 if (error != CL_SUCCESS) {
9321 return detail::errHandler(error, __ENQUEUE_MAP_BUFFER_ERR);
9325 ptr, blocking, flags, size, events, event);
9333 template<
typename T,
class Alloc>
9335 cl::vector<T, Alloc> container,
9338 const vector<Event>* events = NULL,
9339 Event* event = NULL)
9343 if (error != CL_SUCCESS) {
9344 return detail::errHandler(error, __ENQUEUE_MAP_BUFFER_ERR);
9348 container, blocking, flags, events, event);
9351 #endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 200
9353 inline cl_int enqueueUnmapMemObject(
9354 const Memory& memory,
9356 const vector<Event>* events = NULL,
9357 Event* event = NULL)
9360 CommandQueue queue = CommandQueue::getDefault(&error);
9361 detail::errHandler(error, __ENQUEUE_MAP_BUFFER_ERR);
9362 if (error != CL_SUCCESS) {
9367 cl_int err = detail::errHandler(
9368 ::clEnqueueUnmapMemObject(
9369 queue(), memory(), mapped_ptr,
9370 (events != NULL) ? (cl_uint)events->size() : 0,
9371 (events != NULL && events->size() > 0) ? (cl_event*)&events->front() : NULL,
9372 (event != NULL) ? &tmp : NULL),
9373 __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
9375 if (event != NULL && err == CL_SUCCESS)
9381 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
9387 template<
typename T>
9390 const vector<Event>* events = NULL,
9391 Event* event = NULL)
9395 if (error != CL_SUCCESS) {
9396 return detail::errHandler(error, __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
9400 __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
9409 template<
typename T,
class D>
9411 cl::pointer<T, D> &ptr,
9412 const vector<Event>* events = NULL,
9413 Event* event = NULL)
9417 if (error != CL_SUCCESS) {
9418 return detail::errHandler(error, __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
9422 __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
9430 template<
typename T,
class Alloc>
9432 cl::vector<T, Alloc> &container,
9433 const vector<Event>* events = NULL,
9434 Event* event = NULL)
9438 if (error != CL_SUCCESS) {
9439 return detail::errHandler(error, __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
9442 return detail::errHandler(queue.
enqueueUnmapSVM(container, events, event),
9443 __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
9446 #endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 200
9448 inline cl_int enqueueCopyBuffer(
9451 size_type src_offset,
9452 size_type dst_offset,
9454 const vector<Event>* events = NULL,
9455 Event* event = NULL)
9458 CommandQueue queue = CommandQueue::getDefault(&error);
9460 if (error != CL_SUCCESS) {
9464 return queue.enqueueCopyBuffer(src, dst, src_offset, dst_offset, size, events, event);
9472 template<
typename IteratorType >
9473 inline cl_int
copy( IteratorType startIterator, IteratorType endIterator,
cl::Buffer &buffer )
9477 if (error != CL_SUCCESS)
9480 return cl::copy(queue, startIterator, endIterator, buffer);
9488 template<
typename IteratorType >
9489 inline cl_int
copy(
const cl::Buffer &buffer, IteratorType startIterator, IteratorType endIterator )
9493 if (error != CL_SUCCESS)
9496 return cl::copy(queue, buffer, startIterator, endIterator);
9504 template<
typename IteratorType >
9507 typedef typename std::iterator_traits<IteratorType>::value_type DataType;
9510 size_type length = endIterator-startIterator;
9511 size_type byteLength = length*
sizeof(DataType);
9514 static_cast<DataType*
>(queue.enqueueMapBuffer(buffer, CL_TRUE, CL_MAP_WRITE, 0, byteLength, 0, 0, &error));
9516 if( error != CL_SUCCESS ) {
9519 #if defined(_MSC_VER)
9523 stdext::checked_array_iterator<DataType*>(
9526 std::copy(startIterator, endIterator, pointer);
9529 error = queue.enqueueUnmapMemObject(buffer, pointer, 0, &endEvent);
9531 if( error != CL_SUCCESS ) {
9543 template<
typename IteratorType >
9546 typedef typename std::iterator_traits<IteratorType>::value_type DataType;
9549 size_type length = endIterator-startIterator;
9550 size_type byteLength = length*
sizeof(DataType);
9553 static_cast<DataType*
>(queue.enqueueMapBuffer(buffer, CL_TRUE, CL_MAP_READ, 0, byteLength, 0, 0, &error));
9555 if( error != CL_SUCCESS ) {
9558 std::copy(pointer, pointer + length, startIterator);
9560 error = queue.enqueueUnmapMemObject(buffer, pointer, 0, &endEvent);
9562 if( error != CL_SUCCESS ) {
9570 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
9574 template<
typename T,
class Alloc>
9575 inline cl_int
mapSVM(cl::vector<T, Alloc> &container)
9577 return enqueueMapSVM(container, CL_TRUE, CL_MAP_READ | CL_MAP_WRITE);
9583 template<
typename T,
class Alloc>
9584 inline cl_int
unmapSVM(cl::vector<T, Alloc> &container)
9589 #endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 200
9591 #if CL_HPP_TARGET_OPENCL_VERSION >= 110
9592 inline cl_int enqueueReadBufferRect(
9593 const Buffer& buffer,
9595 const array<size_type, 3>& buffer_offset,
9596 const array<size_type, 3>& host_offset,
9597 const array<size_type, 3>& region,
9598 size_type buffer_row_pitch,
9599 size_type buffer_slice_pitch,
9600 size_type host_row_pitch,
9601 size_type host_slice_pitch,
9603 const vector<Event>* events = NULL,
9604 Event* event = NULL)
9607 CommandQueue queue = CommandQueue::getDefault(&error);
9609 if (error != CL_SUCCESS) {
9613 return queue.enqueueReadBufferRect(
9628 inline cl_int enqueueWriteBufferRect(
9629 const Buffer& buffer,
9631 const array<size_type, 3>& buffer_offset,
9632 const array<size_type, 3>& host_offset,
9633 const array<size_type, 3>& region,
9634 size_type buffer_row_pitch,
9635 size_type buffer_slice_pitch,
9636 size_type host_row_pitch,
9637 size_type host_slice_pitch,
9639 const vector<Event>* events = NULL,
9640 Event* event = NULL)
9643 CommandQueue queue = CommandQueue::getDefault(&error);
9645 if (error != CL_SUCCESS) {
9649 return queue.enqueueWriteBufferRect(
9664 inline cl_int enqueueCopyBufferRect(
9667 const array<size_type, 3>& src_origin,
9668 const array<size_type, 3>& dst_origin,
9669 const array<size_type, 3>& region,
9670 size_type src_row_pitch,
9671 size_type src_slice_pitch,
9672 size_type dst_row_pitch,
9673 size_type dst_slice_pitch,
9674 const vector<Event>* events = NULL,
9675 Event* event = NULL)
9678 CommandQueue queue = CommandQueue::getDefault(&error);
9680 if (error != CL_SUCCESS) {
9684 return queue.enqueueCopyBufferRect(
9697 #endif // CL_HPP_TARGET_OPENCL_VERSION >= 110
9699 inline cl_int enqueueReadImage(
9702 const array<size_type, 3>& origin,
9703 const array<size_type, 3>& region,
9704 size_type row_pitch,
9705 size_type slice_pitch,
9707 const vector<Event>* events = NULL,
9708 Event* event = NULL)
9711 CommandQueue queue = CommandQueue::getDefault(&error);
9713 if (error != CL_SUCCESS) {
9717 return queue.enqueueReadImage(
9729 inline cl_int enqueueWriteImage(
9732 const array<size_type, 3>& origin,
9733 const array<size_type, 3>& region,
9734 size_type row_pitch,
9735 size_type slice_pitch,
9737 const vector<Event>* events = NULL,
9738 Event* event = NULL)
9741 CommandQueue queue = CommandQueue::getDefault(&error);
9743 if (error != CL_SUCCESS) {
9747 return queue.enqueueWriteImage(
9759 inline cl_int enqueueCopyImage(
9762 const array<size_type, 3>& src_origin,
9763 const array<size_type, 3>& dst_origin,
9764 const array<size_type, 3>& region,
9765 const vector<Event>* events = NULL,
9766 Event* event = NULL)
9769 CommandQueue queue = CommandQueue::getDefault(&error);
9771 if (error != CL_SUCCESS) {
9775 return queue.enqueueCopyImage(
9785 inline cl_int enqueueCopyImageToBuffer(
9788 const array<size_type, 3>& src_origin,
9789 const array<size_type, 3>& region,
9790 size_type dst_offset,
9791 const vector<Event>* events = NULL,
9792 Event* event = NULL)
9795 CommandQueue queue = CommandQueue::getDefault(&error);
9797 if (error != CL_SUCCESS) {
9801 return queue.enqueueCopyImageToBuffer(
9811 inline cl_int enqueueCopyBufferToImage(
9814 size_type src_offset,
9815 const array<size_type, 3>& dst_origin,
9816 const array<size_type, 3>& region,
9817 const vector<Event>* events = NULL,
9818 Event* event = NULL)
9821 CommandQueue queue = CommandQueue::getDefault(&error);
9823 if (error != CL_SUCCESS) {
9827 return queue.enqueueCopyBufferToImage(
9838 inline cl_int flush(
void)
9841 CommandQueue queue = CommandQueue::getDefault(&error);
9843 if (error != CL_SUCCESS) {
9847 return queue.flush();
9850 inline cl_int finish(
void)
9853 CommandQueue queue = CommandQueue::getDefault(&error);
9855 if (error != CL_SUCCESS) {
9860 return queue.finish();
9870 vector<Event> events_;
9872 template<
typename... Ts>
9877 queue_(CommandQueue::getDefault()),
9886 queue_(CommandQueue::getDefault()),
9895 queue_(CommandQueue::getDefault()),
9904 queue_(CommandQueue::getDefault()),
9909 events_.push_back(e);
9913 queue_(CommandQueue::getDefault()),
9918 events_.push_back(e);
9922 queue_(CommandQueue::getDefault()),
9927 events_.push_back(e);
9931 queue_(CommandQueue::getDefault()),
9941 queue_(CommandQueue::getDefault()),
9951 queue_(CommandQueue::getDefault()),
9993 events_.push_back(e);
10002 events_.push_back(e);
10011 events_.push_back(e);
10016 offset_(NullRange),
10026 offset_(NullRange),
10053 template<
typename... Ts>
10059 template<
int index,
typename T0,
typename... T1s>
10060 void setArgs(T0&& t0, T1s&&... t1s)
10062 kernel_.
setArg(index, t0);
10063 setArgs<index + 1, T1s...>(std::forward<T1s>(t1s)...);
10066 template<
int index,
typename T0>
10067 void setArgs(T0&& t0)
10069 kernel_.
setArg(index, t0);
10072 template<
int index>
10085 cl_int * err = NULL) :
10086 kernel_(program, name.c_str(), err)
10102 setArgs<0>(std::forward<Ts>(ts)...);
10104 args.queue_.enqueueNDRangeKernel(
10127 setArgs<0>(std::forward<Ts>(ts)...);
10129 error = args.queue_.enqueueNDRangeKernel(
10140 #if CL_HPP_TARGET_OPENCL_VERSION >= 200
10141 cl_int setSVMPointers(
const vector<void*> &pointerList)
10146 template<
typename T0,
typename... T1s>
10147 cl_int setSVMPointers(
const T0 &t0, T1s &... ts)
10151 #endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 200
10159 namespace compatibility {
10164 template<
typename... Ts>
10174 cl_int * err = NULL) :
10196 enqueueArgs, args...);
10204 #undef CL_HPP_ERR_STR_
10205 #if !defined(CL_HPP_USER_OVERRIDE_ERROR_STRINGS)
10206 #undef __GET_DEVICE_INFO_ERR
10207 #undef __GET_PLATFORM_INFO_ERR
10208 #undef __GET_DEVICE_IDS_ERR
10209 #undef __GET_PLATFORM_IDS_ERR
10210 #undef __GET_CONTEXT_INFO_ERR
10211 #undef __GET_EVENT_INFO_ERR
10212 #undef __GET_EVENT_PROFILE_INFO_ERR
10213 #undef __GET_MEM_OBJECT_INFO_ERR
10214 #undef __GET_IMAGE_INFO_ERR
10215 #undef __GET_SAMPLER_INFO_ERR
10216 #undef __GET_KERNEL_INFO_ERR
10217 #undef __GET_KERNEL_ARG_INFO_ERR
10218 #undef __GET_KERNEL_SUB_GROUP_INFO_ERR
10219 #undef __GET_KERNEL_WORK_GROUP_INFO_ERR
10220 #undef __GET_PROGRAM_INFO_ERR
10221 #undef __GET_PROGRAM_BUILD_INFO_ERR
10222 #undef __GET_COMMAND_QUEUE_INFO_ERR
10223 #undef __CREATE_CONTEXT_ERR
10224 #undef __CREATE_CONTEXT_FROM_TYPE_ERR
10225 #undef __GET_SUPPORTED_IMAGE_FORMATS_ERR
10226 #undef __CREATE_BUFFER_ERR
10228 #undef __CREATE_SUBBUFFER_ERR
10229 #undef __CREATE_GL_BUFFER_ERR
10230 #undef __CREATE_GL_RENDER_BUFFER_ERR
10231 #undef __GET_GL_OBJECT_INFO_ERR
10232 #undef __CREATE_IMAGE_ERR
10233 #undef __CREATE_GL_TEXTURE_ERR
10234 #undef __IMAGE_DIMENSION_ERR
10235 #undef __SET_MEM_OBJECT_DESTRUCTOR_CALLBACK_ERR
10236 #undef __CREATE_USER_EVENT_ERR
10237 #undef __SET_USER_EVENT_STATUS_ERR
10238 #undef __SET_EVENT_CALLBACK_ERR
10239 #undef __WAIT_FOR_EVENTS_ERR
10240 #undef __CREATE_KERNEL_ERR
10241 #undef __SET_KERNEL_ARGS_ERR
10242 #undef __CREATE_PROGRAM_WITH_SOURCE_ERR
10243 #undef __CREATE_PROGRAM_WITH_IL_ERR
10244 #undef __CREATE_PROGRAM_WITH_BINARY_ERR
10245 #undef __CREATE_PROGRAM_WITH_IL_ERR
10246 #undef __CREATE_PROGRAM_WITH_BUILT_IN_KERNELS_ERR
10247 #undef __BUILD_PROGRAM_ERR
10248 #undef __COMPILE_PROGRAM_ERR
10249 #undef __LINK_PROGRAM_ERR
10250 #undef __CREATE_KERNELS_IN_PROGRAM_ERR
10251 #undef __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR
10252 #undef __CREATE_SAMPLER_WITH_PROPERTIES_ERR
10253 #undef __SET_COMMAND_QUEUE_PROPERTY_ERR
10254 #undef __ENQUEUE_READ_BUFFER_ERR
10255 #undef __ENQUEUE_READ_BUFFER_RECT_ERR
10256 #undef __ENQUEUE_WRITE_BUFFER_ERR
10257 #undef __ENQUEUE_WRITE_BUFFER_RECT_ERR
10258 #undef __ENQEUE_COPY_BUFFER_ERR
10259 #undef __ENQEUE_COPY_BUFFER_RECT_ERR
10260 #undef __ENQUEUE_FILL_BUFFER_ERR
10261 #undef __ENQUEUE_READ_IMAGE_ERR
10262 #undef __ENQUEUE_WRITE_IMAGE_ERR
10263 #undef __ENQUEUE_COPY_IMAGE_ERR
10264 #undef __ENQUEUE_FILL_IMAGE_ERR
10265 #undef __ENQUEUE_COPY_IMAGE_TO_BUFFER_ERR
10266 #undef __ENQUEUE_COPY_BUFFER_TO_IMAGE_ERR
10267 #undef __ENQUEUE_MAP_BUFFER_ERR
10268 #undef __ENQUEUE_MAP_IMAGE_ERR
10269 #undef __ENQUEUE_UNMAP_MEM_OBJECT_ERR
10270 #undef __ENQUEUE_NDRANGE_KERNEL_ERR
10271 #undef __ENQUEUE_NATIVE_KERNEL
10272 #undef __ENQUEUE_MIGRATE_MEM_OBJECTS_ERR
10273 #undef __ENQUEUE_MIGRATE_SVM_ERR
10274 #undef __ENQUEUE_ACQUIRE_GL_ERR
10275 #undef __ENQUEUE_RELEASE_GL_ERR
10276 #undef __CREATE_PIPE_ERR
10277 #undef __GET_PIPE_INFO_ERR
10278 #undef __RETAIN_ERR
10279 #undef __RELEASE_ERR
10281 #undef __FINISH_ERR
10282 #undef __VECTOR_CAPACITY_ERR
10283 #undef __CREATE_SUB_DEVICES_ERR
10284 #undef __CREATE_SUB_DEVICES_ERR
10285 #undef __ENQUEUE_MARKER_ERR
10286 #undef __ENQUEUE_WAIT_FOR_EVENTS_ERR
10287 #undef __ENQUEUE_BARRIER_ERR
10288 #undef __UNLOAD_COMPILER_ERR
10289 #undef __CREATE_GL_TEXTURE_2D_ERR
10290 #undef __CREATE_GL_TEXTURE_3D_ERR
10291 #undef __CREATE_IMAGE2D_ERR
10292 #undef __CREATE_IMAGE3D_ERR
10293 #undef __CREATE_COMMAND_QUEUE_ERR
10294 #undef __ENQUEUE_TASK_ERR
10295 #undef __CREATE_SAMPLER_ERR
10296 #undef __ENQUEUE_MARKER_WAIT_LIST_ERR
10297 #undef __ENQUEUE_BARRIER_WAIT_LIST_ERR
10298 #undef __CLONE_KERNEL_ERR
10299 #undef __GET_HOST_TIMER_ERR
10300 #undef __GET_DEVICE_AND_HOST_TIMER_ERR
10302 #endif //CL_HPP_USER_OVERRIDE_ERROR_STRINGS
10305 #undef CL_HPP_INIT_CL_EXT_FCN_PTR_
10306 #undef CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_
10308 #if defined(CL_HPP_USE_CL_DEVICE_FISSION)
10309 #undef CL_HPP_PARAM_NAME_DEVICE_FISSION_
10310 #endif // CL_HPP_USE_CL_DEVICE_FISSION
10312 #undef CL_HPP_NOEXCEPT_
10313 #undef CL_HPP_DEFINE_STATIC_MEMBER_