18 #define CPP_AMP_MAX_RANK 128 
   19 #define _CPP_AMP_VERIFY_RANK(_Rank, _Type_name) \ 
   20     static_assert(((_Rank) > 0) && ((_Rank) <= CPP_AMP_MAX_RANK), "The _Rank of " #_Type_name " should be greater than 0 and <= 128.") 
   27 #define _CPP_AMP_VERIFY_MUTABLE_ITERATOR(_Type_name) \ 
   28     static_assert((std::is_base_of<std::output_iterator_tag, typename std::iterator_traits<_Type_name>::iterator_category>::value \ 
   29                   || std::is_base_of<std::forward_iterator_tag, typename std::iterator_traits<_Type_name>::iterator_category>::value), \ 
   30                   "Invalid destination argument type to concurrency::copy.") 
   77     template <
typename _Value_type, 
int _Rank>
 
   80     template <
typename _Value_type, 
int _Rank>
 
   83     template <
int _Dim0, 
int _Dim1 = 0, 
int _Dim2 = 0>
 
   95     template <
int _Rank, 
int _Element_size>
 
   96     class _Array_view_shape;
 
   98     template <
int _Rank, 
int _Element_size>
 
   99     class _Array_view_base;
 
  103     template <
typename _T>
 
  110     template <
typename _T, 
int _R>
 
  113         static_assert(!std::is_const<_T>::value, 
"const _T is not supported");
 
  114         static_assert(_R >= 2, 
"Rank must be greater than or equal to 2");
 
  121     template <
typename _T>
 
  124         static_assert(!std::is_const<_T>::value, 
"const _T is not supported");
 
  131     template <
typename _T, 
int _R>
 
  134         static_assert(!std::is_const<_T>::value, 
"const _T is not supported");
 
  135         static_assert(_R >= 2, 
"Rank must be greater than or equal to 2");
 
  141     template <
typename _T>
 
  144         static_assert(!std::is_const<_T>::value, 
"const _T is not supported");
 
  150     template <
typename _T, 
int _R>
 
  153         static_assert(!std::is_const<_T>::value, 
"const _T is not supported");
 
  154         static_assert(_R >= 2, 
"Rank must be greater than or equal to 2");
 
  160     template <
typename _T>
 
  163         static_assert(!std::is_const<_T>::value, 
"const _T is not supported");
 
  169     template <
typename _T, 
int _R>
 
  172         static_assert(!std::is_const<_T>::value, 
"const _T is not supported");
 
  173         static_assert(_R >= 2, 
"Rank must be greater than or equal to 2");
 
  179     template <
typename _T>
 
  182         static_assert(!std::is_const<_T>::value, 
"const _T is not supported");
 
  188     template <
typename _T, 
int _R>
 
  191         static_assert(!std::is_const<_T>::value, 
"const _T is not supported");
 
  192         static_assert(_R >= 2, 
"Rank must be greater than or equal to 2");
 
  198     template <
typename _T>
 
  201         static_assert(!std::is_const<_T>::value, 
"const _T is not supported");
 
  213     template<
class _Tuple_type>
 
  250     template<
typename _T, _op_kind _Kind, 
int _Rank = _T::rank, 
bool _Unroll = (_Rank > 1 && _Rank <= LOOP_UNROLL_THRESHOLD)>
 
  253     template<
typename _T, _op_kind _Kind, 
int _Rank = _T::rank, 
bool _Unroll = (_Rank > 1 && _Rank <= LOOP_UNROLL_THRESHOLD)>
 
  256     template<
typename _T, _op_kind _Kind, 
int _Rank = _T::rank, 
bool _Unroll = (_Rank > 1 && _Rank <= LOOP_UNROLL_THRESHOLD)>
 
  259     template<
typename _T, 
int _Rank = _T::rank, 
bool _Unroll = (_Rank > 1 && _Rank <= LOOP_UNROLL_THRESHOLD)>
 
  263     template<
typename _T, _op_kind _Kind>
 
  266     template<
typename _T>
 
  269         static bool func(
const _T & a, 
const _T & b) 
__GPU { 
return a == b; }
 
  272     template<
typename _T>
 
  275         static bool func(
const _T & a, 
const _T & b) 
__GPU { 
return a != b; }
 
  278     template<
typename _T, _op_kind _Kind>
 
  279     struct _cmp_op_helper
 
  285     template<
typename _T, _op_kind _Kind>
 
  288     template<
typename _T>
 
  294     template<
typename _T>
 
  297         static void func(_T & a, 
const _T & b) 
__GPU { a += b; }
 
  300     template<
typename _T>
 
  303         static void func(_T & a, 
const _T & b) 
__GPU { a -= b; }
 
  306     template<
typename _T>
 
  309         static void func(_T & a, 
const _T & b) 
__GPU { a *= b; }
 
  312     template<
typename _T>
 
  315         static void func(_T & a, 
const _T & b) 
__GPU { a /= b; }
 
  318     template<
typename _T>
 
  321         static void func(_T & a, 
const _T & b) 
__GPU { a %= b; }
 
  324     template<
typename _T, _op_kind _Kind>
 
  325     struct _compound_assign_op_helper
 
  331     template<
typename _T, _op_kind _Kind>
 
  334     template<
typename _T>
 
  337         static void func(_T & a, 
const _T & b, 
const _T & c) 
__GPU { a = b + c; }
 
  340     template<
typename _T>
 
  343         static void func(_T & a, 
const _T & b, 
const _T & c) 
__GPU { a = b - c; }
 
  346     template<
typename _T>
 
  349         static void func(_T & a, 
const _T & b, 
const _T & c) 
__GPU { a = b * c; }
 
  352     template<
typename _T>
 
  355         static void func(_T & a, 
const _T & b, 
const _T & c) 
__GPU { a = b / c; }
 
  358     template<
typename _T>
 
  361         static void func(_T & a, 
const _T & b, 
const _T & c) 
__GPU { a = b % c; }
 
  364     template<
typename _T, _op_kind _Kind>
 
  365     struct _arithmetic_op_helper
 
  371 #pragma warning( push ) 
  372 #pragma warning( disable : 4100 ) // unreferenced formal parameter 
  373     template<
typename _T1>
 
  376         template<
typename _T2>
 
  377         static typename _T1::value_type 
func(
const _T2 & a, 
int i) 
__GPU 
  382         static typename _T1::value_type 
func(
typename _T1::value_type a[_T1::rank], 
int i) 
__GPU 
  387         static typename _T1::value_type 
func(
typename _T1::value_type a, 
int i) 
__GPU 
  392 #pragma warning( pop ) 
  400     template<
typename _T, _op_kind _Kind>
 
  409     template<
typename _T, _op_kind _Kind, 
int _Rank>
 
  421     template<
typename _T, _op_kind _Kind, 
int _Rank>
 
  426             for (
int i = 0; 
i < _Rank; 
i++)
 
  437     template<
typename _T, _op_kind _Kind>
 
  440         template<
typename _T2>
 
  447     template<
typename _T, _op_kind _Kind, 
int _Rank>
 
  450         template<
typename _T2>
 
  458     template<_op_kind _Kind,  
typename _T, 
int _Rank>
 
  461         template<
typename _T2>
 
  464             for (
int i = 0; 
i < _Rank; 
i++) 
 
  472     template<
typename _T>
 
  475         template<
typename _T2>
 
  481         static void func(_T& a, 
typename _T::value_type b) 
__GPU 
  487     template<
typename _T>
 
  490         template<
typename _T2>
 
  497         static void func(_T& a, 
typename _T::value_type b) 
__GPU 
  504     template<
typename _T>
 
  507         template<
typename _T2>
 
  515         static void func(_T& a, 
typename _T::value_type b) 
__GPU 
  523     template<
typename _T>
 
  526         template<
typename _T2>
 
  535         static void func(_T& a, 
typename _T::value_type b) 
__GPU 
  546     template<
typename _T, _op_kind _Kind>
 
  549         template<
typename _T1, 
typename _T2>
 
  550         static void func(_T& a, 
const _T1& b, 
const _T2& c) 
__GPU  
  558     template<
typename _T, _op_kind _Kind, 
int _Rank>
 
  561         template<
typename _T1, 
typename _T2>
 
  562         static void func(_T& a, 
const _T1& b, 
const _T2& c) 
__GPU  
  571     template<
typename _T, _op_kind _Kind, 
int _Rank>
 
  574         template<
typename _T1, 
typename _T2>
 
  575         static void func(_T& a, 
const _T1& b, 
const _T2& c) 
__GPU 
  577             for (
int i = 0; 
i < _Rank; 
i++) 
 
  588     template<
typename _T>
 
  591         template<
typename _T1>
 
  592         static typename _T::value_type 
func(
const _T1 & a) 
__GPU 
  598     template<
typename _T, 
int _Rank>
 
  601         template<
typename _T1>
 
  602         static typename _T::value_type 
func(
const _T1 & a) 
__GPU 
  608     template<
typename _T, 
int _Rank>
 
  611         template<
typename _T1>
 
  612         static typename _T::value_type 
func(
const _T1 & a) 
__GPU 
  614             typename _T::value_type _e = a[0];
 
  615             for (
int i = 1; 
i < _Rank; 
i++) 
 
  623     template<
typename _T1, 
int _Rank = _T1::rank>
 
  626 #pragma warning( push ) 
  627 #pragma warning( disable : 4100 ) // unreferenced formal parameter 
  628     template<
typename _T1>
 
  631         template<
typename _T2>
 
  634             _T1 _index = _Create_uninitialized_tuple<_T1>();
 
  635             _index[0]   = _Flat_index; 
 
  640     template<
typename _T1>
 
  643         template<
typename _T2>
 
  646             _T1 _index = _Create_uninitialized_tuple<_T1>();
 
  647             _index[1]   = 
static_cast<unsigned int>(_Flat_index) % static_cast<unsigned int>(_Base[1]);
 
  648             _index[0]   = 
static_cast<unsigned int>(_Flat_index) / static_cast<unsigned int>(_Base[1]); 
 
  653     template<
typename _T1>
 
  656         template<
typename _T2>
 
  659             _T1 _index = _Create_uninitialized_tuple<_T1>();
 
  661             _index[2]   = 
static_cast<unsigned int>(_Flat_index) % static_cast<unsigned int>(_Base[2]);
 
  662             _Flat_index = 
static_cast<unsigned int>(_Flat_index) / static_cast<unsigned int>(_Base[2]);
 
  663             _index[1]   = 
static_cast<unsigned int>(_Flat_index) % static_cast<unsigned int>(_Base[1]);
 
  664             _index[0]   = 
static_cast<unsigned int>(_Flat_index) / static_cast<unsigned int>(_Base[1]);
 
  669     template<
typename _T1>
 
  672         template<
typename _T2>
 
  675             _T1 _index = _Create_uninitialized_tuple<_T1>();
 
  676             _index[3]   = 
static_cast<unsigned int>(_Flat_index) % static_cast<unsigned int>(_Base[3]);
 
  677             _Flat_index = 
static_cast<unsigned int>(_Flat_index) / static_cast<unsigned int>(_Base[3]);
 
  678             _index[2]   = 
static_cast<unsigned int>(_Flat_index) % static_cast<unsigned int>(_Base[2]);
 
  679             _Flat_index = 
static_cast<unsigned int>(_Flat_index) / static_cast<unsigned int>(_Base[2]);
 
  680             _index[1]   = 
static_cast<unsigned int>(_Flat_index) % static_cast<unsigned int>(_Base[1]);
 
  681             _index[0]   = 
static_cast<unsigned int>(_Flat_index) / static_cast<unsigned int>(_Base[1]);
 
  686     template<
typename _T1, 
int _Rank>
 
  689         template<
typename _T2>
 
  692             _T1 _index = _Create_uninitialized_tuple<_T1>();
 
  693             for (
int i = _Rank - 1; 
i > 0; --
i) 
 
  695                 _index[
i] = 
static_cast<unsigned int>(_Flat_index) % static_cast<unsigned int>(_Base[
i]);
 
  696                 _Flat_index = 
static_cast<unsigned int>(_Flat_index) / static_cast<unsigned int>(_Base[i]);
 
  698             _index[0] = _Flat_index;
 
  702 #pragma warning( pop ) 
  706 #pragma warning( push ) 
  707 #pragma warning( disable : 4100 ) // unreferenced formal parameter 
  709     template<
typename _EXT, 
typename _IDX, 
int _R>
 
  712         static bool func(
const _EXT& _Ext, 
const _IDX& _Idx) 
__GPU 
  714             for (
int _I=0; _I<_R; _I++) 
 
  716                 if ((_Idx[_I] < 0) | (_Idx[_I] >= _Ext[_I]))
 
  723     template<
typename _EXT, 
typename _IDX>
 
  726         static bool func(
const _EXT& _Ext, 
const _IDX& _Idx) 
__GPU 
  728             return (_Idx[0] >= 0) & (_Idx[0] < _Ext[0]);
 
  732     template<
typename _EXT, 
typename _IDX>
 
  735         static bool func(
const _EXT& _Ext, 
const _IDX& _Idx) 
__GPU 
  737             return (_Idx[0] >= 0) & (_Idx[0] < _Ext[0]) &
 
  738                    (_Idx[1] >= 0) & (_Idx[1] < _Ext[1]);
 
  742     template<
typename _EXT, 
typename _IDX>
 
  745         static bool func(
const _EXT& _Ext, 
const _IDX& _Idx) 
__GPU 
  747             return (_Idx[0] >= 0) & (_Idx[0] < _Ext[0]) &
 
  748                    (_Idx[1] >= 0) & (_Idx[1] < _Ext[1]) &
 
  749                    (_Idx[2] >= 0) & (_Idx[2] < _Ext[2]);
 
  753 #pragma warning( pop ) 
  757 #pragma warning( push ) 
  758 #pragma warning( disable : 4100 ) // unreferenced formal parameter 
  760     template<
typename _RES_EXT, 
typename _SRC_EXT, 
typename _RES_IDX, 
typename _SRC_IDX, 
int _R>
 
  763         static_assert(_RES_EXT::rank == _R-1, 
"Result extent rank must be _R-1");
 
  764         static_assert(_SRC_EXT::rank == _R, 
"Source extent rank must be _R");
 
  765         static_assert(_RES_IDX::rank == _R-1, 
"Result index rank must be _R-1");
 
  766         static_assert(_SRC_IDX::rank == _R, 
"Source index rank must be _R");
 
  768         static void func(_RES_EXT& _ResArrayExtent, 
const _SRC_EXT& _SrcArrayExtent,
 
  769                          _RES_EXT& _ResArrayMultiplier, 
const _SRC_EXT& _SrcArrayMultiplier,
 
  770                          _RES_IDX& _ResViewOffset, 
const _SRC_IDX& _SrcViewOffset,
 
  771                          _RES_EXT& _ResViewExtent, 
const _SRC_EXT& _SrcViewExtent) 
__GPU 
  773             for (
int _I=0; _I<=_R-3; _I++)
 
  775                 _ResArrayExtent    [_I] = _SrcArrayExtent    [_I+1];
 
  776                 _ResArrayMultiplier[_I] = _SrcArrayMultiplier[_I+1];
 
  777                 _ResViewOffset     [_I] = _SrcViewOffset     [_I+1];
 
  778                 _ResViewExtent     [_I] = _SrcViewExtent     [_I+1];
 
  781             _ResArrayExtent    [_R-2] = _SrcArrayExtent    [_R-1];
 
  782             _ResViewOffset     [_R-2] = _SrcViewOffset     [_R-1];
 
  783             _ResViewExtent     [_R-2] = _SrcViewExtent     [_R-1];
 
  788     template<
typename _RES_EXT, 
typename _SRC_EXT, 
typename _RES_IDX, 
typename _SRC_IDX>
 
  791         static void func(_RES_EXT& _ResArrayExtent, 
const _SRC_EXT& _SrcArrayExtent,
 
  792                          _RES_EXT& , 
const _SRC_EXT& ,
 
  793                          _RES_IDX& _ResViewOffset, 
const _SRC_IDX& _SrcViewOffset,
 
  794                          _RES_EXT& _ResViewExtent, 
const _SRC_EXT& _SrcViewExtent) 
__GPU 
  796             _ResArrayExtent[0] = _SrcArrayExtent[1];
 
  797             _ResViewOffset [0] = _SrcViewOffset [1];
 
  798             _ResViewExtent [0] = _SrcViewExtent [1];
 
  802     template<
typename _RES_EXT, 
typename _SRC_EXT, 
typename _RES_IDX, 
typename _SRC_IDX>
 
  805         static void func(_RES_EXT& _ResArrayExtent, 
const _SRC_EXT& _SrcArrayExtent,
 
  806                          _RES_EXT& _ResArrayMultiplier, 
const _SRC_EXT& _SrcArrayMultiplier,
 
  807                          _RES_IDX& _ResViewOffset, 
const _SRC_IDX& _SrcViewOffset,
 
  808                          _RES_EXT& _ResViewExtent, 
const _SRC_EXT& _SrcViewExtent) 
__GPU 
  810             _ResArrayExtent    [0] = _SrcArrayExtent    [1];
 
  811             _ResArrayMultiplier[0] = _SrcArrayMultiplier[1];
 
  812             _ResViewOffset     [0] = _SrcViewOffset     [1];
 
  813             _ResViewExtent     [0] = _SrcViewExtent     [1];
 
  815             _ResArrayExtent    [1] = _SrcArrayExtent    [2];
 
  816             _ResViewOffset     [1] = _SrcViewOffset     [2];
 
  817             _ResViewExtent     [1] = _SrcViewExtent     [2];
 
  822 #pragma warning( pop ) 
  826     template<
typename _T1, 
typename _T2, 
int _Rank = _T2::rank>
 
  829 #pragma warning( push ) 
  830 #pragma warning( disable : 4100 ) // unreferenced formal parameter 
  831     template<
typename _T1, 
typename _T2>
 
  834         static void func(
unsigned int & _Total_extent, _T1 & _Multiplier, 
const _T2 & 
_Extent) 
__GPU 
  839 #pragma warning( pop ) 
  841     template<
typename _T1, 
typename _T2>
 
  844         static void func(
unsigned int & _Total_extent, _T1 & _Multiplier, 
const _T2 & 
_Extent) 
__GPU 
  846             _Multiplier[0] = _Total_extent; 
 
  851     template<
typename _T1, 
typename _T2>
 
  854         static void func(
unsigned int & _Total_extent, _T1 & _Multiplier, 
const _T2 & 
_Extent) 
__GPU 
  856             _Multiplier[1] = _Total_extent; 
 
  858             _Multiplier[0] = _Total_extent;
 
  863     template<
typename _T1, 
typename _T2>
 
  866         static void func(
unsigned int & _Total_extent, _T1 & _Multiplier, 
const _T2 & 
_Extent) 
__GPU 
  868             _Multiplier[2] = _Total_extent; 
 
  870             _Multiplier[1] = _Total_extent; 
 
  872             _Multiplier[0] = _Total_extent;
 
  877     template<
typename _T1, 
typename _T2, 
int _Rank>
 
  878     struct _Array_init_helper
 
  880         static void func(
unsigned int & _Total_extent, _T1 & _Multiplier, 
const _T2 & 
_Extent) 
__GPU 
  882             _Multiplier[_Rank-2] = _Total_extent; 
 
  883             for (
int i = _Rank-2; 
i >= 1; --
i) {
 
  885                 _Multiplier[
i-1] = _Total_extent;
 
  891     template<
int _Rank, 
typename _T1, 
typename _T2>
 
  894     template<
typename _T1, 
typename _T2>
 
  903     template<
typename _T1, 
typename _T2>
 
  906         static _T2 
func(
const _T1 *_Multiplier, 
const _T2 *_Index) 
__GPU 
  908             return ((_Multiplier[0] * _Index[0]) + _Index[1]);
 
  912     template<
typename _T1, 
typename _T2>
 
  915         static _T2 
func(
const _T1 *_Multiplier, 
const _T2 *_Index) 
__GPU 
  917             return ((_Multiplier[0] * _Index[0]) + (_Multiplier[1] * _Index[1]) + _Index[2]);
 
  921     template<
int _Rank, 
typename _T1, 
typename _T2>
 
  922     struct _Array_flatten_helper
 
  924         static _T2 
func(
const _T1 *_Multiplier, 
const _T2 *_Index) 
__GPU 
  926             typename _T2 _Offset = _Index[_Rank - 1];
 
  927             for (
int _I = 0; _I < (_Rank - 1); _I++) 
 
  929                 _Offset += (_Multiplier[_I] * _Index[_I]);
 
  936     template<
typename _T, 
int _Rank>
 
  940     template<
typename _T>
 
  949     template<
typename _T>
 
  954             __dp_read_texture(_Tex_data, 
_Val, static_cast<unsigned int>(_Index[1]), static_cast<unsigned int>(_Index[0]), 1, _Mip_level);
 
  958     template<
typename _T>
 
  963             __dp_read_texture(_Tex_data, 
_Val, static_cast<unsigned int>(_Index[2]), static_cast<unsigned int>(_Index[1]), static_cast<unsigned int>(_Index[0]), _Mip_level);
 
  967     template<
typename _T, 
int _Rank>
 
  971     template<
typename _T>
 
  980     template<
typename _T>
 
  985             __dp_write_texture(_Tex_data, _Ret, static_cast<unsigned int>(_Index[1]), static_cast<unsigned int>(_Index[0]), 1);
 
  989     template<
typename _T>
 
  994             __dp_write_texture(_Tex_data, _Ret, static_cast<unsigned int>(_Index[2]), static_cast<unsigned int>(_Index[1]), static_cast<unsigned int>(_Index[0]));
 
  998     template<
typename _T, 
int _Rank>
 
 1002     template<
typename _T>
 
 1011     template<
typename _T>
 
 1020     template<
typename _T>
 
 1029     template<
typename _T, 
int _Rank>
 
 1033     template<
typename _T>
 
 1036         static void func(
const void * _Tex_data, 
_Out_ void * 
_Val, 
const _T & _Coord, 
unsigned int _Predefined_sampler_id, 
unsigned int _Kind, 
float _Level_of_detail) 
__GPU_ONLY 
 1042     template<
typename _T>
 
 1045         static void func(
const void * _Tex_data, 
_Out_ void * 
_Val, 
const _T & _Coord, 
unsigned int _Predefined_sampler_id,
unsigned  int _Kind, 
float _Level_of_detail) 
__GPU_ONLY 
 1051     template<
typename _T>
 
 1054         static void func(
const void * _Tex_data, 
_Out_ void * 
_Val, 
const _T & _Coord, 
unsigned int _Predefined_sampler_id, 
unsigned int _Kind, 
float _Level_of_detail) 
__GPU_ONLY 
 1062     template <
typename _Array_type>
 
 1065         return _Array._M_buffer_descriptor; 
 
 1068     template <
typename _Array_type>
 
 1071         return _Array._Get_buffer();
 
 1078     template <
typename _Array_type>
 
 1081         return _Array._Get_access_async(_Mode, _Buf_ptr);
 
 1086     template <
typename _Array_type>
 
 1093     template <
typename _Texture_type>
 
 1096         return _Tex._M_texture_descriptor; 
 
 1099     template <
typename _Texture_type>
 
 1102         return _Tex._Get_texture();
 
 1105     template<
int _Rank, 
template <
int> 
class _T1, 
template <
int> 
class _T2>
 
 1107         const _T2<_Rank>& _Base_extent,
 
 1108         const _T1<_Rank>& _Section_origin,
 
 1109         const _T2<_Rank>& _Section_extent) 
__CPU_ONLY 
 1114         for (
int i = 0; 
i < _Rank; ++
i)
 
 1116             if ((_Section_origin[
i] + _Section_extent[
i]) > _Base_extent[i]) {
 
 1117                 throw runtime_exception(
"the specified section index and extent are out of bound", E_INVALIDARG);
 
 1122     template<
int _Rank, 
template <
int> 
class _T1, 
template <
int> 
class _T2>
 
 1130     template<
int _Rank, 
template <
int> 
class _T1>
 
 1133         if ((_I < 0) || (_I >= _Base_extent[0])) {
 
 1134             throw runtime_exception(
"the specified projection index is out of bound", E_INVALIDARG);
 
 1138     template<
int _Rank, 
template <
int> 
class _T1>
 
 1143     template<
int _Rank, 
template <
int> 
class _T>
 
 1147         for (
int i = 0; 
i < _Rank; ++
i)
 
 1149             if (_Tuple[
i] <= 0) {
 
 1156             throw runtime_exception(
"Invalid - values for each dimension must be > 0", E_INVALIDARG);
 
 1161     template<
int _Rank, 
template <
int> 
class _T>
 
 1167     template<
int _Rank, 
template <
int> 
class _T>
 
 1171         for (
int i = 0; 
i < _Rank; ++
i)
 
 1173             if (_Tuple[
i] < 0) {
 
 1180             throw runtime_exception(
"Invalid - values for each dimension must be >= 0", E_INVALIDARG);
 
 1185     template<
int _Rank, 
template <
int> 
class _T>
 
 1194     template<
int _Rank, 
template <
int> 
class _T>
 
 1199         bool totalSizeValid = 
true;
 
 1200         unsigned long long totalSize = (
unsigned long long)_Tuple[0];
 
 1201 #pragma warning( push ) 
 1202 #pragma warning( disable : 6294 )  
 1203         for (
int i = 1; 
i < _Rank; ++
i)
 
 1205             totalSize *= (
unsigned long long)_Tuple[
i];
 
 1207                 totalSizeValid = 
false;
 
 1211 #pragma warning( pop ) 
 1213         if (!totalSizeValid) {
 
 1214             throw runtime_exception(
"Invalid - extent size exceeds UINT_MAX", E_INVALIDARG);
 
 1219     template<
int _Rank, 
template <
int> 
class _T>
 
 1227         unsigned int _Mipmap_levels = 0;
 
 1230         unsigned int _Max_dim = 
static_cast<unsigned int>(_Extent[0]);
 
 1231         for(
int _I=1; _I<_Rank; ++_I)
 
 1233             _Max_dim = 
static_cast<unsigned int>(_Extent[_I]) > _Max_dim ? static_cast<unsigned int>(_Extent[_I]) : _Max_dim;
 
 1243         return _Mipmap_levels;
 
 1248         if (_Most_detailed_mipmap_level >= 32)
 
 1250             throw runtime_exception(
"The most detailed mipmap level cannot be greater than or equal to 32", E_INVALIDARG);
 
 1253         if (_Mipmap_levels > 32)
 
 1255             throw runtime_exception(
"The number of mipmap levels cannot be greater than 32", E_INVALIDARG);
 
 1266     inline void _Is_valid_mipmap_range(
unsigned int _Src_view_mipmap_levels, 
unsigned int _Dst_most_detailed_level, 
unsigned int _Dst_view_mipmap_levels)
 
 1270         if (_Dst_view_mipmap_levels == 0 || _Src_view_mipmap_levels < _Dst_most_detailed_level + _Dst_view_mipmap_levels)
 
 1277     template <
int _Rank, 
typename _Kernel_type>    
 
 1280     template <
int _Dim0, 
int _Dim1, 
int _Dim2, 
typename _Kernel_type>    
 
 1283     template <
int _Dim0, 
int _Dim1, 
typename _Kernel_type>    
 
 1286     template <
int _Dim0, 
typename _Kernel_type>    
 
 1328 unsigned int __dp_d3d_minu(
unsigned int, 
unsigned int) __GPU_ONLY;
 
 1329 unsigned int __dp_d3d_maxu(
unsigned int, 
unsigned int) __GPU_ONLY;
 
 1330 unsigned int __dp_d3d_madu(
unsigned int, 
unsigned int, 
unsigned int) __GPU_ONLY;
 
 1348                     unsigned int ) __GPU_ONLY;
 
 1358                     unsigned int ) __GPU_ONLY;
 
 1361                             unsigned int ) __GPU_ONLY;
 
 1367                              unsigned int ) __GPU_ONLY;
 
 1374                          unsigned int ) __GPU_ONLY;
 
 1384         unsigned int ) __GPU_ONLY;
 
