STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Types | Public Member Functions | Static Public Attributes | Private Types | Private Member Functions | Static Private Member Functions | Friends | List of all members
Concurrency::array_view< _Value_type, _Rank > Class Template Reference

An array_view is an N-dimensional view over data held in another container (such as array<T,N> or other container. It exposes an indexing interface congruent to that of array<T,N>). More...

#include <amp.h>

Inheritance diagram for Concurrency::array_view< _Value_type, _Rank >:
Concurrency::details::_Array_view_base< _Rank, sizeof(_Value_type)/sizeof(int)> Concurrency::details::_Array_view_shape< _Rank, _Element_size >

Public Types

typedef _Value_type value_type
 
- Public Types inherited from Concurrency::details::_Array_view_base< _Rank, sizeof(_Value_type)/sizeof(int)>
typedef details::_Buffer_descriptor _Buffer_descriptor
 

Public Member Functions

 ~array_view () __GPU
 Destroys this array_view and reclaims resources. More...
 
 array_view (array< _Value_type, _Rank > &_Src) __GPU
 Construct an array_view which is bound to the data contained in the _Src array. The extent of the array_view is that of the _Src array, and the origin of the array view is at zero. More...
 
 array_view (const array_view &_Other) __GPU
 Copy constructor. Shallow copy. More...
 
 array_view (const Concurrency::extent< _Rank > &_Extent) __CPU_ONLY
 Construct an array_view which is not bound to a data source. More...
 
template<typename _Container >
 array_view (const Concurrency::extent< _Rank > &_Extent, _Container &_Src) __CPU_ONLY
 Construct an array_view which is bound to the data contained in the _Src container. More...
 
 array_view (const Concurrency::extent< _Rank > &_Extent, _Value_type *_Src) __GPU
 Construct an array_view which is bound to the data pointed to by _Src. More...
 
 array_view (int _E0) __CPU_ONLY
 Construct an array_view which is not bound to a data source. More...
 
template<typename _Container >
 array_view (_Container &_Src, typename std::enable_if< details::_Is_container< _Container >::type::value, void ** >::type=0) __CPU_ONLY
 Construct an array_view which is bound to the data contained in the _Src container. More...
 
template<typename _Container >
 array_view (int _E0, _Container &_Src) __CPU_ONLY
 Construct an array_view which is bound to the data contained in the _Src container. More...
 
 array_view (int _E0, int _E1) __CPU_ONLY
 Construct an array_view which is not bound to a data source. More...
 
template<typename _Container >
 array_view (int _E0, int _E1, _Container &_Src) __CPU_ONLY
 Construct an array_view which is bound to the data contained in the _Src container. More...
 
 array_view (int _E0, int _E1, int _E2) __CPU_ONLY
 Construct an array_view which is not bound to a data source. More...
 
template<typename _Container >
 array_view (int _E0, int _E1, int _E2, _Container &_Src) __CPU_ONLY
 Construct an array_view which is bound to the data contained in the _Src container. More...
 
 array_view (int _E0, _In_ _Value_type *_Src) __GPU
 Construct an array_view which is bound to the data pointed to by _Src. More...
 
template<typename _Arr_type , int _Size>
 array_view (_In_ _Arr_type(&_Src)[_Size]) __GPU
 Construct an array_view which is bound to the array _Src. More...
 
 array_view (int _E0, int _E1, _In_ _Value_type *_Src) __GPU
 Construct an array_view which is bound to the data pointed to by _Src. More...
 
 array_view (int _E0, int _E1, int _E2, _In_ _Value_type *_Src) __GPU
 Construct an array_view which is bound to the data pointed to by _Src. More...
 
array_viewoperator= (const array_view &_Other) __GPU
 Copy Assignment operator. Shallow copy. More...
 
void copy_to (array< _Value_type, _Rank > &_Dest) const __CPU_ONLY
 Copies elements from this array_view to the destination array. More...
 
void copy_to (const array_view< _Value_type, _Rank > &_Dest) const __CPU_ONLY
 Copies elements from this array_view to the destination array_view. More...
 
details::_Projection_result_type< _Value_type, _Rank >::_Result_type operator[] (int _I) const __GPU
 Projects the most-significant dimension of this array_view. If the array_view rank is 1, this produces a single element; otherwise it produces an array_view with one fewer dimensions. More...
 
value_typeget_ref (const index< _Rank > &_Index) const __GPU
 Get a reference to the element indexed by _Index. Unlike the other indexing operators for accessing the array_view on the CPU, this method does not implicitly synchronize this array_view's contents to the CPU. After accessing the array_view on a remote location or performing a copy operation involving this array_view users are responsible to explicitly synchronize the array_view to the CPU before calling this method. Failure to do so results in undefined behavior. More...
 
value_typeoperator[] (const index< _Rank > &_Index) const __GPU
 Get the element value indexed by _I More...
 
value_typeoperator() (const index< _Rank > &_Index) const __GPU
 Get the element value indexed by _I More...
 
details::_Projection_result_type< _Value_type, _Rank >::_Result_type operator() (int _I) const __GPU
 Projects the most-significant dimension of this array_view. If the array_view rank is 1, this produces a single element; otherwise it produces an array_view with one fewer dimensions. More...
 
value_typeoperator() (int _I0, int _I1) const __GPU
 Get the element value indexed by (_I0,_I1) More...
 
value_typeoperator() (int _I0, int _I1, int _I2) const __GPU
 Get the element value indexed by (_I0,_I1,_I2) More...
 
array_view section (const Concurrency::index< _Rank > &_Section_origin, const Concurrency::extent< _Rank > &_Section_extent) const __GPU
 Produces a subsection of the source array_view at the given origin and extent. More...
 
array_view section (const Concurrency::index< _Rank > &_Idx) const __GPU
 Produces a subsection of the source array_view with origin specified by an index, with an extent of (this->exent - _Idx). More...
 
array_view section (const Concurrency::extent< _Rank > &_Ext) const __GPU
 Produces a subsection of the source array_view with origin of zero, with an extent of _Ext. More...
 
array_view section (int _I0, int _E0) const __GPU
 Produces a one-dimensional subsection of the source array_view with origin specified by the index components _I0, with extent _E0. More...
 
array_view section (int _I0, int _I1, int _E0, int _E1) const __GPU
 Produces a two-dimensional subsection of the source array_view with origin specified by the index components (_I0,_I1), with extent (_E0,_E1). More...
 
array_view section (int _I0, int _I1, int _I2, int _E0, int _E1, int _E2) const __GPU
 Produces a three-dimensional subsection of the source array_view with origin specified by the index components (_I0,_I1,_I2), with extent (_E0,_E1,_E2). More...
 
template<typename _Value_type2 >
array_view< _Value_type2, _Rank > reinterpret_as () const __GPU
 Produces a (possibly unsafe) reinterpretation of this array_view that is linear and with a different element type. The size of _Value_type2 must evenly divide into the size of this array. More...
 
template<int _New_rank>
array_view< _Value_type, _New_rank > view_as (const Concurrency::extent< _New_rank > &_View_extent) const __GPU
 Produces an array_view of a different rank over this array_view's data. More...
 
_Ret_ _Value_type * data () const __GPU
 Returns a pointer to the raw data of this array_view. More...
 
void refresh () const __CPU_ONLY
 Informs the array_view that its bound memory has been modified outside the array_view interface. This will render all cached information stale. More...
 
