diff options
author | Eugene Zhulenev <ezhulenev@google.com> | 2019-09-24 12:52:45 -0700 |
---|---|---|
committer | Eugene Zhulenev <ezhulenev@google.com> | 2019-09-24 12:52:45 -0700 |
commit | ef9dfee7bdc8e0d82c9b7ddf9414ef99d866d7ba (patch) | |
tree | 490a8ae1f247cf226475f504ea1d3ab305b98097 /unsupported/Eigen/CXX11/src/Tensor/TensorForwardDeclarations.h | |
parent | efd9867ff0e8df23016ac6c9828d0d7bf8bec1b1 (diff) |
Tensor block evaluation V2 support for unary/binary/broadcsting
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 |