From ef9dfee7bdc8e0d82c9b7ddf9414ef99d866d7ba Mon Sep 17 00:00:00 2001 From: Eugene Zhulenev Date: Tue, 24 Sep 2019 12:52:45 -0700 Subject: Tensor block evaluation V2 support for unary/binary/broadcsting --- .../CXX11/src/Tensor/TensorForwardDeclarations.h | 46 ++++++++++++++++++++-- 1 file changed, 42 insertions(+), 4 deletions(-) (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorForwardDeclarations.h') diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorForwardDeclarations.h b/unsupported/Eigen/CXX11/src/Tensor/TensorForwardDeclarations.h index 772dbbe35..f33489a33 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorForwardDeclarations.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorForwardDeclarations.h @@ -154,23 +154,61 @@ struct IsVectorizable { TensorEvaluator::IsAligned; }; +// Tiled evaluation strategy. +#if !EIGEN_HAS_CXX11 +// To be able to use `TiledEvaluation::Off` in C++03 we need a namespace. +// (Use of enumeration in a nested name specifier is a c++11 extension). +namespace TiledEvaluation { +#endif +enum TiledEvaluation { + Off = 0, // tiled evaluation is not supported + On = 1, // still work in progress (see TensorBlockV2.h) + Legacy = 2 // soon to be deprecated (see TensorBock.h) +}; +#if !EIGEN_HAS_CXX11 +} // namespace TiledEvaluation +#endif + template struct IsTileable { +#if !EIGEN_HAS_CXX11 + typedef TiledEvaluation::TiledEvaluation TiledEvaluation; +#endif + // Check that block evaluation is supported and it's a preferred option (at // least one sub-expression has much faster block evaluation, e.g. // broadcasting). - static const bool value = TensorEvaluator::BlockAccess && - TensorEvaluator::PreferBlockAccess; + static const bool BlockAccess = + TensorEvaluator::BlockAccess && + TensorEvaluator::PreferBlockAccess; + + static const bool BlockAccessV2 = + TensorEvaluator::BlockAccessV2 && + TensorEvaluator::PreferBlockAccess; + + + static const TiledEvaluation value = + BlockAccessV2 + ? TiledEvaluation::On + : (BlockAccess ? TiledEvaluation::Legacy : TiledEvaluation::Off); }; +#if EIGEN_HAS_CXX11 +template ::value, + TiledEvaluation Tiling = IsTileable::value> +class TensorExecutor; +#else template ::value, - bool Tileable = IsTileable::value> + TiledEvaluation::TiledEvaluation Tiling = IsTileable::value> class TensorExecutor; +#endif +// TODO(ezhulenev): Add TiledEvaluation support to async executor. template ::value, - bool Tileable = IsTileable::value> + bool Tileable = IsTileable::BlockAccess> class TensorAsyncExecutor; } // end namespace internal -- cgit v1.2.3