Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of gr-peach-opencv-project-sd-card by
opencl_svm.hpp
00001 /* See LICENSE file in the root OpenCV directory */ 00002 00003 #ifndef __OPENCV_CORE_OPENCL_SVM_HPP__ 00004 #define __OPENCV_CORE_OPENCL_SVM_HPP__ 00005 00006 // 00007 // Internal usage only (binary compatibility is not guaranteed) 00008 // 00009 #ifndef __OPENCV_BUILD 00010 #error Internal header file 00011 #endif 00012 00013 #if defined(HAVE_OPENCL) && defined(HAVE_OPENCL_SVM) 00014 #include "runtime/opencl_core.hpp" 00015 #include "runtime/opencl_svm_20.hpp" 00016 #include "runtime/opencl_svm_hsa_extension.hpp" 00017 00018 namespace cv { namespace ocl { namespace svm { 00019 00020 struct SVMCapabilities 00021 { 00022 enum Value 00023 { 00024 SVM_COARSE_GRAIN_BUFFER = (1 << 0), 00025 SVM_FINE_GRAIN_BUFFER = (1 << 1), 00026 SVM_FINE_GRAIN_SYSTEM = (1 << 2), 00027 SVM_ATOMICS = (1 << 3), 00028 }; 00029 int value_; 00030 00031 SVMCapabilities(int capabilities = 0) : value_(capabilities) { } 00032 operator int() const { return value_; } 00033 00034 inline bool isNoSVMSupport() const { return value_ == 0; } 00035 inline bool isSupportCoarseGrainBuffer() const { return (value_ & SVM_COARSE_GRAIN_BUFFER) != 0; } 00036 inline bool isSupportFineGrainBuffer() const { return (value_ & SVM_FINE_GRAIN_BUFFER) != 0; } 00037 inline bool isSupportFineGrainSystem() const { return (value_ & SVM_FINE_GRAIN_SYSTEM) != 0; } 00038 inline bool isSupportAtomics() const { return (value_ & SVM_ATOMICS) != 0; } 00039 }; 00040 00041 CV_EXPORTS const SVMCapabilities getSVMCapabilitites(const ocl::Context& context); 00042 00043 struct SVMFunctions 00044 { 00045 clSVMAllocAMD_fn fn_clSVMAlloc; 00046 clSVMFreeAMD_fn fn_clSVMFree; 00047 clSetKernelArgSVMPointerAMD_fn fn_clSetKernelArgSVMPointer; 00048 //clSetKernelExecInfoAMD_fn fn_clSetKernelExecInfo; 00049 //clEnqueueSVMFreeAMD_fn fn_clEnqueueSVMFree; 00050 clEnqueueSVMMemcpyAMD_fn fn_clEnqueueSVMMemcpy; 00051 clEnqueueSVMMemFillAMD_fn fn_clEnqueueSVMMemFill; 00052 clEnqueueSVMMapAMD_fn fn_clEnqueueSVMMap; 00053 clEnqueueSVMUnmapAMD_fn fn_clEnqueueSVMUnmap; 00054 00055 inline SVMFunctions() 00056 : fn_clSVMAlloc(NULL), fn_clSVMFree(NULL), 00057 fn_clSetKernelArgSVMPointer(NULL), /*fn_clSetKernelExecInfo(NULL),*/ 00058 /*fn_clEnqueueSVMFree(NULL),*/ fn_clEnqueueSVMMemcpy(NULL), fn_clEnqueueSVMMemFill(NULL), 00059 fn_clEnqueueSVMMap(NULL), fn_clEnqueueSVMUnmap(NULL) 00060 { 00061 // nothing 00062 } 00063 00064 inline bool isValid() const 00065 { 00066 return fn_clSVMAlloc != NULL && fn_clSVMFree && fn_clSetKernelArgSVMPointer && 00067 /*fn_clSetKernelExecInfo && fn_clEnqueueSVMFree &&*/ fn_clEnqueueSVMMemcpy && 00068 fn_clEnqueueSVMMemFill && fn_clEnqueueSVMMap && fn_clEnqueueSVMUnmap; 00069 } 00070 }; 00071 00072 // We should guarantee that SVMFunctions lifetime is not less than context's lifetime 00073 CV_EXPORTS const SVMFunctions* getSVMFunctions(const ocl::Context& context); 00074 00075 CV_EXPORTS bool useSVM(UMatUsageFlags usageFlags); 00076 00077 }}} //namespace cv::ocl::svm 00078 #endif 00079 00080 #endif // __OPENCV_CORE_OPENCL_SVM_HPP__ 00081 /* End of file. */ 00082
Generated on Tue Jul 12 2022 14:47:31 by
1.7.2
