From 9ea490c82c2603c6185c06e993943099b287a405 Mon Sep 17 00:00:00 2001 From: Mehdi Goli Date: Mon, 1 Jul 2019 16:27:28 +0100 Subject: [SYCL] : * Modifying TensorDeviceSYCL to use `EIGEN_THROW_X`. * Modifying TensorMacro to use `EIGEN_TRY/CATCH(X)` macro. * Modifying TensorReverse.h to use `EIGEN_DEVICE_REF` instead of `&`. * Fixing the SYCL device macro in SpecialFunctionsImpl.h. --- unsupported/Eigen/CXX11/src/Tensor/TensorMacros.h | 24 ++++++++++------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorMacros.h') diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorMacros.h b/unsupported/Eigen/CXX11/src/Tensor/TensorMacros.h index 3d859f42d..af9e5db70 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorMacros.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorMacros.h @@ -67,20 +67,16 @@ #endif // Define a macro for catching SYCL exceptions if exceptions are enabled -#if defined(EIGEN_EXCEPTIONS) - #define EIGEN_SYCL_TRY_CATCH(X) \ - do { \ - try { X; } \ - catch(const cl::sycl::exception& e) { \ - std::cerr << "SYCL exception at " \ - << __FILE__ << ":" << __LINE__ << std::endl \ - << e.what() << std::endl; \ - std::rethrow_exception(std::current_exception()); \ - } \ - } while (false) -#else - #define EIGEN_SYCL_TRY_CATCH(X) X -#endif +#define EIGEN_SYCL_TRY_CATCH(X) \ + do { \ + EIGEN_TRY {X;} \ + EIGEN_CATCH(const cl::sycl::exception& e) { \ + EIGEN_THROW_X(std::runtime_error("SYCL exception at " + \ + std::string(__FILE__) + ":" + \ + std::to_string(__LINE__) + "\n" + \ + e.what())); \ + } \ + } while (false) // Define a macro if local memory flags are unset or one of them is set // Setting both flags is the same as unsetting them -- cgit v1.2.3