diff options
author | Mehdi Goli <mehdi.goli@codeplay.com> | 2016-10-14 12:09:55 +0100 |
---|---|---|
committer | Mehdi Goli <mehdi.goli@codeplay.com> | 2016-10-14 12:09:55 +0100 |
commit | 524fa4c46f8c5c1bc01f7754188e6883f669a543 (patch) | |
tree | 4e52325e02ed13d361cb28db86a2b6c255aea6e3 /Eigen/Core | |
parent | d7f9679a34ef991fa3c9da8f61510d6c48aaa19c (diff) |
Reducing the code by generalising sycl backend functions/structs.
Diffstat (limited to 'Eigen/Core')
-rw-r--r-- | Eigen/Core | 65 |
1 files changed, 20 insertions, 45 deletions
diff --git a/Eigen/Core b/Eigen/Core index ed007dfa9..53cb72c95 100644 --- a/Eigen/Core +++ b/Eigen/Core @@ -11,46 +11,8 @@ #ifndef EIGEN_CORE_H #define EIGEN_CORE_H -// first thing Eigen does: stop the compiler from committing suicide -#include "src/Core/util/DisableStupidWarnings.h" - -// Handle NVCC/CUDA -#ifdef __CUDACC__ - // Do not try asserts on CUDA! - #ifndef EIGEN_NO_DEBUG - #define EIGEN_NO_DEBUG - #endif - - #ifdef EIGEN_INTERNAL_DEBUGGING - #undef EIGEN_INTERNAL_DEBUGGING - #endif - - // Do not try to vectorize on CUDA! - #ifndef EIGEN_DONT_VECTORIZE - #define EIGEN_DONT_VECTORIZE - #endif - - #ifdef EIGEN_EXCEPTIONS - #undef EIGEN_EXCEPTIONS - #endif - - // All functions callable from CUDA code must be qualified with __device__ - #define EIGEN_DEVICE_FUNC __host__ __device__ - -#else - #define EIGEN_DEVICE_FUNC - -#endif - -// When compiling CUDA device code with NVCC, pull in math functions from the -// global namespace. In host mode, and when device doee with clang, use the -// std versions. -#if defined(__CUDA_ARCH__) && defined(__NVCC__) - #define EIGEN_USING_STD_MATH(FUNC) using ::FUNC; -#else - #define EIGEN_USING_STD_MATH(FUNC) using std::FUNC; -#endif +/// This will no longer be needed after the next release of the computecppCE #ifdef EIGEN_USE_SYCL #undef min #undef max @@ -60,9 +22,9 @@ #include <SYCL/sycl.hpp> #endif -// We need these predefines to determine if asserts need to be disabled for the device compiler -#if defined(__SYCL_DEVICE_ONLY__) - // Do not try asserts on SYCL! +// Handle NVCC/CUDA/SYCL +#if defined(__CUDACC__) || defined(__SYCL_DEVICE_ONLY__) + // Do not try asserts on CUDA and SYCL! #ifndef EIGEN_NO_DEBUG #define EIGEN_NO_DEBUG #endif @@ -71,7 +33,7 @@ #undef EIGEN_INTERNAL_DEBUGGING #endif - // Do not try to vectorize on SYCL! + // Do not try to vectorize on CUDA and SYCL! #ifndef EIGEN_DONT_VECTORIZE #define EIGEN_DONT_VECTORIZE #endif @@ -80,12 +42,25 @@ #undef EIGEN_EXCEPTIONS #endif + // All functions callable from CUDA code must be qualified with __device__ + #ifdef __CUDACC__ + #define EIGEN_DEVICE_FUNC __host__ __device__ + // For Sycl we dont need that + #else + #define EIGEN_DEVICE_FUNC + #endif +#else #define EIGEN_DEVICE_FUNC #endif -#if (defined(_CPPUNWIND) || defined(__EXCEPTIONS)) && !defined(__CUDA_ARCH__) && !defined(EIGEN_EXCEPTIONS) && !defined(EIGEN_USE_SYCL) - #define EIGEN_EXCEPTIONS +// When compiling CUDA device code with NVCC, pull in math functions from the +// global namespace. In host mode, and when device doee with clang, use the +// std versions. +#if defined(__CUDA_ARCH__) && defined(__NVCC__) + #define EIGEN_USING_STD_MATH(FUNC) using ::FUNC; +#else + #define EIGEN_USING_STD_MATH(FUNC) using std::FUNC; #endif #ifdef EIGEN_EXCEPTIONS |