diff options
Diffstat (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorForwardDeclarations.h')
-rw-r--r-- | unsupported/Eigen/CXX11/src/Tensor/TensorForwardDeclarations.h | 46 |
1 files changed, 42 insertions, 4 deletions
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<GpuDevice, Expression> { TensorEvaluator<Expression, GpuDevice>::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 <typename Device, typename Expression> 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<Expression, Device>::BlockAccess && - TensorEvaluator<Expression, Device>::PreferBlockAccess; + static const bool BlockAccess = + TensorEvaluator<Expression, Device>::BlockAccess && + TensorEvaluator<Expression, Device>::PreferBlockAccess; + + static const bool BlockAccessV2 = + TensorEvaluator<Expression, Device>::BlockAccessV2 && + TensorEvaluator<Expression, Device>::PreferBlockAccess; + + + static const TiledEvaluation value = + BlockAccessV2 + ? TiledEvaluation::On + : (BlockAccess ? TiledEvaluation::Legacy : TiledEvaluation::Off); }; +#if EIGEN_HAS_CXX11 +template <typename Expression, typename Device, + bool Vectorizable = IsVectorizable<Device, Expression>::value, + TiledEvaluation Tiling = IsTileable<Device, Expression>::value> +class TensorExecutor; +#else template <typename Expression, typename Device, bool Vectorizable = IsVectorizable<Device, Expression>::value, - bool Tileable = IsTileable<Device, Expression>::value> + TiledEvaluation::TiledEvaluation Tiling = IsTileable<Device, Expression>::value> class TensorExecutor; +#endif +// TODO(ezhulenev): Add TiledEvaluation support to async executor. template <typename Expression, typename Device, typename DoneCallback, bool Vectorizable = IsVectorizable<Device, Expression>::value, - bool Tileable = IsTileable<Device, Expression>::value> + bool Tileable = IsTileable<Device, Expression>::BlockAccess> class TensorAsyncExecutor; } // end namespace internal |