concurrency::completion_future synchronize_to_async (const accelerator_view &_Accl_view, access_type _Access_type=access_type_read) const __CPU_ONLY
 Asynchronously synchronizes any modifications made to "this" array_view to the specified accelerator_view. More...
 
concurrency::completion_future synchronize_async (access_type _Access_type=access_type_read) const __CPU_ONLY
 Asynchronously synchronizes any modifications made to "this" array_view to its source data. More...
 
void synchronize_to (const accelerator_view &_Accl_view, access_type _Access_type=access_type_read) const __CPU_ONLY
 Synchronizes any modifications made to "this" array_view to the specified accelerator_view. More...
 
void synchronize (access_type _Access_type=access_type_read) const __CPU_ONLY
 Synchronizes any modifications made to "this" array_view to its source data. More...
 
void discard_data () const __CPU_ONLY
 Discards the current data underlying this view. This is an optimization hint to the runtime used to avoid copying the current contents of the view to a target accelerator_view that it is accessed on, and its use is recommended if the existing content is not needed. This method is only available in a restrict(cpu) context and cannot be used in a restrict(amp) context. More...
 
accelerator_view get_source_accelerator_view () const
 Returns the accelerator_view where the data source of the array_view is located. If the array_view does not have a data source, this API throws a runtime_exception More...
 
 __declspec (property(get=get_source_accelerator_view)) accelerator_view source_accelerator_view
 
- Public Member Functions inherited from Concurrency::details::_Array_view_base< _Rank, sizeof(_Value_type)/sizeof(int)>
 ~_Array_view_base () __GPU
 
- Public Member Functions inherited from Concurrency::details::_Array_view_shape< _Rank, _Element_size >
__declspec(property(get=get_extent)) Concurrency Concurrency::extent< _Rank > get_extent () const __GPU
 The extent of this array or view. More...
 
 ~_Array_view_shape () __GPU
 

Static Public Attributes

static const int rank = _Rank
 

Private Types

typedef _Array_view_base< _Rank, sizeof(_Value_type)/sizeof(int)> _Base
 

Private Member Functions

 _CPP_AMP_VERIFY_RANK (_Rank, array_view)
 
void _Project0 (int _I, array_view< _Value_type, _Rank-1 > &_Projected_view) const __GPU
 
 array_view () __GPU
 
 array_view (const array_view &_Other, const Concurrency::index< _Rank > &_Section_origin, const Concurrency::extent< _Rank > &_Section_extent) __GPU
 
 array_view (_Buffer_descriptor &_Src_buffer, const Concurrency::extent< _Rank > &_Extent) __GPU
 
void _Initialize () __GPU
 
void _Initialize (size_t _Src_data_size, bool _Discard_data=false) __CPU_ONLY
 

Static Private Member Functions

template<typename _T , int _R>
static array_view< _T, _R > _Convert (const _Array_view_base< _R, sizeof(_T)/sizeof(int)> &_Other) __GPU
 

Friends

class details::_Array_view_projection_helper< _Value_type, _Rank >
 
class details::_Array_view_projection_helper< _Value_type, _Rank+1 >
 
class array_view< _Value_type, _Rank >
 
class array_view< const _Value_type, _Rank >
 
class array_view< _Value_type, _Rank+1 >
 
class array_view< const _Value_type, _Rank+1 >
 
template<typename _T , int _R>
class array
 
const _Buffer_descriptordetails::_Get_buffer_descriptor (const array_view< _Value_type, _Rank > &_Array) __GPU
 

Additional Inherited Members

- Protected Member Functions inherited from Concurrency::details::_Array_view_base< _Rank, sizeof(_Value_type)/sizeof(int)>
 _Array_view_base () __GPU
 
 _Array_view_base (const _Buffer_descriptor &_Buffer_desc, const _Array_view_shape &_Shape) __GPU
 
 _Array_view_base (const _Array_view_base &_Other) __GPU
 
 _Array_view_base (const _Array_view_base &_Other, const Concurrency::extent< _Rank > &_Array_extent) __GPU
 
 _Array_view_base (const _Array_view_base &_Other, const Concurrency::index< _Rank > &_Section_origin, const Concurrency::extent< _Rank > &_Section_extent) __GPU
 
 _Array_view_base (const _Buffer_descriptor &_Buffer_desc, const Concurrency::extent< _Rank > &_Array_extent) __GPU
 
 _Array_view_base (const _Buffer_descriptor &_Buffer_desc, int _Base_linear_offset, const Concurrency::extent< _Rank > &_Array_extent) __GPU
 
 _Array_view_base (const _Buffer_descriptor &_Buffer_desc, int _Base_linear_offset, const Concurrency::extent< _Rank > &_Array_extent, const Concurrency::index< _Rank > &_View_offset, const Concurrency::extent< _Rank > &_View_extent) __GPU
 
 _Array_view_base (const _Buffer_descriptor &_Buffer_desc, const Concurrency::extent< _Rank > &_Array_extent, const Concurrency::index< _Rank > &_Section_origin, const Concurrency::extent< _Rank > &_Section_extent) __GPU
 
 _Array_view_base (const Concurrency::extent< _Rank > &_Array_extent) __CPU_ONLY
 
 _Array_view_base (_In_ void *_Data, const Concurrency::extent< _Rank > &_Array_extent) __CPU_ONLY
 
 _Array_view_base (_In_ void *_Data, const Concurrency::extent< _Rank > &_Array_extent) __GPU_ONLY
 
 _Array_view_base (const void *_Data, const Concurrency::extent< _Rank > &_Array_extent) __CPU_ONLY
 
 _Array_view_base (const void *_Data, const Concurrency::extent< _Rank > &_Array_extent) __GPU_ONLY
 
_Array_view_baseoperator= (const _Array_view_base &_Other) __GPU
 
_Ret_ void_Access (const index< _Rank > &_Index) const __GPU
 
_Ret_ void_Access (_Access_mode _Requested_mode, const index< _Rank > &_Index) const __CPU_ONLY
 
_Ret_ void_Access (_Access_mode _Requested_mode, const index< _Rank > &_Index) const __GPU_ONLY
 
_Array_view_base _Section (const Concurrency::index< _Rank > &_Section_origin, const Concurrency::extent< _Rank > &_Section_extent) const __GPU
 
_Array_view_base _Section (const index< _Rank > &_Idx) const __GPU
 
void _Project0 (int _I, _Array_view_base< _Rank-1, _Element_size > &_Projected_view) const __GPU
 
_Array_view_base< _Rank, _New_element_size > _Reinterpret_as () const __GPU
 
_Array_view_base< _New_rank, _Element_size > _View_as (const Concurrency::extent< _New_rank > &_View_extent) const __GPU
 
_Ret_ _View_shape_Create_buffer_view_shape () const __CPU_ONLY
 
- Protected Member Functions inherited from Concurrency::details::_Array_view_shape< _Rank, _Element_size >
int _Base_linear_offset () const __GPU
 
 _Array_view_shape (const _Array_view_shape &_Other) __GPU
 
 _Array_view_shape (const _Array_view_shape &_Other, const Concurrency::index< _Rank > &_Section_origin, const Concurrency::extent< _Rank > &_Section_extent) __GPU
 
 _Array_view_shape (int _Base_linear_offset, const Concurrency::extent< _Rank > &_Array_extent) __GPU
 
 _Array_view_shape (int _Base_linear_offset, const Concurrency::extent< _Rank > &_Array_extent, const Concurrency::index< _Rank > &_Section_origin, const Concurrency::extent< _Rank > &_Section_extent) __GPU
 
