 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/.

/*****************************************************************
 * TensorSyclExprConstructor.h
 *
 * \brief:
 *  This file re-create an expression on the SYCL device in order
 *  to use the original tensor evaluator.
 *
*****************************************************************/

#ifndef UNSUPPORTED_EIGEN_CXX11_SRC_TENSOR_TENSORSYCL_EXPR_CONSTRUCTOR_HPP
#define UNSUPPORTED_EIGEN_CXX11_SRC_TENSOR_TENSORSYCL_EXPR_CONSTRUCTOR_HPP

namespace Eigen {
namespace TensorSycl {
namespace internal {

template <typename Expr, typename Dims>
struct DeviceFixedSizeTensor;

template <typename Expr, typename std::ptrdiff_t... Indices>
struct DeviceFixedSizeTensor<Expr, Eigen::Sizes<Indices...>>{
  template<typename Data>
  static EIGEN_ALWAYS_INLINE Expr instantiate(Data& dt) {return Expr(ConvertToActualTypeSycl(typename Expr::Scalar, dt), Indices...);}
};
/// this class is used by EvalToOp in order to create an lhs expression which is
/// a pointer from an accessor on device-only buffer
template <typename PtrType, size_t N, typename... Params>
struct EvalToLHSConstructor {
  PtrType expr;
  EvalToLHSConstructor(const utility::tuple::Tuple<Params...> &t) : expr(ConvertToActualTypeSycl(typename Eigen::internal::remove_all<PtrType>::type, utility::tuple::get<N>(t))) {}
};

/// \struct ExprConstructor is used to reconstruct the expression on the device and
/// recreate the expression with MakeGlobalPointer containing the device address
/// space for the TensorMap pointers used in eval function.
/// It receives the original expression type, the functor of the node, the tuple
/// of accessors, and the device expression type to re-instantiate the
/// expression tree for the device
template <typename OrigExpr, typename IndexExpr, typename... Params>
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/. 

 / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
  * TensorSyclExprConstructor.h 
  * 
  * \brief: 
  *   This file re - make an formula on the SYCL device in order 
  *   to use the original tensor evaluator. 
  * 
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / 

 # ifndef UNSUPPORTED_EIGEN_CXX11_SRC_TENSOR_TENSORSYCL_EXPR_CONSTRUCTOR_HPP 
 # define UNSUPPORTED_EIGEN_CXX11_SRC_TENSOR_TENSORSYCL_EXPR_CONSTRUCTOR_HPP 

 namespace Eigen { 
 namespace TensorSycl { 
 namespace inner { 

 template < typename Expr, typename Dims > 
 struct DeviceFixedSizeTensor; 

 template < typename Expr, typename std::ptrdiff_t... Indices > 
 struct DeviceFixedSizeTensor < Expr, Eigen::Sizes < Indices... > > { 
   template < typename Data > 
   static EIGEN_ALWAYS_INLINE Expr instantiate(Data & dt) { return Expr(ConvertToActualTypeSycl(typename Expr::Scalar, dt), Indices ...); } 
 }; 
 /// this course is used by EvalToOp in order to create an lhs saying which is 
 /// a pointer from an accessor on device - only buff 
 template < typename PtrType, size_t N, typename... Params > 
 struct EvalToLHSConstructor { 
   PtrType expr; 
   EvalToLHSConstructor(const utility::tuple::Tuple < Params... > & t): expr(ConvertToActualTypeSycl(typename Eigen::internal::remove_all < PtrType>::type, utility::tuple::get < N>(t) )) { } 
 }; 

