diff options
author | Eugene Zhulenev <eugene.zhulenev@gmail.com> | 2020-04-22 19:55:01 +0000 |
---|---|---|
committer | Eugene Zhulenev <eugene.zhulenev@gmail.com> | 2020-04-22 19:55:01 +0000 |
commit | 3c02fefec53f21d9fad537ff0d62d8dcc8162466 (patch) | |
tree | 2dd673a79bfa74ffb33e364cd9e96aac1ff78aac /unsupported/Eigen/CXX11 | |
parent | 0c67b855d288ad792a9546e1a26a33bc261fb2d7 (diff) |
Add async evaluation support to TensorSlicingOp.
Device::memcpy is not async-safe and might lead to deadlocks. Always evaluate slice expression in async mode.
Diffstat (limited to 'unsupported/Eigen/CXX11')
-rw-r--r-- | unsupported/Eigen/CXX11/src/Tensor/TensorMorphing.h | 8 |
1 files changed, 8 insertions, 0 deletions
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<const TensorSlicingOp<StartIndices, Sizes, ArgType>, Devi } return true; } + +#ifdef EIGEN_USE_THREADS + template <typename EvalSubExprsCallback> + 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(); |