From 3c02fefec53f21d9fad537ff0d62d8dcc8162466 Mon Sep 17 00:00:00 2001 From: Eugene Zhulenev Date: Wed, 22 Apr 2020 19:55:01 +0000 Subject: Add async evaluation support to TensorSlicingOp. Device::memcpy is not async-safe and might lead to deadlocks. Always evaluate slice expression in async mode. --- unsupported/Eigen/CXX11/src/Tensor/TensorMorphing.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'unsupported') diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorMorphing.h b/unsupported/Eigen/CXX11/src/Tensor/TensorMorphing.h index 879a67ea4..d04dcae17 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorMorphing.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorMorphing.h @@ -559,6 +559,14 @@ struct TensorEvaluator, Devi } return true; } + +#ifdef EIGEN_USE_THREADS + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalSubExprsIfNeededAsync( + EvaluatorPointerType data, EvalSubExprsCallback done) { + m_impl.evalSubExprsIfNeededAsync(nullptr, [done](bool) { done(true); }); + } +#endif // EIGEN_USE_THREADS EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void cleanup() { m_impl.cleanup(); -- cgit v1.2.3