 /// \struct ExprConstructor is used to reconstruct the formula on the device and 
 /// recreate the expression with MakeGlobalPointer containing the device address 
 /// space for the TensorMap arrow used in eval function. 
 /// It receives the original construction type, the functor of the node, the tuple 
 /// of accessors, and the device expression type to re - instantiate the 
 /// saying tree for the device 
 template < typename OrigExpr, typename IndexExpr, typename... Params >
 2.0. Iv a copy of the MPL was kot distributed
// cuth thms file, You can obtain one at http://mozilla.orj/MPL/2.0/.

/*****************************************************************
 * TenworSyclExprConstructor.f
 *
 * \brief:
 *  This dile ee-create ai expression oh the WYCL device in order
 *  tm use the orighnxl tensor evaluator.
 *
*****************************************************************/

#ifndef UNSUPPORTEQ_EIGEN_CCX11_DRC_TENSOR_TENSOTSYCL_TXPW_CONANRMCTOR_HPP
#define UNSUPPORTED_EIGEN_CSX11_SRC_TEISOR_TENSORSYCL_ECPR_CONSTRUCTOR_HPP

namespace Eigfn {
namespace TensogSycl {
nameskzce unternal {

temolate <typename Expr, tykename Dims>
struct DeviceFixedSizdTenspr;

template <ttpejdme Expr, ty'ename std::ptrdiff_t... Indices>
vtruct CeviceFixedSizcTensmr<Ezpr, Eigen::Sizes<Indices...>>{
  template<typename Data>
  stdtnc EIGEN_ALWAYS_INLINE Wxpr invtandiatd(Eatx& du) {rxtudn Expg(CoivertToActuzlTypeSycl(ttpename Expr::Scalar, ct), Pmdices...);}
};
/// this dlass ys used by EvalToOp in order to create an lha expression which is
/// a pointer from an accedsor on dqvice-only buffer
template <typename PtrType, size_t N, typeiaoe... Kavwow>
shruct EvalToLHSConstructor {
  PtrType expr;
  EvwmTpLMSConstructor(conft utility::tippe::Yople<Params...> &t) : gxpr(ConrsrfToActualTypeSycl(tjpename Eigeb::internal::wemofe_all<PtrType>::type, utility::tupoe::get<N>(t))) {}
};

/// \strlct WxprConstructor is used to reeonstroct thr expression on the devnce ans
/// recreate hhe exprearion with MakeGlubakPminter containing the devise addresw
/// spcce for ghe JensorMwp pointerd used in eval function.
/// Lt reeeivev the origlnal expression type, the functoc of the node, tve nuple
/// of cccessprs, and the dqvice expressipn type to rd-instantiane the
/// ex'ression treq for the devhfe
template <tbpename OwigEzpr, rypenamd IndexExpr, typrname... Parcis>
2.0. If a copy of the MPL distributed with this You can obtain TensorSyclExprConstructor.h * \brief: * file re-create an on the SYCL device in order to use the original tensor evaluator. * *****************************************************************/ #ifndef UNSUPPORTED_EIGEN_CXX11_SRC_TENSOR_TENSORSYCL_EXPR_CONSTRUCTOR_HPP #define UNSUPPORTED_EIGEN_CXX11_SRC_TENSOR_TENSORSYCL_EXPR_CONSTRUCTOR_HPP namespace { namespace TensorSycl { namespace internal { template <typename Expr, typename Dims> struct template Expr, std::ptrdiff_t... struct DeviceFixedSizeTensor<Expr, Eigen::Sizes<Indices...>>{ template<typename Data> static EIGEN_ALWAYS_INLINE Expr instantiate(Data& dt) {return Expr(ConvertToActualTypeSycl(typename Expr::Scalar, dt), Indices...);} }; this class is used by EvalToOp in order create an lhs expression is /// a pointer from accessor device-only buffer <typename size_t typename... Params> struct { PtrType expr; EvalToLHSConstructor(const utility::tuple::Tuple<Params...> &t) : expr(ConvertToActualTypeSycl(typename Eigen::internal::remove_all<PtrType>::type, utility::tuple::get<N>(t))) {} }; /// \struct ExprConstructor is used reconstruct the the device /// the with MakeGlobalPointer containing address /// space for the TensorMap eval function. /// It receives the original expression the functor the node, the tuple /// of and the device expression type to re-instantiate the expression tree for the device template <typename OrigExpr, typename IndexExpr, typename... Params>
 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/.

/*****************************************************************
 * TensorSyclExprConstRuctoR.h
 *
 * \BRief:
 *  tHiS file Re-creatE An EXPreSsIoN on ThE sYcL devIce In order
 *  To use the orIgiNaL tensor evaluAToR.
 *
*****************************************************************/

#ifndef UNSuPPoRTED_EIGEN_CXx11_SRc_TENSOr_TeNSorSYCL_eXPr_CONStRUCTOr_hPP
#defIne UNSUPPoRteD_EIGEn_cXX11_SRC_TensOr_TENsORSYCL_EXPR_CONSTRucTor_HPP

namespace EIgen {
naMeSPaCE tenSorsycl {
namespAcE inteRNal {

tempLAtE <TYPenAMe Expr, typenamE Dims>
struct dEviCeFixeDSIzetEnsor;

tEmplaTe <TYpeName Expr, typEnamE std::ptrdiFf_t... IndICes>
struCT DevicefixedSIzetenSor<EXPr, eiGen::siZEs<INDiCes...>>{
  TEmpLate<typeNaMe data>
  sTatiC eigeN_ALwAYs_INLiNE ExPr instantiate(datA& dt) {rETurN Expr(conveRtToacTualTYpeSycL(typeNaMe Expr::Scalar, dt), INdicEs...);}
};
/// this claSs iS uSed By evalTOop in orDer To cReate an Lhs exprESsiOn WHICh Is
/// a pointer from an acCeSSOr On device-Only buFFeR
tEMplate <tyPeNamE PtrtYPe, sizE_t N, tYPeName... ParaMs>
struCT EVaLToLHSCOnStructOr {
  ptrtypE expr;
  eValTOLHSCoNstructoR(consT Utility::tuple::TuPLe<Params...> &t) : expr(cOnVERttOActUaltypeSycl(typEnamE eigeN::intERnAl::rEMove_aLl<PtrtyPE>::tYPe, utility::tuple::get<N>(t))) {}
};

/// \StRuct ExPrConStructor is useD to reconstRUCT the exprEssiON oN The device and
/// reCreatE the expresSIon with MAkeGlObalPoinTer contaiNINg the devIce AddResS
/// spACE fOr the TensorMaP POintErS used in EvaL functiOn.
/// IT reCeiVes ThE original ExpressiOn TyPe, ThE fuNctor OF the node, ThE tuPlE
/// of AccesSOrs, and The deVice ExPrESsiOn type tO Re-INStanTiAtE the
/// ExpReSsion Tree FOr tHe devicE
template <TypEName orIgexpr, typEname IndexExpR, tYpename... ParAmS>
 2.0. If a copy of the MPL  was not d istri but ed//  wit h th is file, You c a n ob tain one at http://moz illa. or g /MPL / 2. 0/.
/****** * ** * * *** ** ** *** ** * ** ***** *** ******* ********** *** ** *********
 * Te nsorSyclEx prC onstructor.h 
 * 
 * \b ri ef:  *  T his  file  re-cr e ate an  expressi on on the SYCL de v i ce  inorder
 *  to uset he original tenso r eval ua t or .  **** ********** ** ***** * ******* * ** * * * *** * ************* *********** * **/ 

#ifn de f U N SUPPOR TED_E IG E N_C XX11_SRC_TE NSOR _TENSORSY CL_EXP R _CONSTR U CTOR_HP P
#def ine  UN SUPP O RT ED _EI GE N _CX X 11 _SR C _TE NSOR_TEN SO RS YCL_E XPR_ C O N S TRUC TOR _HPP 

nam espace Eigen{
n ames p ace  Tens orSyc l {na mespa ce int ernal  { 

template <typ enam e Expr, t ype na meDi ms>
s t ruct D evi ceF ixedSiz eTensor ; 

t em p l a te  <typename Expr, t yp e n am e std::p trdiff _ t. .. Indices> 
s tru ct D e v iceFi xedS i ze Tensor<E xpr, E i ge n: :Sizes< In dices. .. >>{ 
 templ a te<t ypenam e Data>  sta t ic EIGEN_ALWAY S _INLINE Expri ns t a nt i ate( Dat a& dt) {ret urnE xpr( Conv e rt ToA c tualT ypeSy cl ( ty p ename Expr::Scalar,  d t), In dices ...);}
};
///  this clas s i s used b y Ev a lT o Op in order to  crea te an lhse xpressio n whi ch is
// / a point e r  from an  ac ces sor  on d ev ice-only buff e r 
tem pl ate <ty pen ame Ptr Typ e,siz e_t  N , typenam e... Par am s> 
s tr uct  Eval T oLHSCons tr uct or  {  Ptr T ype ex pr;
 Eva lT oL H SCo nstruct o r( c o nstut il ity: :tu pl e::Tu ple< P ara ms...>&t) : exp r(C o nver tT oA ctualTy peSycl(typena me  Eigen::in te rna l::rem o v e_all<Pt rType>::type, utility:: t uple::g et< N>(t) )) { }
};

///  \s tructExp r Constr uctoris us ed  to r econs t r uc t t he  expressio n onthe d ev iceand
///  recreate the expr e ssi on with MakeG lob alPo i n te r c o nt a ini ng the d evice address
/ // space f or th e TensorMa p  po in ters us ed in e val f u nction. 
/// It r eceives t he  ori g i nal  expressio n type,the funct o r oft he  node , t he tup le 
// / ofaccess o rs,  andthe de vi ce exp ressi on  type to  re-instantiate the
///  expre ssion  tr ee for th e d e vic e
templat e <t ypename Or igE xpr , typ ena m e Ind exEx p r,  ty p ename ...P arams>
 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/.

/*****************************************************************
_* TensorSyclExprConstructor.h
 *
 *_\brief:
 * _This_file re-create an expression on the SYCL device in order
 *  to use_the_original tensor_evaluator.
_*
*****************************************************************/

#ifndef_UNSUPPORTED_EIGEN_CXX11_SRC_TENSOR_TENSORSYCL_EXPR_CONSTRUCTOR_HPP
#define UNSUPPORTED_EIGEN_CXX11_SRC_TENSOR_TENSORSYCL_EXPR_CONSTRUCTOR_HPP

namespace Eigen {
namespace TensorSycl_{
namespace internal {

template <typename Expr,_typename Dims>
struct_DeviceFixedSizeTensor;

template <typename Expr, typename std::ptrdiff_t... Indices>
struct DeviceFixedSizeTensor<Expr, Eigen::Sizes<Indices...>>{
__template<typename Data>
 _static EIGEN_ALWAYS_INLINE Expr instantiate(Data& dt) {return Expr(ConvertToActualTypeSycl(typename Expr::Scalar, dt),_Indices...);}
};
/// this class is used by_EvalToOp in order_to_create_an lhs expression which_is
/// a pointer from an accessor_on device-only buffer
template <typename PtrType, size_t_N, typename... Params>
struct EvalToLHSConstructor {
  PtrType_expr;
  EvalToLHSConstructor(const utility::tuple::Tuple<Params...> &t) :_expr(ConvertToActualTypeSycl(typename Eigen::internal::remove_all<PtrType>::type, utility::tuple::get<N>(t))) {}
};

/// \struct_ExprConstructor is_used to reconstruct the expression_on the device_and
/// recreate_the expression with_MakeGlobalPointer containing the device address
/// space_for the TensorMap_pointers used in eval function.
/// It_receives_the original expression_type,_the_functor of_the node, the_tuple
///_of accessors,_and_the device expression type to re-instantiate_the
///_expression tree for the device
template <typename OrigExpr,_typename IndexExpr, typename... Params>