_Array_view_shapeoperator= (const _Array_view_shape &_Other) __GPU
 
void _Project0 (int _I, _Array_view_shape< _Rank-1, _Element_size > &_Projected_shape) const __GPU
 
 _Array_view_shape () __GPU
 
- Protected Attributes inherited from Concurrency::details::_Array_view_base< _Rank, sizeof(_Value_type)/sizeof(int)>
_Buffer_descriptor _M_buffer_descriptor
 
- Protected Attributes inherited from Concurrency::details::_Array_view_shape< _Rank, _Element_size >
Concurrency::extent< _Rank > _M_array_extent
 
Concurrency::extent< _Rank > _M_array_multiplier
 
Concurrency::index< _Rank > _M_view_offset
 
int _M_total_linear_offset
 
Concurrency::extent< _Rank > _M_view_extent
 

Detailed Description

template<typename _Value_type, int _Rank = 1>
class Concurrency::array_view< _Value_type, _Rank >

An array_view is an N-dimensional view over data held in another container (such as array<T,N> or other container. It exposes an indexing interface congruent to that of array<T,N>).

Parameters
_RankThe number of dimensions of this array_view.
_Value_typeThe type of the element.

Member Typedef Documentation

template<typename _Value_type, int _Rank = 1>
typedef _Array_view_base<_Rank, sizeof(_Value_type)/sizeof(int)> Concurrency::array_view< _Value_type, _Rank >::_Base
private
template<typename _Value_type, int _Rank = 1>
typedef _Value_type Concurrency::array_view< _Value_type, _Rank >::value_type

Constructor & Destructor Documentation

template<typename _Value_type, int _Rank = 1>
Concurrency::array_view< _Value_type, _Rank >::~array_view ( )
inline

Destroys this array_view and reclaims resources.

2229 {}
template<typename _Value_type, int _Rank = 1>
Concurrency::array_view< _Value_type, _Rank >::array_view ( array< _Value_type, _Rank > &  _Src)
inline

Construct an array_view which is bound to the data contained in the _Src array. The extent of the array_view is that of the _Src array, and the origin of the array view is at zero.

Parameters
_SrcAn array which contains the data that this array_view is bound to.
2239  : _Base(_Get_buffer_descriptor(_Src), _Src.extent)
2240  {
2241  _Initialize();
2242  }
_Array_view_base< _Rank, sizeof(_Value_type)/sizeof(int)> _Base
Definition: amp.h:2202
const _Buffer_descriptor & _Get_buffer_descriptor(const _Array_type &_Array) __GPU
Definition: xxamp.h:1064
void _Initialize() __GPU
Definition: amp.h:2973
template<typename _Value_type, int _Rank = 1>
Concurrency::array_view< _Value_type, _Rank >::array_view ( const array_view< _Value_type, _Rank > &  _Other)
inline

Copy constructor. Shallow copy.

2248  : _Base(_Other)
2249  {
2250  _Initialize();
2251  }
_Array_view_base< _Rank, sizeof(_Value_type)/sizeof(int)> _Base
Definition: amp.h:2202
void _Initialize() __GPU
Definition: amp.h:2973
template<typename _Value_type, int _Rank = 1>
Concurrency::array_view< _Value_type, _Rank >::array_view ( const Concurrency::extent< _Rank > &  _Extent)
inlineexplicit

Construct an array_view which is not bound to a data source.

Parameters
_ExtentThe extent of this array view.
2260  :_Base(_Extent)
2261  {
2262  _Initialize(_Extent.size(), true);
2263  }
unsigned int size() const __GPU
Returns the total linear size of this extent (in units of elements).
Definition: amp.h:521
_Array_view_base< _Rank, sizeof(_Value_type)/sizeof(int)> _Base
Definition: amp.h:2202
void _Initialize() __GPU
Definition: amp.h:2973
template<typename _Value_type, int _Rank = 1>
template<typename _Container >
Concurrency::array_view< _Value_type, _Rank >::array_view ( const Concurrency::extent< _Rank > &  _Extent,
_Container &  _Src 
)
inline

Construct an array_view which is bound to the data contained in the _Src container.

Parameters
_ExtentThe extent of this array view.
_SrcA container which contains the data that this array_view is bound to.
2275  :_Base(_Src.data(),_Extent)
2276  {
2277  static_assert( std::is_same<decltype(_Src.data()), _Value_type*>::value, "container element type and array view element type must match");
2278  _Initialize(_Src.size());
2279  }
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
_Array_view_base< _Rank, sizeof(_Value_type)/sizeof(int)> _Base
Definition: amp.h:2202
void _Initialize() __GPU
Definition: amp.h:2973
template<typename _Value_type, int _Rank = 1>
Concurrency::array_view< _Value_type, _Rank >::array_view ( const Concurrency::extent< _Rank > &  _Extent,
_Value_type *  _Src 
)
inline

Construct an array_view which is bound to the data pointed to by _Src.

Parameters
_ExtentThe extent of this array view.
_SrcA pointer to the source data this array_view will bind to. If the number of elements pointed to by _Src is less than the size of _Extent, undefined behavior results.
2292  :_Base(_Src,_Extent)
2293  {
2294  _Initialize();
2295  }
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
_Array_view_base< _Rank, sizeof(_Value_type)/sizeof(int)> _Base
Definition: amp.h:2202
void _Initialize() __GPU
Definition: amp.h:2973
template<typename _Value_type, int _Rank = 1>
Concurrency::array_view< _Value_type, _Rank >::array_view ( int  _E0)
inlineexplicit

Construct an array_view which is not bound to a data source.

Parameters
_E0An integer that is the length of this array_view.
2305  {
2306  static_assert(_Rank == 1, "rank must be 1");
2307  _Initialize(get_extent().size(), true);
2308  }
__declspec(property(get=get_extent)) Concurrency Concurrency::extent< _Rank > get_extent() const __GPU
The extent of this array or view.
Definition: amp.h:1538
_Array_view_base< _Rank, sizeof(_Value_type)/sizeof(int)> _Base
Definition: amp.h:2202
void _Initialize() __GPU
Definition: amp.h:2973
template<typename _Value_type, int _Rank = 1>
template<typename _Container >
Concurrency::array_view< _Value_type, _Rank >::array_view ( _Container &  _Src,
typename std::enable_if< details::_Is_container< _Container >::type::value, void ** >::type  = 0 
)
inlineexplicit

Construct an array_view which is bound to the data contained in the _Src container.

The length of the array_view is the same as the length of the container

Parameters
_SrcA container which contains the data that this array_view is bound to.
2318  :_Base(_Src.data(), Concurrency::extent<1>(static_cast<int>(_Src.size())))
2319  {
2320  if (_Src.size() > INT_MAX) {
2321  throw runtime_exception("Invalid _Src container argument - _Src size is greater than INT_MAX", E_INVALIDARG);
2322  }
2323  static_assert( std::is_same<decltype(_Src.data()), _Value_type*>::value, "container element type and array view element type must match");
2324  static_assert(_Rank == 1, "rank must be 1");
2325  _Initialize(_Src.size());
2326  }
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
_Array_view_base< _Rank, sizeof(_Value_type)/sizeof(int)> _Base
Definition: amp.h:2202
#define INT_MAX
Definition: limits.h:40
void _Initialize() __GPU
Definition: amp.h:2973
template<typename _Value_type, int _Rank = 1>
template<typename _Container >
Concurrency::array_view< _Value_type, _Rank >::array_view ( int  _E0,
_Container &  _Src 
)
inlineexplicit