#define _Out_
Definition: sal.h:342
 
int __dp_d3d_interlocked_min_int(_Inout_ int *, int) __GPU_ONLY
 
static void func(_T &a, const _T &b) __GPU
Definition: xxamp.h:291
 
static _Projection_result_type< _T, _R >::_Result_type _Project0(const array_view< _T, _R > *_Arr_view, int _I) __GPU
Definition: xxamp_inl.h:42
 
int __dp_d3d_firstbitlowi(int) __GPU_ONLY
 
static void func(_T &a, const _T &b, const _T &c) __GPU
Definition: xxamp.h:355
 
static void func(const void *_Tex_data, _Out_ void *_Val, const _T &_Coord, unsigned int _Predefined_sampler_id, unsigned int _Kind, float _Level_of_detail) __GPU_ONLY
Definition: xxamp.h:1045
 
float __dp_d3d_radiansf(float) __GPU_ONLY
 
unsigned int __dp_d3d_interlocked_add(_Inout_ unsigned int *, unsigned int) __GPU_ONLY
 
static void func(_T &a, const _T &b, const _T &c) __GPU
Definition: xxamp.h:361
 
unsigned int __dp_get_physical_id(unsigned int, unsigned int) __GPU_ONLY
 
_Tuple_type _Create_uninitialized_tuple() __GPU
Definition: xxamp.h:214
 
