1 // This file is part of OpenCV project. 2 // It is subject to the license terms in the LICENSE file found in the top-level directory 3 // of this distribution and at http://opencv.org/license.html. 4 5 #ifndef OPENCV_DNN_SRC_CUDA_MEMORY_HPP 6 #define OPENCV_DNN_SRC_CUDA_MEMORY_HPP 7 8 #include <cuda_runtime.h> 9 10 namespace cv { namespace dnn { namespace cuda4dnn { namespace csl { namespace device { 11 12 template <class T> load_ldg(const T & src)13__device__ T load_ldg(const T& src) { 14 #if defined(__CUDA_ARCH__) && (__CUDA_ARCH__ >= 350) 15 return __ldg(&src); 16 #else 17 return src; 18 #endif 19 } 20 21 template <class T> load_ldg(const T * src)22__device__ T load_ldg(const T* src) { 23 #if defined(__CUDA_ARCH__) && (__CUDA_ARCH__ >= 350) 24 return __ldg(src); 25 #else 26 return *src; 27 #endif 28 } 29 30 }}}}} /* namespace cv::dnn::cuda4dnn::csl::device */ 31 32 #endif /* OPENCV_DNN_SRC_CUDA_MEMORY_HPP */ 33