Construct an array_view which is bound to the data contained in the _Src container.

Parameters
_E0An integer that is the length of this array_view.
_SrcA container which contains the data that this array_view is bound to.
2338  :_Base(_Src.data(), Concurrency::extent<1>(_E0))
2339  {
2340  static_assert( std::is_same<decltype(_Src.data()), _Value_type*>::value, "container element type and array view element type must match");
2341  static_assert(_Rank == 1, "rank must be 1");
2342  _Initialize(_Src.size());
2343  }
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
_Array_view_base< _Rank, sizeof(_Value_type)/sizeof(int)> _Base
Definition: amp.h:2202
void _Initialize() __GPU
Definition: amp.h:2973
template<typename _Value_type, int _Rank = 1>
Concurrency::array_view< _Value_type, _Rank >::array_view ( int  _E0,
int  _E1 
)
inlineexplicit

Construct an array_view which is not bound to a data source.

Parameters
_E0An integer that is the length of the most-significant dimension of this array_view.
_E1An integer that is the length of the least-significant dimension of this array_view.
2355  :_Base(Concurrency::extent<2>(_E0,_E1))
2356  {
2357  static_assert(_Rank == 2, "rank must be 2");
2358  _Initialize(get_extent().size(), true);
2359  }
__declspec(property(get=get_extent)) Concurrency Concurrency::extent< _Rank > get_extent() const __GPU
The extent of this array or view.
Definition: amp.h:1538
_Array_view_base< _Rank, sizeof(_Value_type)/sizeof(int)> _Base
Definition: amp.h:2202
void _Initialize() __GPU
Definition: amp.h:2973
template<typename _Value_type, int _Rank = 1>
template<typename _Container >
Concurrency::array_view< _Value_type, _Rank >::array_view ( int  _E0,
int  _E1,
_Container &  _Src 
)
inlineexplicit

Construct an array_view which is bound to the data contained in the _Src container.

Parameters
_E0An integer that is the length of the most-significant dimension of this array_view.
_E1An integer that is the length of the least-significant dimension of this array_view.
_SrcA container which contains the data that this array_view is bound to.
2374  :_Base(_Src.data(), Concurrency::extent<2>(_E0,_E1))
2375  {
2376  static_assert( std::is_same<decltype(_Src.data()), _Value_type*>::value, "container element type and array view element type must match");
2377  static_assert(_Rank == 2, "rank must be 2");
2378  _Initialize(_Src.size());
2379  }
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
_Array_view_base< _Rank, sizeof(_Value_type)/sizeof(int)> _Base
Definition: amp.h:2202
void _Initialize() __GPU
Definition: amp.h:2973
template<typename _Value_type, int _Rank = 1>
Concurrency::array_view< _Value_type, _Rank >::array_view ( int  _E0,
int  _E1,
int  _E2 
)
inlineexplicit

Construct an array_view which is not bound to a data source.

Parameters
_E0An integer that is the length of the most-significant dimension of this array_view.
_E1An integer that is the length of the next-to-most-significant dimension of this array_view.
_E2An integer that is the length of the least-significant dimension of this array_view.
2394  :_Base(Concurrency::extent<3>(_E0,_E1,_E2))
2395  {
2396  static_assert(_Rank == 3, "rank must be 3");
2397  _Initialize(get_extent().size(), true);
2398  }
__declspec(property(get=get_extent)) Concurrency Concurrency::extent< _Rank > get_extent() const __GPU
The extent of this array or view.
Definition: amp.h:1538
_Array_view_base< _Rank, sizeof(_Value_type)/sizeof(int)> _Base
Definition: amp.h:2202
void _Initialize() __GPU
Definition: amp.h:2973
template<typename _Value_type, int _Rank = 1>
template<typename _Container >
Concurrency::array_view< _Value_type, _Rank >::array_view ( int  _E0,
int  _E1,
int  _E2,
_Container &  _Src 
)
inlineexplicit

Construct an array_view which is bound to the data contained in the _Src container.

Parameters
_E0An integer that is the length of the most-significant dimension of this array_view.
_E1An integer that is the length of the next-to-most-significant dimension of this array_view.
_E2An integer that is the length of the least-significant dimension of this array_view.
_SrcA container which contains the data that this array_view is bound to.
2416  :_Base(_Src.data(), Concurrency::extent<3>(_E0,_E1,_E2))
2417  {
2418  static_assert( std::is_same<decltype(_Src.data()), _Value_type*>::value, "container element type and array view element type must match");
2419  static_assert(_Rank == 3, "rank must be 3");
2420  _Initialize(_Src.size());
2421  }
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
_Array_view_base< _Rank, sizeof(_Value_type)/sizeof(int)> _Base
Definition: amp.h:2202
void _Initialize() __GPU
Definition: amp.h:2973
template<typename _Value_type, int _Rank = 1>
Concurrency::array_view< _Value_type, _Rank >::array_view ( int  _E0,
_In_ _Value_type *  _Src 
)
inlineexplicit

Construct an array_view which is bound to the data pointed to by _Src.

Parameters
_E0An integer that is the length of this array_view.
_SrcA container which contains the data that this array_view is bound to. If the number of elements pointed to by _Src is less than _E0, undefined behavior results.
2435  {
2436  static_assert(_Rank == 1, "rank must be 1");
2437  _Initialize();
2438  }
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
_Array_view_base< _Rank, sizeof(_Value_type)/sizeof(int)> _Base
Definition: amp.h:2202
void _Initialize() __GPU
Definition: amp.h:2973
template<typename _Value_type, int _Rank = 1>
template<typename _Arr_type , int _Size>
Concurrency::array_view< _Value_type, _Rank >::array_view ( _In_ _Arr_type(&)  _Src[_Size])
inlineexplicit

Construct an array_view which is bound to the array _Src.

Parameters
_SrcAn array which contains the data that this array_view is bound to.
2448  {
2449  static_assert( std::is_same<typename std::remove_reference<decltype(*_Src)>::type, _Value_type>::value, "container element type and array view element type must match");
2450  static_assert(_Rank == 1, "rank must be 1");
2451  _Initialize();
2452  }
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
_Array_view_base< _Rank, sizeof(_Value_type)/sizeof(int)> _Base
Definition: amp.h:2202
_Check_return_ _In_ long _Size
Definition: io.h:325
void _Initialize() __GPU
Definition: amp.h:2973
template<typename _Value_type, int _Rank = 1>
Concurrency::array_view< _Value_type, _Rank >::array_view ( int  _E0,
int  _E1,
_In_ _Value_type *  _Src 
)
inlineexplicit

Construct an array_view which is bound to the data pointed to by _Src.

Parameters
_E0An integer that is the length of the most-significant dimension of this array_view.
_E1An integer that is the length of the least-significant dimension of this array_view.
_SrcA container which contains the data that this array_view is bound to. If the number of elements pointed to by _Src is less than _E0*_E1, undefined behavior results.
2468  :_Base(_Src, Concurrency::extent<2>(_E0,_E1))
2469  {
2470  static_assert(_Rank == 2, "rank must be 2");
2471  _Initialize();
2472  }
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
_Array_view_base< _Rank, sizeof(_Value_type)/sizeof(int)> _Base
Definition: amp.h:2202
void _Initialize() __GPU
Definition: amp.h:2973
template<typename _Value_type, int _Rank = 1>
Concurrency::array_view< _Value_type, _Rank >::array_view ( int  _E0,
int  _E1,
int  _E2,
_In_ _Value_type *  _Src 
)
inlineexplicit