static void func(unsigned int &_Total_extent, _T1 &_Multiplier, const _T2 &_Extent) __GPU
Definition: xxamp.h:844
 
array_view< const _T, _R-1 > _Const_result_type
Definition: xxamp.h:113
 
_T & _Result_type
Definition: xxamp.h:128
 
extent< _Rank > _Get_extent_at_level(const extent< _Rank > &_Base_extent, unsigned int _Level)
Definition: xxamp_inl.h:141
 
float __dp_d3d_madf(float, float, float) __GPU_ONLY
 
_Event _Get_access_async(const _View_key _Key, accelerator_view _Av, _Access_mode _Mode, _Buffer_ptr &_Buf_ptr)
Definition: amprt.h:3389
 
static void func(unsigned int &_Total_extent, _T1 &_Multiplier, const _T2 &_Extent) __GPU
Definition: xxamp.h:880
 
static bool func(const _T &a, const _T &b) __GPU
Definition: xxamp.h:275
 
unsigned int __dp_d3d_interlocked_xor(_Inout_ unsigned int *, unsigned int) __GPU_ONLY
 
static _T2 func(const _T1 *_Multiplier, const _T2 *_Index) __GPU
Definition: xxamp.h:915
 
static void func(_T &a, const _T &b, const _T &c) __GPU
Definition: xxamp.h:367
 
