aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported
diff options
context:
space:
mode:
authorGravatar Benjamin Barenblat <bbaren@google.com>2021-07-07 17:12:12 -0400
committerGravatar Benjamin Barenblat <bbaren@google.com>2021-07-07 17:14:08 -0400
commit27e7fd18f1c337c409f2a567697b27bcd0c09f8b (patch)
tree5ff36982295b5c6c528a26d87e950af015656cde /unsupported
parenta59cf78c8d197e2892ec11985a07c98c362e1600 (diff)
Support manually disabling exceptionsHEADmaster
Rename EIGEN_EXCEPTIONS to EIGEN_USE_EXCEPTIONS, and allow disabling exceptions with -DEIGEN_USE_EXCEPTIONS=0.
Diffstat (limited to 'unsupported')
-rw-r--r--unsupported/Eigen/CXX11/src/Tensor/TensorDeviceSycl.h6
-rw-r--r--unsupported/test/cxx11_maxsizevector.cpp10
2 files changed, 8 insertions, 8 deletions
diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceSycl.h b/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceSycl.h
index df591c21d..3ccac604f 100644
--- a/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceSycl.h
+++ b/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceSycl.h
@@ -506,7 +506,7 @@ class QueueInterface {
EIGEN_STRONG_INLINE void synchronize() const {
-#ifdef EIGEN_EXCEPTIONS
+#if EIGEN_USE_EXCEPTIONS
m_queue.wait_and_throw();
#else
m_queue.wait();
@@ -749,7 +749,7 @@ class QueueInterface {
set_latest_event(e);
if (callback) {
auto callback_ = [=]() {
-#ifdef EIGEN_EXCEPTIONS
+#if EIGEN_USE_EXCEPTIONS
cl::sycl::event(e).wait_and_throw();
#else
cl::sycl::event(e).wait();
@@ -758,7 +758,7 @@ class QueueInterface {
};
m_thread_pool.Schedule(std::move(callback_));
} else {
-#ifdef EIGEN_EXCEPTIONS
+#if EIGEN_USE_EXCEPTIONS
m_queue.wait_and_throw();
#else
m_queue.wait();
diff --git a/unsupported/test/cxx11_maxsizevector.cpp b/unsupported/test/cxx11_maxsizevector.cpp
index 46b689a8e..24064c4ee 100644
--- a/unsupported/test/cxx11_maxsizevector.cpp
+++ b/unsupported/test/cxx11_maxsizevector.cpp
@@ -12,7 +12,7 @@ struct Foo
Foo(int x=0) : dummy(x)
{
-#ifdef EIGEN_EXCEPTIONS
+#if EIGEN_USE_EXCEPTIONS
// TODO: Is this the correct way to handle this?
if (Foo::object_count > Foo::object_limit) { std::cout << "\nThrow!\n"; throw Foo::Fail(); }
#endif
@@ -50,17 +50,17 @@ EIGEN_DECLARE_TEST(cxx11_maxsizevector)
Foo::object_limit = internal::random<Index>(0, rows - 2);
std::cout << "object_limit = " << Foo::object_limit << std::endl;
bool exception_raised = false;
-#ifdef EIGEN_EXCEPTIONS
- try
+ EIGEN_TRY
{
-#endif
std::cout << "\nVectorX m(" << rows << ");\n";
VectorX vect(rows);
for(int i=0; i<rows; ++i)
vect.push_back(Foo());
-#ifdef EIGEN_EXCEPTIONS
+#if EIGEN_USE_EXCEPTIONS
VERIFY(false); // not reached if exceptions are enabled
+#endif
}
+#if EIGEN_USE_EXCEPTIONS
catch (const Foo::Fail&) { exception_raised = true; }
VERIFY(exception_raised);
#endif