Construct an array_view which is bound to the data pointed to by _Src.

Parameters
_E0An integer that is the length of the most-significant dimension of this array_view.
_E1An integer that is the length of the next-to-most-significant dimension of this array_view.
_E2An integer that is the length of the least-significant dimension of this array_view.
_SrcA container which contains the data that this array_view is bound to. If the number of elements pointed to by _Src is less than _E0*_E1*_E2, undefined behavior results.
2491  :_Base(_Src, Concurrency::extent<3>(_E0,_E1,_E2))
2492  {
2493  static_assert(_Rank == 3, "rank must be 3");
2494  _Initialize();
2495  }
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
_Array_view_base< _Rank, sizeof(_Value_type)/sizeof(int)> _Base
Definition: amp.h:2202
void _Initialize() __GPU
Definition: amp.h:2973
template<typename _Value_type, int _Rank = 1>
Concurrency::array_view< _Value_type, _Rank >::array_view ( )
inlineprivate
2959 {}
template<typename _Value_type, int _Rank = 1>
Concurrency::array_view< _Value_type, _Rank >::array_view ( const array_view< _Value_type, _Rank > &  _Other,
const Concurrency::index< _Rank > &  _Section_origin,
const Concurrency::extent< _Rank > &  _Section_extent 
)
inlineprivate
2962  :_Base(_Other, _Section_origin, _Section_extent)
2963  {
2964  _Initialize();
2965  }
_Array_view_base< _Rank, sizeof(_Value_type)/sizeof(int)> _Base
Definition: amp.h:2202
void _Initialize() __GPU
Definition: amp.h:2973
template<typename _Value_type, int _Rank = 1>
Concurrency::array_view< _Value_type, _Rank >::array_view ( _Buffer_descriptor _Src_buffer,
const Concurrency::extent< _Rank > &  _Extent 
)
inlineprivate
2968  :_Base(_Src_buffer,_Extent)
2969  {
2970  _Initialize();
2971  }
_Array_view_base< _Rank, sizeof(_Value_type)/sizeof(int)> _Base
Definition: amp.h:2202
void _Initialize() __GPU
Definition: amp.h:2973

Member Function Documentation

template<typename _Value_type, int _Rank = 1>
Concurrency::array_view< _Value_type, _Rank >::__declspec ( property(get=get_source_accelerator_view )
template<typename _Value_type, int _Rank = 1>
template<typename _T , int _R>
static array_view<_T,_R> Concurrency::array_view< _Value_type, _Rank >::_Convert ( const _Array_view_base< _R, sizeof(_T)/sizeof(int)> &  _Other)
inlinestaticprivate
2948  {
2949  static_assert(sizeof(array_view<_T,_R>) == sizeof(_Array_view_base<_R,sizeof(_T)/sizeof(int)>), "ASSERT FAILURE: implementation relies on binary conversion between the two");
2950  return (*reinterpret_cast<const array_view<_T,_R>*>(&_Other));
2951  }
#define _T(x)
Definition: tchar.h:2498
template<typename _Value_type, int _Rank = 1>
Concurrency::array_view< _Value_type, _Rank >::_CPP_AMP_VERIFY_RANK ( _Rank  ,
array_view< _Value_type, _Rank >   
)
private
template<typename _Value_type, int _Rank = 1>
void Concurrency::array_view< _Value_type, _Rank >::_Initialize ( )
inlineprivate
2974  {
2975  // Set the type access mode
2977  }
_Access_mode _M_type_access_mode
Definition: amprt.h:449
Definition: amprt.h:88
template<typename _Value_type, int _Rank = 1>
void Concurrency::array_view< _Value_type, _Rank >::_Initialize ( size_t  _Src_data_size,
bool  _Discard_data = false 
)
inlineprivate
2980  {
2981  // Ensure that the _Src_data_size is at least as big as the size
2982  // of the array_view
2983  if (_Src_data_size < this->extent.size()) {
2984  throw runtime_exception("Invalid _Src container argument - _Src size is less than the size of the array_view.", E_INVALIDARG);
2985  }
2986 
2987  _Initialize();
2988 
2989  if (_Discard_data) {
2990  discard_data();
2991  }
2992  }
void discard_data() const __CPU_ONLY
Discards the current data underlying this view. This is an optimization hint to the runtime used to a...
Definition: amp.h:2924
void _Initialize() __GPU
Definition: amp.h:2973
template<typename _Value_type, int _Rank = 1>
void Concurrency::array_view< _Value_type, _Rank >::_Project0 ( int  _I,
array_view< _Value_type, _Rank-1 > &  _Projected_view 
) const
inlineprivate
2954  {
2955  _Base::_Project0(_I, _Projected_view);
2956  _Projected_view._Initialize();
2957  }
void _Project0(int _I, _Array_view_base< _Rank-1, _Element_size > &_Projected_view) const __GPU
Definition: amp.h:1866
template<typename _Value_type, int _Rank = 1>
void Concurrency::array_view< _Value_type, _Rank >::copy_to ( array< _Value_type, _Rank > &  _Dest) const
inline

Copies elements from this array_view to the destination array.

2510  {
2511  copy(*this,_Dest);
2512  }
void copy(const array< _Value_type, _Rank > &_Src, array< _Value_type, _Rank > &_Dest)
Copies the contents of the source array into the destination array.
Definition: amp.h:5976
template<typename _Value_type, int _Rank = 1>
void Concurrency::array_view< _Value_type, _Rank >::copy_to ( const array_view< _Value_type, _Rank > &  _Dest) const
inline

Copies elements from this array_view to the destination array_view.

2518  {
2519  copy(*this,_Dest);
2520  }
void copy(const array< _Value_type, _Rank > &_Src, array< _Value_type, _Rank > &_Dest)
Copies the contents of the source array into the destination array.
Definition: amp.h:5976
template<typename _Value_type, int _Rank = 1>
_Ret_ _Value_type* Concurrency::array_view< _Value_type, _Rank >::data ( ) const
inline

Returns a pointer to the raw data of this array_view.

2792  {
2793  static_assert(_Rank == 1, "array_view::data() is only permissible on array_view<T, 1>");
2794  return &this->operator[](index<_Rank>());
2795  }
details::_Projection_result_type< _Value_type, _Rank >::_Result_type operator[](int _I) const __GPU
Projects the most-significant dimension of this array_view. If the array_view rank is 1...
Definition: amp.h:2532
template<typename _Value_type, int _Rank = 1>
void Concurrency::array_view< _Value_type, _Rank >::discard_data ( ) const
inline

Discards the current data underlying this view. This is an optimization hint to the runtime used to avoid copying the current contents of the view to a target accelerator_view that it is accessed on, and its use is recommended if the existing content is not needed. This method is only available in a restrict(cpu) context and cannot be used in a restrict(amp) context.

2925  {
2927  }
_Ret_ _View_key _Get_view_key()
Definition: amprt.h:532
_Ret_ _Ubiquitous_buffer * _Get_buffer_ptr() const __CPU_ONLY
Definition: amprt.h:497
_AMPIMP void _Discard(_In_ _View_key _Key)
template<typename _Value_type, int _Rank = 1>
value_type& Concurrency::array_view< _Value_type, _Rank >::get_ref ( const index< _Rank > &  _Index) const
inline

Get a reference to the element indexed by _Index. Unlike the other indexing operators for accessing the array_view on the CPU, this method does not implicitly synchronize this array_view's contents to the CPU. After accessing the array_view on a remote location or performing a copy operation involving this array_view users are responsible to explicitly synchronize the array_view to the CPU before calling this method. Failure to do so results in undefined behavior.

Parameters
_IndexThe index.
Returns
Reference to the element indexed by _Index
2551  {
2552  void *_Ptr = _Access(_Index);
2553  return *reinterpret_cast<value_type*>(_Ptr);
2554  }
_Value_type value_type
Definition: amp.h:2223
_Ret_ void * _Access(const index< _Rank > &_Index) const __GPU
Definition: amp.h:1828
template<typename _Value_type, int _Rank = 1>
accelerator_view Concurrency::array_view< _Value_type, _Rank >::get_source_accelerator_view ( ) const
inline

Returns the accelerator_view where the data source of the array_view is located. If the array_view does not have a data source, this API throws a runtime_exception

2934  {
2937  }
2938  else {
2939  throw runtime_exception("Cannot query source accelerator_view for an array_view without a data source.", E_INVALIDARG);
2940  }
2941  }
_AMPIMP accelerator_view _Get_master_accelerator_view() const
_Ret_ _Ubiquitous_buffer * _Get_buffer_ptr() const __CPU_ONLY
Definition: amprt.h:497
bool _Has_data_source() const
Definition: amprt.h:3320
template<typename _Value_type, int _Rank = 1>
value_type& Concurrency::array_view< _Value_type, _Rank >::operator() ( const index< _Rank > &  _Index) const
inline