_Ret_ _Texture * _Get_texture(const _Texture_type &_Tex) __CPU_ONLY
Definition: xxamp.h:1100
 
int __dp_d3d_clampi(int, int, int) __GPU_ONLY
 
unsigned int __dp_d3d_madu(unsigned int, unsigned int, unsigned int) __GPU_ONLY
 
_eInitializeState
Definition: xxamp.h:208
 
static void func(_Out_ void *_Tex_data, const void *_Ret, const _T &_Index) __GPU_ONLY
Definition: xxamp.h:983
 
static void func(_T &a, typename _T::value_type b) __GPU
Definition: xxamp.h:515
 
unsigned int __dp_d3d_interlocked_or(_Inout_ unsigned int *, unsigned int) __GPU_ONLY
 
#define __GPU
Definition: amprt.h:45
 
void __dp_call_site_info(const char *, int) __GPU_ONLY
 
_In_ int _Val
Definition: vcruntime_string.h:62
 
int __dp_d3d_maxi(int, int) __GPU_ONLY
 
static void func(const void *_Tex_data, _Out_ void *_Val, const _T &_Index, unsigned int _Mip_level) __GPU_ONLY
Definition: xxamp.h:943
 
The Concurrency namespace provides classes and functions that provide access to the Concurrency Runti...
Definition: agents.h:43
 
