From cb81975714a96ecb2faf33ca242feeee3543b1db Mon Sep 17 00:00:00 2001 From: Luke Iwanski Date: Mon, 19 Sep 2016 12:44:13 +0100 Subject: Partial OpenCL support via SYCL compatible with ComputeCpp CE. --- .../CXX11/src/Tensor/TensorSyclPlaceHolderExpr.h | 293 +++++++++++++++++++++ 1 file changed, 293 insertions(+) create mode 100644 unsupported/Eigen/CXX11/src/Tensor/TensorSyclPlaceHolderExpr.h (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorSyclPlaceHolderExpr.h') diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorSyclPlaceHolderExpr.h b/unsupported/Eigen/CXX11/src/Tensor/TensorSyclPlaceHolderExpr.h new file mode 100644 index 000000000..dbd7a8544 --- /dev/null +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorSyclPlaceHolderExpr.h @@ -0,0 +1,293 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Mehdi Goli Codeplay Software Ltd. +// Ralph Potter Codeplay Software Ltd. +// Luke Iwanski Codeplay Software Ltd. +// Contact: +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +/***************************************************************** + * TensorSyclPlaceHolderExpr.h + * + * \brief: + * This is the specialisation of the placeholder expression based on the + * operation type + * +*****************************************************************/ + +#ifndef UNSUPPORTED_EIGEN_CXX11_SRC_TENSORYSYCL_PLACEHOLDER_EXPR_HPP +#define UNSUPPORTED_EIGEN_CXX11_SRC_TENSORYSYCL_PLACEHOLDER_EXPR_HPP + +namespace Eigen { +namespace TensorSycl { +namespace internal { +/// \sttruct PlaceHolderExpression +/// \brief it is used to create the PlaceHolder expression. The PlaceHolder +/// expression is a copy of expression type in which the TensorMap of the has +/// been replaced with PlaceHolder. +template +struct PlaceHolderExpression; + +/// specialisation of the \ref PlaceHolderExpression when the node is TensorMap +template class MakePointer_, size_t N> +struct PlaceHolderExpression< + Eigen::TensorMap, + Options2_, MakePointer_>, + N> { + using Type = Eigen::internal::PlaceHolder< + Eigen::TensorMap, + Options2_, MakePointer_>, + N>; +}; + +/// specialisation of the \ref PlaceHolderExpression when the node is const +/// TensorMap +template class MakePointer_, size_t N> +struct PlaceHolderExpression< + const Eigen::TensorMap, + Options2_, MakePointer_>, + N> { + using Type = const Eigen::internal::PlaceHolder< + const TensorMap, + Options2_, MakePointer_>, + N>; +}; + +/// specialisation of the \ref PlaceHolderExpression when the node is +/// TensorCwiseNullaryOp +template +struct PlaceHolderExpression, N> { + using RHSPlaceHolderType = typename PlaceHolderExpression::Type; + using Type = TensorCwiseNullaryOp; +}; + +/// specialisation of the \ref PlaceHolderExpression when the node is const +/// TensorCwiseNullaryOp +template +struct PlaceHolderExpression, N> { + using RHSPlaceHolderType = typename PlaceHolderExpression::Type; + using Type = const TensorCwiseNullaryOp; +}; + +/// specialisation of the \ref PlaceHolderExpression when the node is +/// TensorBroadcastingOp +template +struct PlaceHolderExpression, N> { + using RHSPlaceHolderType = typename PlaceHolderExpression::Type; + using Type = TensorBroadcastingOp; +}; + +/// specialisation of the \ref PlaceHolderExpression when the node is const +/// TensorBroadcastingOp +template +struct PlaceHolderExpression, N> { + using RHSPlaceHolderType = typename PlaceHolderExpression::Type; + using Type = const TensorBroadcastingOp; +}; + +/// specialisation of the \ref PlaceHolderExpression when the node is +/// TensorCwiseUnaryOp +template +struct PlaceHolderExpression, N> { + using RHSPlaceHolderType = typename PlaceHolderExpression::Type; + using Type = TensorCwiseUnaryOp; +}; + +/// specialisation of the \ref PlaceHolderExpression when the node is const +/// TensorCwiseUnaryOp +template +struct PlaceHolderExpression, N> { + using RHSPlaceHolderType = typename PlaceHolderExpression::Type; + using Type = const TensorCwiseUnaryOp; +}; + +/// specialisation of the \ref PlaceHolderExpression when the node is +/// TensorCwiseBinaryOp +template +struct PlaceHolderExpression, N> { + static const size_t RHSLeafCount = LeafCount::Count; + + using LHSPlaceHolderType = + typename PlaceHolderExpression::Type; + using RHSPlaceHolderType = typename PlaceHolderExpression::Type; + + using Type = TensorCwiseBinaryOp; +}; + +/// specialisation of the \ref PlaceHolderExpression when the node is const +/// TensorCwiseBinaryOp +template +struct PlaceHolderExpression, + N> { + static const size_t RHSLeafCount = LeafCount::Count; + + using LHSPlaceHolderType = + typename PlaceHolderExpression::Type; + using RHSPlaceHolderType = typename PlaceHolderExpression::Type; + + using Type = + const TensorCwiseBinaryOp; +}; + +/// specialisation of the \ref PlaceHolderExpression when the node is const +/// TensorCwiseSelectOp +template +struct PlaceHolderExpression< + const TensorCwiseTernaryOp, N> { + static const size_t Arg3LeafCount = LeafCount::Count; + static const size_t Arg2LeafCount = LeafCount::Count; + + using Arg1PlaceHolderType = + typename PlaceHolderExpression::Type; + using Arg2PlaceHolderType = + typename PlaceHolderExpression::Type; + + using Arg3PlaceHolderType = typename PlaceHolderExpression::Type; + + using Type = + const TensorCwiseTernaryOp; +}; + +/// specialisation of the \ref PlaceHolderExpression when the node is +/// TensorCwiseSelectOp +template +struct PlaceHolderExpression< + TensorCwiseTernaryOp, N> { + static const size_t Arg3LeafCount = LeafCount::Count; + static const size_t Arg2LeafCount = LeafCount::Count; + + using Arg1PlaceHolderType = + typename PlaceHolderExpression::Type; + using Arg2PlaceHolderType = + typename PlaceHolderExpression::Type; + + using Arg3PlaceHolderType = typename PlaceHolderExpression::Type; + + using Type = TensorCwiseTernaryOp; +}; + +/// specialisation of the \ref PlaceHolderExpression when the node is const +/// TensorCwiseSelectOp +template +struct PlaceHolderExpression, + N> { + static const size_t ElseLeafCount = LeafCount::Count; + static const size_t ThenLeafCount = LeafCount::Count; + + using IfPlaceHolderType = + typename PlaceHolderExpression::Type; + using ThenPlaceHolderType = + typename PlaceHolderExpression::Type; + + using ElsePlaceHolderType = typename PlaceHolderExpression::Type; + + using Type = const TensorSelectOp; +}; + +/// specialisation of the \ref PlaceHolderExpression when the node is +/// TensorCwiseSelectOp +template +struct PlaceHolderExpression, N> { + static const size_t ElseLeafCount = LeafCount::Count; + static const size_t ThenLeafCount = LeafCount::Count; + + using IfPlaceHolderType = + typename PlaceHolderExpression::Type; + using ThenPlaceHolderType = + typename PlaceHolderExpression::Type; + + using ElsePlaceHolderType = typename PlaceHolderExpression::Type; + + using Type = TensorSelectOp; +}; + +/// specialisation of the \ref PlaceHolderExpression when the node is +/// TensorAssignOp +template +struct PlaceHolderExpression, N> { + static const size_t RHSLeafCount = LeafCount::Count; + + using LHSPlaceHolderType = + typename PlaceHolderExpression::Type; + using RHSPlaceHolderType = typename PlaceHolderExpression::Type; + + using Type = TensorAssignOp; +}; + +/// specialisation of the \ref PlaceHolderExpression when the node is const +/// TensorAssignOp +template +struct PlaceHolderExpression, N> { + static const size_t RHSLeafCount = LeafCount::Count; + + using LHSPlaceHolderType = + typename PlaceHolderExpression::Type; + using RHSPlaceHolderType = typename PlaceHolderExpression::Type; + + using Type = const TensorAssignOp; +}; + +/// specialisation of the \ref PlaceHolderExpression when the node is const +/// TensorForcedEvalOp +template +struct PlaceHolderExpression, N> { + using Type = + const Eigen::internal::PlaceHolder, N>; +}; + +/// specialisation of the \ref PlaceHolderExpression when the node is +/// TensorForcedEvalOp +template +struct PlaceHolderExpression, N> { + using Type = Eigen::internal::PlaceHolder, N>; +}; + +/// specialisation of the \ref PlaceHolderExpression when the node is const +/// TensorEvalToOp +template +struct PlaceHolderExpression, N> { + static const size_t RHSLeafCount = LeafCount::Count; + + using RHSPlaceHolderType = typename PlaceHolderExpression::Type; + + using Type = const TensorEvalToOp; +}; + +/// specialisation of the \ref PlaceHolderExpression when the node is +/// TensorEvalToOp +template +struct PlaceHolderExpression, N> { + static const size_t RHSLeafCount = LeafCount::Count; + + using RHSPlaceHolderType = typename PlaceHolderExpression::Type; + + using Type = TensorEvalToOp; +}; + +/// template deduction for \ref PlaceHolderExpression struct +template +struct createPlaceHolderExpression { + static const size_t TotalLeaves = LeafCount::Count; + using Type = typename PlaceHolderExpression::Type; +}; +} +} +} // namespace Eigen + +#endif // UNSUPPORTED_EIGEN_CXX11_SRC_TENSORYSYCL_PLACEHOLDER_EXPR_HPP -- cgit v1.2.3