Get the element value indexed by _I

Parameters
_IThe index.
Returns
The element value indexed by _I
2580  {
2581  void * _Ptr = _Access(_Read_write_access, _Index);
2582  return *reinterpret_cast<value_type*>(_Ptr);
2583  }
_Value_type value_type
Definition: amp.h:2223
Definition: amprt.h:88
_Ret_ void * _Access(const index< _Rank > &_Index) const __GPU
Definition: amp.h:1828
template<typename _Value_type, int _Rank = 1>
details::_Projection_result_type<_Value_type,_Rank>::_Result_type Concurrency::array_view< _Value_type, _Rank >::operator() ( int  _I) const
inline

Projects the most-significant dimension of this array_view. If the array_view rank is 1, this produces a single element; otherwise it produces an array_view with one fewer dimensions.

Parameters
_IThe most-significant index component
Returns
The element at index component _I, or an array_view projected on the most-significant dimension.
2596  {
2598  }
static _Projection_result_type< _T, _R >::_Result_type _Project0(const array_view< _T, _R > *_Arr_view, int _I) __GPU
Definition: xxamp_inl.h:42
template<typename _Value_type, int _Rank = 1>
value_type& Concurrency::array_view< _Value_type, _Rank >::operator() ( int  _I0,
int  _I1 
) const
inline

Get the element value indexed by (_I0,_I1)

Parameters
_I0The most-significant component of the index
_I1The least-significant component of the index
Returns
The element value indexed by (_I0,_I1)
2613  {
2614  static_assert(_Rank == 2, "value_type& array_view::operator()(int,int) is only permissible on array_view<T, 2>");
2615  return this->operator()(index<2>(_I0,_I1));
2616  }
value_type & operator()(const index< _Rank > &_Index) const __GPU
Get the element value indexed by _I
Definition: amp.h:2579
template<typename _Value_type, int _Rank = 1>
value_type& Concurrency::array_view< _Value_type, _Rank >::operator() ( int  _I0,
int  _I1,
int  _I2 
) const
inline

Get the element value indexed by (_I0,_I1,_I2)

Parameters
_I0The most-significant component of the index
_I1The next-to-most-significant component of the index
_I2The least-significant component of the index
Returns
The element value indexed by (_I0,_I1,_I2)
2634  {
2635  static_assert(_Rank == 3, "value_type& array_view::operator()(int,int,int) is only permissible on array_view<T, 3>");
2636  return this->operator()(index<3>(_I0,_I1,_I2));
2637  }
value_type & operator()(const index< _Rank > &_Index) const __GPU
Get the element value indexed by _I
Definition: amp.h:2579
template<typename _Value_type, int _Rank = 1>
array_view& Concurrency::array_view< _Value_type, _Rank >::operator= ( const array_view< _Value_type, _Rank > &  _Other)
inline

Copy Assignment operator. Shallow copy.

2501  {
2502  _Base::operator=(_Other);
2503  return *this;
2504  }
_Array_view_base & operator=(const _Array_view_base &_Other) __GPU
Definition: amp.h:1811
template<typename _Value_type, int _Rank = 1>
details::_Projection_result_type<_Value_type,_Rank>::_Result_type Concurrency::array_view< _Value_type, _Rank >::operator[] ( int  _I) const
inline

Projects the most-significant dimension of this array_view. If the array_view rank is 1, this produces a single element; otherwise it produces an array_view with one fewer dimensions.

Parameters
_IThe most-significant index component
Returns
The element at index component _I, or an array_view projected on the most-significant dimension.
2533  {
2535  }
static _Projection_result_type< _T, _R >::_Result_type _Project0(const array_view< _T, _R > *_Arr_view, int _I) __GPU
Definition: xxamp_inl.h:42
template<typename _Value_type, int _Rank = 1>
value_type& Concurrency::array_view< _Value_type, _Rank >::operator[] ( const index< _Rank > &  _Index) const
inline

Get the element value indexed by _I

Parameters
_IThe index.
Returns
The element value indexed by _I
2566  {
2567  return this->operator()(_Index);
2568  }
value_type & operator()(const index< _Rank > &_Index) const __GPU
Get the element value indexed by _I
Definition: amp.h:2579
template<typename _Value_type, int _Rank = 1>
void Concurrency::array_view< _Value_type, _Rank >::refresh ( ) const
inline

Informs the array_view that its bound memory has been modified outside the array_view interface. This will render all cached information stale.

2802  {
2803  // If the array_view corresponds to a ubiquitous buffer with no data source,
2804  // then refresh is a no-op
2806  return;
2807  }
2808 
2809  _Buffer_ptr _PBuf;
2811  }
details::_Reference_counted_obj_ptr< details::_Buffer > _Buffer_ptr
Definition: amprt.h:302
_Event _Get_access_async(const _View_key _Key, accelerator_view _Av, _Access_mode _Mode, _Buffer_ptr &_Buf_ptr)
Definition: amprt.h:3457
_AMPIMP accelerator_view _Get_master_accelerator_view() const
_Ret_ _View_key _Get_view_key()
Definition: amprt.h:532
_Ret_ _Ubiquitous_buffer * _Get_buffer_ptr() const __CPU_ONLY
Definition: amprt.h:497
Definition: amprt.h:86
bool _Has_data_source() const
Definition: amprt.h:3320
template<typename _Value_type, int _Rank = 1>
template<typename _Value_type2 >
array_view<_Value_type2, _Rank> Concurrency::array_view< _Value_type, _Rank >::reinterpret_as ( ) const
inline

Produces a (possibly unsafe) reinterpretation of this array_view that is linear and with a different element type. The size of _Value_type2 must evenly divide into the size of this array.