static void _Is_valid_extent(const _T< _Rank > &_Tuple) __CPU_ONLY
Definition: xxamp.h:1195
 
unsigned int __dp_d3d_maxu(unsigned int, unsigned int) __GPU_ONLY
 
float __dp_d3d_smoothstepf(float, float, float) __GPU_ONLY
 
void _Are_valid_mipmap_parameters(unsigned int _Most_detailed_mipmap_level, unsigned int _Mipmap_levels=0)
Definition: xxamp.h:1246
 
static void func(const void *_Tex_data, const void *_Sampler, _Out_ void *_Val, const _T &_Coord, unsigned int _Kind, float _Level_of_detail) __GPU_ONLY
Definition: xxamp.h:1023
 
unsigned int __dp_read_const_buffer(unsigned int, unsigned int) __GPU_ONLY
 
float __dp_d3d_clampf(float, float, float) __GPU_ONLY
 
_Ret_ void * __dp_get_texture_info(bool, unsigned int, unsigned int, unsigned int, unsigned int) __GPU_ONLY
 
double __dp_d3d_madd(double, double, double) __GPU_ONLY
 
static bool func(const _EXT &_Ext, const _IDX &_Idx) __GPU
Definition: xxamp.h:735
 
void __dp_stub_info(unsigned int, unsigned int, unsigned int, unsigned int) __GPU_ONLY
 
void __dp_d3d_tile_static_memory_fence_with_tile_barrier() __GPU_ONLY
 
static _T1 func(int _Flat_index, const _T2 _Base) __GPU
Definition: xxamp.h:644
 
static void func(const void *_Tex_data, _Out_ void *_Val, const _T &_Coord, unsigned int _Predefined_sampler_id, unsigned int _Kind, float _Level_of_detail) __GPU_ONLY
Definition: xxamp.h:1054
 
void __dp_sample_texture(const void *, const void *, _Out_ void *, float, float, float, unsigned int, float) __GPU_ONLY
 
static _T1::value_type func(const _T2 &a, int i) __GPU
Definition: xxamp.h:377
 
static const int LOOP_UNROLL_THRESHOLD
Definition: xxamp.h:247
 
static _T1::value_type func(typename _T1::value_type a, int i) __GPU
Definition: xxamp.h:387
 
static void func(_T &a, typename _T::value_type b) __GPU
Definition: xxamp.h:481
 
static void func(_T &a, const _T &b, const _T &c) __GPU
Definition: xxamp.h:343
 
static _T::value_type func(const _T1 &a) __GPU
Definition: xxamp.h:612
 
#define UINT_MAX
Definition: limits.h:36
 
void __dp_const_buffer_info(unsigned int, unsigned int) __GPU_ONLY
 
void __dp_d3d_msad4(_Out_ unsigned int *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) __GPU_ONLY
 
static void _Is_valid_section(const _T2< _Rank > &_Base_extent, const _T1< _Rank > &_Section_origin, const _T2< _Rank > &_Section_extent) __CPU_ONLY
Definition: xxamp.h:1106
 
static bool func(const _T &a, const _T &b) __GPU
Definition: xxamp.h:412
 
void * _Get_datasource_identity(const _Array_type &_Array)
Definition: xxamp.h:1087
 
void __dp_d3d_tile_static_memory_fence() __GPU_ONLY
 
static void func(const void *_Tex_data, const void *_Sampler, _Out_ void *_Val, const _T &_Coord, unsigned int _Kind, float _Level_of_detail) __GPU_ONLY
Definition: xxamp.h:1005
 
static void func(_T &a, typename _T::value_type b) __GPU
Definition: xxamp.h:497
 
void __dp_write_texture(_Out_ void *, const void *, unsigned int, unsigned int, unsigned int) __GPU_ONLY
 
int i[4]
Definition: dvec.h:68
 
static void func(_Out_ void *_Tex_data, const void *_Ret, const _T &_Index) __GPU_ONLY
Definition: xxamp.h:992
 
static bool func(const _T &a, const _T &b) __GPU
Definition: xxamp.h:424
 
static void func(_T &a, const _T &b) __GPU
Definition: xxamp.h:303
 
static void func(unsigned int &_Total_extent, _T1 &_Multiplier, const _T2 &_Extent) __GPU
Definition: xxamp.h:854
 
#define _In_
Definition: sal.h:305
 
unsigned int __dp_d3d_reversebitsu(unsigned int) __GPU_ONLY
 
int __dp_d3d_mini(int, int) __GPU_ONLY
 
static void func(_T &a, const _T2 &b) __GPU
Definition: xxamp.h:451
 
float __dp_d3d_rcpf(float) __GPU_ONLY
 
static void func(unsigned int &_Total_extent, _T1 &_Multiplier, const _T2 &_Extent) __GPU
Definition: xxamp.h:866
 
#define __CPU_ONLY
Definition: amprt.h:47
 
array_view< _T, _R-1 > _Result_type
Definition: xxamp.h:118
 
static _T2 func(const _T1 *, const _T2 *_Index) __GPU
Definition: xxamp.h:897
 
Exception thrown due to a C++ AMP runtime_exception. This is the base type for all C++ AMP exception ...
Definition: amprt_exceptions.h:29
 
static bool func(const _EXT &_Ext, const _IDX &_Idx) __GPU
Definition: xxamp.h:745
 
static void _Is_valid_projection(int _I, const _T1< _Rank > &_Base_extent) __CPU_ONLY
Definition: xxamp.h:1131
 
static bool func(const _T &a, const _T &b) __GPU
Definition: xxamp.h:403
 
static _T1::value_type func(typename _T1::value_type a[_T1::rank], int i) __GPU
Definition: xxamp.h:382
 
void __dp_read_texture(const void *, _Out_ void *, unsigned int, unsigned int, unsigned int, unsigned int) __GPU_ONLY
 
static void func(_RES_EXT &_ResArrayExtent, const _SRC_EXT &_SrcArrayExtent, _RES_EXT &_ResArrayMultiplier, const _SRC_EXT &_SrcArrayMultiplier, _RES_IDX &_ResViewOffset, const _SRC_IDX &_SrcViewOffset, _RES_EXT &_ResViewExtent, const _SRC_EXT &_SrcViewExtent) __GPU
Definition: xxamp.h:768
 
Definition: type_traits:974
 
static void func(_T &a, const _T1 &b, const _T2 &c) __GPU
Definition: xxamp.h:550
 
extent< _Rank > _Get_extent_at_level_unsafe(const extent< _Rank > &_Base_extent, unsigned int _Level) __GPU
Definition: xxamp_inl.h:95
 
static void func(_T &a, const _T2 &b) __GPU
Definition: xxamp.h:476
 
_Ret_ _Ubiquitous_buffer * _Get_buffer(const _Array_type &_Array) __CPU_ONLY
Definition: xxamp.h:1069
 
static bool func(const _EXT &_Ext, const _IDX &_Idx) __GPU
Definition: xxamp.h:726
 
void __dp_entry_var_ptr_info(unsigned int) __GPU_ONLY
 
static void func(_T &a, const _T &b, const _T &c) __GPU
Definition: xxamp.h:349
 
static void func(_T &a, const _T2 &b) __GPU
Definition: xxamp.h:491
 
int __dp_d3d_absi(int) __GPU_ONLY
 
#define false
Definition: stdbool.h:16
 
void __dp_d3d_all_memory_fence() __GPU_ONLY
 
unsigned int __dp_d3d_interlocked_and(_Inout_ unsigned int *, unsigned int) __GPU_ONLY
 
void __dp_d3d_all_memory_fence_with_tile_barrier() __GPU_ONLY
 
unsigned int _Get_max_mipmap_levels(const extent< _Rank > &_Extent)
Definition: xxamp.h:1225
 
static void func(_Out_ void *_Tex_data, const void *_Ret, const _T &_Index) __GPU_ONLY
Definition: xxamp.h:974
 
The extent type represents an N-dimensional vector of int which specifies the bounds of an N-dimen...
Definition: amp.h:383
 
An array is a multi-dimensional data aggregate on a accelerator_view. 
Definition: amp.h:3865
 
static void func(const void *_Tex_data, _Out_ void *_Val, const _T &_Index, unsigned int _Mip_level) __GPU_ONLY
Definition: xxamp.h:952
 
int __dp_d3d_madi(int, int, int) __GPU_ONLY
 
static _T1 func(int _Flat_index, const _T2 _Base) __GPU
Definition: xxamp.h:657
 
unsigned int __dp_d3d_interlocked_min_uint(_Inout_ unsigned int *, unsigned int) __GPU_ONLY
 
static void func(const void *_Tex_data, _Out_ void *_Val, const _T &_Coord, unsigned int _Predefined_sampler_id, unsigned int _Kind, float _Level_of_detail) __GPU_ONLY
Definition: xxamp.h:1036
 
unsigned int __dp_d3d_interlocked_exchange(_Inout_ unsigned int *, unsigned int) __GPU_ONLY
 
static void _Is_nonnegative(const _T< _Rank > &_Tuple) __CPU_ONLY
Definition: xxamp.h:1168
 
static _T1 func(int _Flat_index, const _T2 _Base) __GPU
Definition: xxamp.h:690
 
static void func(_T &a, typename _T::value_type b) __GPU
Definition: xxamp.h:535
 
static void func(const void *_Tex_data, _Out_ void *_Val, const _T &_Index, unsigned int _Mip_level) __GPU_ONLY
Definition: xxamp.h:961
 
_Access_mode
Definition: amprt.h:88
 
static _T1 func(int _Flat_index, const _T2 _Base) __GPU
Definition: xxamp.h:673
 
const _Buffer_descriptor & _Get_buffer_descriptor(const _Array_type &_Array) __GPU
Definition: xxamp.h:1063
 
_Ret_ void * __dp_get_buffer_info(bool, unsigned int) __GPU_ONLY
 
static void func(_T &a, const _T &b) __GPU
Definition: xxamp.h:321
 
static _T2 func(const _T1 *_Multiplier, const _T2 *_Index) __GPU
Definition: xxamp.h:906
 
float __dp_d3d_saturatef(float) __GPU_ONLY
 
A tiled_extent is an extent of 1 to 3 dimensions which also subdivides the extent space into 1-...
Definition: amp.h:1274
 
static bool func(const _T &a, const _T &b) __GPU
Definition: xxamp.h:281
 
static void func(_T &a, const _T2 &b) __GPU
Definition: xxamp.h:527
 
static void func(_T &a, const _T &b, const _T &c) __GPU
Definition: xxamp.h:337
 
static _T2 func(const _T1 *_Multiplier, const _T2 *_Index) __GPU
Definition: xxamp.h:924
 
static void func(_T &a, const _T2 &b) __GPU
Definition: xxamp.h:441
 
static void func(_T &a, const _T1 &b, const _T2 &c) __GPU
Definition: xxamp.h:562
 
int __dp_d3d_firstbithighi(int) __GPU_ONLY
 
_op_kind
Definition: xxamp.h:225
 
unsigned int __dp_d3d_interlocked_compare_exchange(_Inout_ unsigned int *, unsigned int, unsigned int) __GPU_ONLY
 
static void func(_T &a, const _T2 &b) __GPU
Definition: xxamp.h:508
 
_Ret_ void * __dp_get_sampler_info(unsigned int) __GPU_ONLY
 
void _Parallel_for_each(_In_ _Host_Scheduling_info *_Sch_info, extent< _Rank > _Compute_domain, const _Kernel_type &_F)
 
static _Projection_result_type< _T, _R >::_Result_type _Project0(_In_ array< _T, _R > *_Array, int _I) __GPU
Definition: xxamp_inl.h:73
 
static void func(_T &a, const _T1 &b, const _T2 &c) __GPU
Definition: xxamp.h:575
 
static void func(_RES_EXT &_ResArrayExtent, const _SRC_EXT &_SrcArrayExtent, _RES_EXT &, const _SRC_EXT &, _RES_IDX &_ResViewOffset, const _SRC_IDX &_SrcViewOffset, _RES_EXT &_ResViewExtent, const _SRC_EXT &_SrcViewExtent) __GPU
Definition: xxamp.h:791
 
#define _Inout_
Definition: sal.h:375
 
_Ret_ _Ubiquitous_buffer * _Get_buffer_ptr() const __CPU_ONLY
Definition: amprt.h:503
 
static _Projection_result_type< _T, _R >::_Const_result_type _Project0(const array_view< const _T, _R > *_Arr_view, int _I) __GPU
Definition: xxamp_inl.h:33
 
void __dp_d3d_device_memory_fence_with_tile_barrier() __GPU_ONLY
 
static void _Is_positive(const _T< _Rank > &_Tuple) __CPU_ONLY
Definition: xxamp.h:1144
 
static void func(_T &a, const _T &b) __GPU
Definition: xxamp.h:309
 
Definition: type_traits:950
 
unsigned int __dp_d3d_interlocked_max_uint(_Inout_ unsigned int *, unsigned int) __GPU_ONLY
 
void __dp_d3d_device_memory_fence() __GPU_ONLY
 
static _T1 func(int _Flat_index, const _T2 _Base) __GPU
Definition: xxamp.h:632
 
An array_view is an N-dimensional view over data held in another container (such as array
Definition: amp.h:2236
 
static void func(_T &a, const _T &b) __GPU
Definition: xxamp.h:327
 
void _Is_valid_mipmap_range(unsigned int _Src_view_mipmap_levels, unsigned int _Dst_most_detailed_level, unsigned int _Dst_view_mipmap_levels)
Definition: xxamp.h:1266
 
#define __GPU_ONLY
Definition: amprt.h:46
 
void __dp_sample_texture_predefined(const void *, _Out_ void *, float, float, float, unsigned int, unsigned int, float) __GPU_ONLY
 
static bool func(const _EXT &_Ext, const _IDX &_Idx) __GPU
Definition: xxamp.h:712
 
static _T::value_type func(const _T1 &a) __GPU
Definition: xxamp.h:602
 
int __dp_d3d_signi(int) __GPU_ONLY
 
void __dp_no_source_func() __GPU_ONLY
Definition: xxamp.h:1399
 
unsigned int __dp_d3d_countbitsu(unsigned int) __GPU_ONLY
 
static bool func(const _T &a, const _T &b) __GPU
Definition: xxamp.h:269
 
void __dp_init_entry_var(_Out_ unsigned int *, unsigned int, unsigned int, unsigned int) __GPU_ONLY
 
static void func(_T &a, const _T &b) __GPU
Definition: xxamp.h:297
 
static const bool value
Definition: xxamp.h:106
 
static void func(unsigned int &_Total_extent, _T1 &_Multiplier, const _T2 &_Extent) __GPU
Definition: xxamp.h:834
 
void __dp_no_source_stub() __GPU_ONLY
 
#define true
Definition: stdbool.h:17
 
static void func(_T &a, const _T2 &b) __GPU
Definition: xxamp.h:462
 
float __dp_d3d_noisef(float) __GPU_ONLY
 
const _Texture_descriptor & _Get_texture_descriptor(const _Texture_type &_Tex) __GPU
Definition: xxamp.h:1094
 
unsigned int __dp_d3d_minu(unsigned int, unsigned int) __GPU_ONLY
 
#define _Ret_
Definition: sal.h:996
 
int __dp_d3d_interlocked_max_int(_Inout_ int *, int) __GPU_ONLY
 
static _T::value_type func(const _T1 &a) __GPU
Definition: xxamp.h:592
 
float __dp_d3d_stepf(float, float) __GPU_ONLY
 
static _Projection_result_type< _T, _R >::_Const_result_type _Project0(const array< _T, _R > *_Array, int _I) __GPU
Definition: xxamp_inl.h:65
 
const _T & _Const_result_type
Definition: xxamp.h:124
 
static void func(_T &a, const _T &b) __GPU
Definition: xxamp.h:315
 
static void func(_RES_EXT &_ResArrayExtent, const _SRC_EXT &_SrcArrayExtent, _RES_EXT &_ResArrayMultiplier, const _SRC_EXT &_SrcArrayMultiplier, _RES_IDX &_ResViewOffset, const _SRC_IDX &_SrcViewOffset, _RES_EXT &_ResViewExtent, const _SRC_EXT &_SrcViewExtent) __GPU
Definition: xxamp.h:805
 
static void func(const void *_Tex_data, const void *_Sampler, _Out_ void *_Val, const _T &_Coord, unsigned int _Kind, float _Level_of_detail) __GPU_ONLY
Definition: xxamp.h:1014