Returns
A linear array_view with a reinterpreted element type.
2770  {
2771  return _Convert<_Value_type2>(this->template _Reinterpret_as<sizeof(_Value_type2)/sizeof(int)>());
2772  }
_Array_view_base< _Rank, _New_element_size > _Reinterpret_as() const __GPU
Definition: amp.h:1876
template<typename _Value_type, int _Rank = 1>
array_view Concurrency::array_view< _Value_type, _Rank >::section ( const Concurrency::index< _Rank > &  _Section_origin,
const Concurrency::extent< _Rank > &  _Section_extent 
) const
inline

Produces a subsection of the source array_view at the given origin and extent.

Parameters
_Section_originThe origin of the section.
_Section_extentThe extent of the section
Returns
A subsection of the array_view.
2652  {
2653  return _Convert<_Value_type>(_Section(_Section_origin, _Section_extent));
2654  }
_Array_view_base _Section(const Concurrency::index< _Rank > &_Section_origin, const Concurrency::extent< _Rank > &_Section_extent) const __GPU
Definition: amp.h:1851
template<typename _Value_type, int _Rank = 1>
array_view Concurrency::array_view< _Value_type, _Rank >::section ( const Concurrency::index< _Rank > &  _Idx) const
inline

Produces a subsection of the source array_view with origin specified by an index, with an extent of (this->exent - _Idx).

Parameters
_IdxThe index that specifies the origin of this section.
Returns
A subsection of the array_view.
2667  {
2668  return section(_Idx, this->extent - _Idx);
2669  }
array_view section(const Concurrency::index< _Rank > &_Section_origin, const Concurrency::extent< _Rank > &_Section_extent) const __GPU
Produces a subsection of the source array_view at the given origin and extent.
Definition: amp.h:2651
template<typename _Value_type, int _Rank = 1>
array_view Concurrency::array_view< _Value_type, _Rank >::section ( const Concurrency::extent< _Rank > &  _Ext) const
inline

Produces a subsection of the source array_view with origin of zero, with an extent of _Ext.

Parameters
_ExtThe extent of this section
Returns
A subsection of the array_view.
2682  {
2683  return section(Concurrency::index<_Rank>(), _Ext);
2684  }
array_view section(const Concurrency::index< _Rank > &_Section_origin, const Concurrency::extent< _Rank > &_Section_extent) const __GPU
Produces a subsection of the source array_view at the given origin and extent.
Definition: amp.h:2651
Define an N-dimensional index point; which may also be viewed as a vector based at the origin in N-sp...
Definition: amp.h:53
template<typename _Value_type, int _Rank = 1>
array_view Concurrency::array_view< _Value_type, _Rank >::section ( int  _I0,
int  _E0 
) const
inline

Produces a one-dimensional subsection of the source array_view with origin specified by the index components _I0, with extent _E0.

Parameters
_I0The origin of this section.
_E0The extent of this section.
Returns
A subsection of the array_view.
2700  {
2701  static_assert(_Rank == 1, "rank must be 1");
2703  }
array_view section(const Concurrency::index< _Rank > &_Section_origin, const Concurrency::extent< _Rank > &_Section_extent) const __GPU
Produces a subsection of the source array_view at the given origin and extent.
Definition: amp.h:2651
Define an N-dimensional index point; which may also be viewed as a vector based at the origin in N-sp...
Definition: amp.h:53
template<typename _Value_type, int _Rank = 1>
array_view Concurrency::array_view< _Value_type, _Rank >::section ( int  _I0,
int  _I1,
int  _E0,
int  _E1 
) const
inline

Produces a two-dimensional subsection of the source array_view with origin specified by the index components (_I0,_I1), with extent (_E0,_E1).

Parameters
_I0The most-significant component of the origin of this section.
_I1The least-significant component of the origin of this section.
_E0The most-significant component of the extent of this section.
_E1The least-significant component of the extent of this section.
Returns
A subsection of the array_view.
2725  {
2726  static_assert(_Rank == 2, "rank must be 2");
2727  return section(Concurrency::index<2>(_I0,_I1), Concurrency::extent<2>(_E0,_E1));
2728  }
array_view section(const Concurrency::index< _Rank > &_Section_origin, const Concurrency::extent< _Rank > &_Section_extent) const __GPU
Produces a subsection of the source array_view at the given origin and extent.
Definition: amp.h:2651
Define an N-dimensional index point; which may also be viewed as a vector based at the origin in N-sp...
Definition: amp.h:53
template<typename _Value_type, int _Rank = 1>
array_view Concurrency::array_view< _Value_type, _Rank >::section ( int  _I0,
int  _I1,
int  _I2,
int  _E0,
int  _E1,
int  _E2 
) const
inline

Produces a three-dimensional subsection of the source array_view with origin specified by the index components (_I0,_I1,_I2), with extent (_E0,_E1,_E2).

Parameters
_I0The most-significant component of the origin of this section.
_I1The next-to-most-significant component of the origin of this section.
_I2The least-significant component of the origin of this section.
_E0The most-significant component of the extent of this section.
_E1The next-to-most-significant component of the extent of this section.
_E2The least-significant component of the extent of this section.
Returns
A subsection of the array_view.
2756  {
2757  static_assert(_Rank == 3, "rank must be 3");
2758  return section(Concurrency::index<3>(_I0,_I1,_I2), Concurrency::extent<3>(_E0,_E1,_E2));
2759  }
array_view section(const Concurrency::index< _Rank > &_Section_origin, const Concurrency::extent< _Rank > &_Section_extent) const __GPU
Produces a subsection of the source array_view at the given origin and extent.
Definition: amp.h:2651
Define an N-dimensional index point; which may also be viewed as a vector based at the origin in N-sp...
Definition: amp.h:53
template<typename _Value_type, int _Rank = 1>
void Concurrency::array_view< _Value_type, _Rank >::synchronize ( access_type  _Access_type = access_type_read) const
inline

Synchronizes any modifications made to "this" array_view to its source data.

Parameters
_Access_typeThe desired access_type on the target accelerator_view. This parameter has a default value of access_type_read.
2900  {
2902 
2903  _Buffer_ptr _PBuf;
2904 
2905  // If the array_view corresponds to a ubiquitous buffer with no data source, then synchronize is a no-op
2907  {
2910  _Get_synchronize_access_mode(_Access_type),
2911  _PBuf)._Get();
2912  }
2913 
2915  }
details::_Reference_counted_obj_ptr< details::_Buffer > _Buffer_ptr
Definition: amprt.h:302
_Event _Get_access_async(const _View_key _Key, accelerator_view _Av, _Access_mode _Mode, _Buffer_ptr &_Buf_ptr)
Definition: amprt.h:3457
_AMPIMP _Ret_ _Amp_runtime_trace *__cdecl _Get_amp_trace()
_AMPIMP accelerator_view _Get_master_accelerator_view() const
_Ret_ _View_key _Get_view_key()
Definition: amprt.h:532
_AMPIMP ULONG _Start_array_view_synchronize_event_helper(const _Buffer_descriptor &_Buff_desc)
Definition: amprt.h:99
_Ret_ _Ubiquitous_buffer * _Get_buffer_ptr() const __CPU_ONLY
Definition: amprt.h:497
_Access_mode _Get_synchronize_access_mode(access_type cpu_access_type)
Definition: amprt.h:2003
bool _Has_data_source() const
Definition: amprt.h:3320
_AMPIMP void _Write_end_event(ULONG _Span_id)
template<typename _Value_type, int _Rank = 1>
concurrency::completion_future Concurrency::array_view< _Value_type, _Rank >::synchronize_async ( access_type  _Access_type = access_type_read) const
inline

Asynchronously synchronizes any modifications made to "this" array_view to its source data.

Parameters
_Access_typeThe desired access_type on the target accelerator_view. This parameter has a default value of access_type_read.
Returns
A future upon which to wait for the operation to complete.
2851  {
2853 
2854  _Buffer_ptr _PBuf;
2855  _Event _Ev;
2856 
2857  // If the array_view corresponds to a ubiquitous buffer with no data source, then synchronize is a no-op
2859  {
2862  _Get_synchronize_access_mode(_Access_type),
2863  _PBuf);
2864  }
2865 
2866  return details::_Get_amp_trace()->_Start_async_op_wait_event_helper(_Async_op_id, _Ev);
2867  }
details::_Reference_counted_obj_ptr< details::_Buffer > _Buffer_ptr
Definition: amprt.h:302
_Event _Get_access_async(const _View_key _Key, accelerator_view _Av, _Access_mode _Mode, _Buffer_ptr &_Buf_ptr)
Definition: amprt.h:3457
_AMPIMP _Ret_ _Amp_runtime_trace *__cdecl _Get_amp_trace()
_AMPIMP accelerator_view _Get_master_accelerator_view() const
_Ret_ _View_key _Get_view_key()
Definition: amprt.h:532
_AMPIMP ULONG _Launch_array_view_synchronize_event_helper(const _Buffer_descriptor &_Buff_desc)
Definition: amprt.h:99
_Ret_ _Ubiquitous_buffer * _Get_buffer_ptr() const __CPU_ONLY
Definition: amprt.h:497
Definition: amprt.h:312
_Access_mode _Get_synchronize_access_mode(access_type cpu_access_type)
Definition: amprt.h:2003
bool _Has_data_source() const
Definition: amprt.h:3320
concurrency::completion_future _Start_async_op_wait_event_helper(ULONG _Async_op_id, _Event _Ev)
Definition: amprt.h:3912
template<typename _Value_type, int _Rank = 1>
void Concurrency::array_view< _Value_type, _Rank >::synchronize_to ( const accelerator_view _Accl_view,
access_type  _Access_type = access_type_read 
) const
inline

Synchronizes any modifications made to "this" array_view to the specified accelerator_view.

Parameters
_Accl_viewThe target accelerator_view to synchronize to.
_Access_typeThe desired access_type on the target accelerator_view. This parameter has a default value of access_type_read.
2880  {
2882 
2883  _Buffer_ptr _PBuf;
2884 
2885  if (_Access_type != access_type_none) {
2886  _Get_access_async(_M_buffer_descriptor._Get_view_key(), _Accl_view, _Get_synchronize_access_mode(_Access_type), _PBuf)._Get();
2887  }
2888 
2890  }
details::_Reference_counted_obj_ptr< details::_Buffer > _Buffer_ptr
Definition: amprt.h:302
_Event _Get_access_async(const _View_key _Key, accelerator_view _Av, _Access_mode _Mode, _Buffer_ptr &_Buf_ptr)
Definition: amprt.h:3457
_AMPIMP _Ret_ _Amp_runtime_trace *__cdecl _Get_amp_trace()
_Ret_ _View_key _Get_view_key()
Definition: amprt.h:532
_AMPIMP ULONG _Start_array_view_synchronize_event_helper(const _Buffer_descriptor &_Buff_desc)
Definition: amprt.h:99
_Access_mode _Get_synchronize_access_mode(access_type cpu_access_type)
Definition: amprt.h:2003
_AMPIMP void _Write_end_event(ULONG _Span_id)
template<typename _Value_type, int _Rank = 1>
concurrency::completion_future Concurrency::array_view< _Value_type, _Rank >::synchronize_to_async ( const accelerator_view _Accl_view,
access_type  _Access_type = access_type_read 
) const
inline

Asynchronously synchronizes any modifications made to "this" array_view to the specified accelerator_view.

Parameters
_Accl_viewThe target accelerator_view to synchronize to.
_Access_typeThe desired access_type on the target accelerator_view. This parameter has a default value of access_type_read.
Returns
A future upon which to wait for the operation to complete.
2827  {
2829 
2830  _Buffer_ptr _PBuf;
2831  _Event _Ev;
2832 
2833  if (_Access_type != access_type_none) {
2834  _Ev = _Get_access_async(_M_buffer_descriptor._Get_view_key(), _Accl_view, _Get_synchronize_access_mode(_Access_type), _PBuf);
2835  }
2836 
2837  return details::_Get_amp_trace()->_Start_async_op_wait_event_helper(_Async_op_id, _Ev);
2838  }
details::_Reference_counted_obj_ptr< details::_Buffer > _Buffer_ptr
Definition: amprt.h:302
_Event _Get_access_async(const _View_key _Key, accelerator_view _Av, _Access_mode _Mode, _Buffer_ptr &_Buf_ptr)
Definition: amprt.h:3457
_AMPIMP _Ret_ _Amp_runtime_trace *__cdecl _Get_amp_trace()
_Ret_ _View_key _Get_view_key()
Definition: amprt.h:532
_AMPIMP ULONG _Launch_array_view_synchronize_event_helper(const _Buffer_descriptor &_Buff_desc)
Definition: amprt.h:99
Definition: amprt.h:312
_Access_mode _Get_synchronize_access_mode(access_type cpu_access_type)
Definition: amprt.h:2003
concurrency::completion_future _Start_async_op_wait_event_helper(ULONG _Async_op_id, _Event _Ev)
Definition: amprt.h:3912
template<typename _Value_type, int _Rank = 1>
template<int _New_rank>
array_view<_Value_type,_New_rank> Concurrency::array_view< _Value_type, _Rank >::view_as ( const Concurrency::extent< _New_rank > &  _View_extent) const
inline

Produces an array_view of a different rank over this array_view's data.

Parameters
_View_extentThe reshaping extent.
Returns
A reshaped array_view.
2784  {
2785  return _Convert<_Value_type>(_View_as(_View_extent));
2786  }
_Array_view_base< _New_rank, _Element_size > _View_as(const Concurrency::extent< _New_rank > &_View_extent) const __GPU
Definition: amp.h:1886

Friends And Related Function Documentation

template<typename _Value_type, int _Rank = 1>
template<typename _T , int _R>
friend class array
friend
template<typename _Value_type, int _Rank = 1>
friend class array_view< _Value_type, _Rank >
friend
template<typename _Value_type, int _Rank = 1>
friend class array_view< _Value_type, _Rank+1 >
friend
template<typename _Value_type, int _Rank = 1>
friend class array_view< const _Value_type, _Rank >
friend
template<typename _Value_type, int _Rank = 1>
friend class array_view< const _Value_type, _Rank+1 >
friend
template<typename _Value_type, int _Rank = 1>
friend class details::_Array_view_projection_helper< _Value_type, _Rank >
friend
template<typename _Value_type, int _Rank = 1>
friend class details::_Array_view_projection_helper< _Value_type, _Rank+1 >
friend
template<typename _Value_type, int _Rank = 1>
const _Buffer_descriptor& details::_Get_buffer_descriptor ( const array_view< _Value_type, _Rank > &  _Array)
friend

Member Data Documentation

template<typename _Value_type, int _Rank = 1>
const int Concurrency::array_view< _Value_type, _Rank >::rank = _Rank
static

The documentation for this class was generated from the following file: