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<int _Size>
 array_view (_In_ _Value_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_type & get_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_type & operator[] (const index< _Rank > &_Index) const __GPU
 Get the element value indexed by _I More...
 
_Value_type & operator() (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_type & operator() (int _I0, int _I1) const __GPU
 Get the element value indexed by (_I0,_I1) More...
 
_Value_type & operator() (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< _Rank, _Element_size > &_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) __CPU_ONLY
 
 _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_ONLY
 
 _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, 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.

2265 {}
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.
2275  : _Base(_Get_buffer_descriptor(_Src), _Src.extent)
2276  {
2277  _Initialize();
2278  }
_Array_view_base< _Rank, sizeof(_Value_type)/sizeof(int)> _Base
Definition: amp.h:2238
const _Buffer_descriptor & _Get_buffer_descriptor(const _Array_type &_Array) __GPU
Definition: xxamp.h:1063
void _Initialize() __GPU
Definition: amp.h:3008
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.

2284  : _Base(_Other)
2285  {
2286  _Initialize();
2287  }
_Array_view_base< _Rank, sizeof(_Value_type)/sizeof(int)> _Base
Definition: amp.h:2238
void _Initialize() __GPU
Definition: amp.h:3008
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.
2296  :_Base(_Extent)
2297  {
2298  _Initialize(_Extent.size(), true);
2299  }
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:2238
void _Initialize() __GPU
Definition: amp.h:3008
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.
2311  :_Base(_Src.data(),_Extent)
2312  {
2313  static_assert( std::is_same<decltype(_Src.data()), _Value_type*>::value, "container element type and array view element type must match");
2314  _Initialize(_Src.size());
2315  }
_Array_view_base< _Rank, sizeof(_Value_type)/sizeof(int)> _Base
Definition: amp.h:2238
void _Initialize() __GPU
Definition: amp.h:3008
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.
2328  :_Base(_Src,_Extent)
2329  {
2330  _Initialize();
2331  }
_Array_view_base< _Rank, sizeof(_Value_type)/sizeof(int)> _Base
Definition: amp.h:2238
void _Initialize() __GPU
Definition: amp.h:3008
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.
2341  {
2342  static_assert(_Rank == 1, "rank must be 1");
2343  _Initialize(this->get_extent().size(), true);
2344  }
constexpr auto size(const _Container &_Cont) -> decltype(_Cont.size())
Definition: xutility:1478
__declspec(property(get=get_extent)) Concurrency Concurrency::extent< _Rank > get_extent() const __GPU
The extent of this array or view.
Definition: amp.h:1563
_Array_view_base< _Rank, sizeof(_Value_type)/sizeof(int)> _Base
Definition: amp.h:2238
void _Initialize() __GPU
Definition: amp.h:3008
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.
2354  :_Base(_Src.data(), Concurrency::extent<1>(static_cast<int>(_Src.size())))
2355  {
2356  if (_Src.size() > INT_MAX) {
2357  throw runtime_exception("Invalid _Src container argument - _Src size is greater than INT_MAX", E_INVALIDARG);
2358  }
2359  static_assert( std::is_same<decltype(_Src.data()), _Value_type*>::value, "container element type and array view element type must match");
2360  static_assert(_Rank == 1, "rank must be 1");
2361  _Initialize(_Src.size());
2362  }
_Array_view_base< _Rank, sizeof(_Value_type)/sizeof(int)> _Base
Definition: amp.h:2238
#define INT_MAX
Definition: limits.h:35
void _Initialize() __GPU
Definition: amp.h:3008
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.
2374  :_Base(_Src.data(), Concurrency::extent<1>(_E0))
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 == 1, "rank must be 1");
2378  _Initialize(_Src.size());
2379  }
_Array_view_base< _Rank, sizeof(_Value_type)/sizeof(int)> _Base
Definition: amp.h:2238
void _Initialize() __GPU
Definition: amp.h:3008
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.
2391  :_Base(Concurrency::extent<2>(_E0,_E1))
2392  {
2393  static_assert(_Rank == 2, "rank must be 2");
2394  _Initialize(this->get_extent().size(), true);
2395  }
constexpr auto size(const _Container &_Cont) -> decltype(_Cont.size())
Definition: xutility:1478
__declspec(property(get=get_extent)) Concurrency Concurrency::extent< _Rank > get_extent() const __GPU
The extent of this array or view.
Definition: amp.h:1563
_Array_view_base< _Rank, sizeof(_Value_type)/sizeof(int)> _Base
Definition: amp.h:2238
void _Initialize() __GPU
Definition: amp.h:3008
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.
2410  :_Base(_Src.data(), Concurrency::extent<2>(_E0,_E1))
2411  {
2412  static_assert( std::is_same<decltype(_Src.data()), _Value_type*>::value, "container element type and array view element type must match");
2413  static_assert(_Rank == 2, "rank must be 2");
2414  _Initialize(_Src.size());
2415  }
_Array_view_base< _Rank, sizeof(_Value_type)/sizeof(int)> _Base
Definition: amp.h:2238
void _Initialize() __GPU
Definition: amp.h:3008
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.
2430  :_Base(Concurrency::extent<3>(_E0,_E1,_E2))
2431  {
2432  static_assert(_Rank == 3, "rank must be 3");
2433  _Initialize(this->get_extent().size(), true);
2434  }
constexpr auto size(const _Container &_Cont) -> decltype(_Cont.size())
Definition: xutility:1478
__declspec(property(get=get_extent)) Concurrency Concurrency::extent< _Rank > get_extent() const __GPU
The extent of this array or view.
Definition: amp.h:1563
_Array_view_base< _Rank, sizeof(_Value_type)/sizeof(int)> _Base
Definition: amp.h:2238
void _Initialize() __GPU
Definition: amp.h:3008
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.
2452  :_Base(_Src.data(), Concurrency::extent<3>(_E0,_E1,_E2))
2453  {
2454  static_assert( std::is_same<decltype(_Src.data()), _Value_type*>::value, "container element type and array view element type must match");
2455  static_assert(_Rank == 3, "rank must be 3");
2456  _Initialize(_Src.size());
2457  }
_Array_view_base< _Rank, sizeof(_Value_type)/sizeof(int)> _Base
Definition: amp.h:2238
void _Initialize() __GPU
Definition: amp.h:3008
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.
2470  :_Base(_Src, Concurrency::extent<1>(_E0))
2471  {
2472  static_assert(_Rank == 1, "rank must be 1");
2473  _Initialize();
2474  }
_Array_view_base< _Rank, sizeof(_Value_type)/sizeof(int)> _Base
Definition: amp.h:2238
void _Initialize() __GPU
Definition: amp.h:3008
template<typename _Value_type, int _Rank = 1>
template<int _Size>
Concurrency::array_view< _Value_type, _Rank >::array_view ( _In_ _Value_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.
2484  {
2485  static_assert(_Rank == 1, "rank must be 1");
2486  _Initialize();
2487  }
_Array_view_base< _Rank, sizeof(_Value_type)/sizeof(int)> _Base
Definition: amp.h:2238
void _Initialize() __GPU
Definition: amp.h:3008
_Size
Definition: vcruntime_string.h:36
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.
2503  :_Base(_Src, Concurrency::extent<2>(_E0,_E1))
2504  {
2505  static_assert(_Rank == 2, "rank must be 2");
2506  _Initialize();
2507  }
_Array_view_base< _Rank, sizeof(_Value_type)/sizeof(int)> _Base
Definition: amp.h:2238
void _Initialize() __GPU
Definition: amp.h:3008
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.
2526  :_Base(_Src, Concurrency::extent<3>(_E0,_E1,_E2))
2527  {
2528  static_assert(_Rank == 3, "rank must be 3");
2529  _Initialize();
2530  }
_Array_view_base< _Rank, sizeof(_Value_type)/sizeof(int)> _Base
Definition: amp.h:2238
void _Initialize() __GPU
Definition: amp.h:3008
template<typename _Value_type, int _Rank = 1>
Concurrency::array_view< _Value_type, _Rank >::array_view ( )
inlineprivate
2994 {}
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
2997  :_Base(_Other, _Section_origin, _Section_extent)
2998  {
2999  _Initialize();
3000  }
_Array_view_base< _Rank, sizeof(_Value_type)/sizeof(int)> _Base
Definition: amp.h:2238
void _Initialize() __GPU
Definition: amp.h:3008
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
3003  :_Base(_Src_buffer,_Extent)
3004  {
3005  _Initialize();
3006  }
_Array_view_base< _Rank, sizeof(_Value_type)/sizeof(int)> _Base
Definition: amp.h:2238
void _Initialize() __GPU
Definition: amp.h:3008

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
2983  {
2984  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");
2985  return (*reinterpret_cast<const array_view<_T,_R>*>(&_Other));
2986  }
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
3009  {
3010  // Set the type access mode
3012  }
_Access_mode _M_type_access_mode
Definition: amprt.h:455
Definition: amprt.h:94
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
3015  {
3016  // Ensure that the _Src_data_size is at least as big as the size
3017  // of the array_view
3018  if (_Src_data_size < this->extent.size()) {
3019  throw runtime_exception("Invalid _Src container argument - _Src size is less than the size of the array_view.", E_INVALIDARG);
3020  }
3021 
3022  _Initialize();
3023 
3024  if (_Discard_data) {
3025  discard_data();
3026  }
3027  }
Definition: type_traits:974
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:2959
void _Initialize() __GPU
Definition: amp.h:3008
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
2989  {
2990  _Base::_Project0(_I, _Projected_view);
2991  _Projected_view._Initialize();
2992  }
void _Project0(int _I, _Array_view_base< _Rank-1, _Element_size > &_Projected_view) const __GPU
Definition: amp.h:1912
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.

2545  {
2546  copy(*this,_Dest);
2547  }
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:6008
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.

2553  {
2554  copy(*this,_Dest);
2555  }
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:6008
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.

2827  {
2828  static_assert(_Rank == 1, "array_view::data() is only permissible on array_view<T, 1>");
2829  return &this->operator[](index<_Rank>());
2830  }
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:2567
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.

2960  {
2962  }
_Ret_ _View_key _Get_view_key()
Definition: amprt.h:537
_Ret_ _Ubiquitous_buffer * _Get_buffer_ptr() const __CPU_ONLY
Definition: amprt.h:503
_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
2586  {
2587  void *_Ptr = _Access(_Index);
2588  return *reinterpret_cast<value_type*>(_Ptr);
2589  }
_Value_type value_type
Definition: amp.h:2259
_Ret_ void * _Access(const index< _Rank > &_Index) const __GPU
Definition: amp.h:1876
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

2969  {
2972  }
2973  else {
2974  throw runtime_exception("Cannot query source accelerator_view for an array_view without a data source.", E_INVALIDARG);
2975  }
2976  }
_AMPIMP accelerator_view _Get_master_accelerator_view() const
_Ret_ _Ubiquitous_buffer * _Get_buffer_ptr() const __CPU_ONLY
Definition: amprt.h:503
bool _Has_data_source() const
Definition: amprt.h:3246
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
2615  {
2616  void * _Ptr = _Access(_Read_write_access, _Index);
2617  return *reinterpret_cast<_Value_type*>(_Ptr);
2618  }
Definition: amprt.h:94
_Ret_ void * _Access(const index< _Rank > &_Index) const __GPU
Definition: amp.h:1876
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.
2631  {
2633  }
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)
2648  {
2649  static_assert(_Rank == 2, "value_type& array_view::operator()(int,int) is only permissible on array_view<T, 2>");
2650  return this->operator()(index<2>(_I0,_I1));
2651  }
_Value_type & operator()(const index< _Rank > &_Index) const __GPU
Get the element value indexed by _I
Definition: amp.h:2614
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)
2669  {
2670  static_assert(_Rank == 3, "value_type& array_view::operator()(int,int,int) is only permissible on array_view<T, 3>");
2671  return this->operator()(index<3>(_I0,_I1,_I2));
2672  }
_Value_type & operator()(const index< _Rank > &_Index) const __GPU
Get the element value indexed by _I
Definition: amp.h:2614
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.

2536  {
2537  _Base::operator=(_Other);
2538  return *this;
2539  }
_Array_view_base & operator=(const _Array_view_base &_Other) __GPU
Definition: amp.h:1856
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.
2568  {
2570  }
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
2601  {
2602  return this->operator()(_Index);
2603  }
_Value_type & operator()(const index< _Rank > &_Index) const __GPU
Get the element value indexed by _I
Definition: amp.h:2614
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.

2837  {
2838  // If the array_view corresponds to a ubiquitous buffer with no data source,
2839  // then refresh is a no-op
2841  return;
2842  }
2843 
2844  _Buffer_ptr _PBuf;
2846  }
details::_Reference_counted_obj_ptr< details::_Buffer > _Buffer_ptr
Definition: amprt.h:308
_Event _Get_access_async(const _View_key _Key, accelerator_view _Av, _Access_mode _Mode, _Buffer_ptr &_Buf_ptr)
Definition: amprt.h:3389
_AMPIMP accelerator_view _Get_master_accelerator_view() const
_Ret_ _View_key _Get_view_key()
Definition: amprt.h:537
_Ret_ _Ubiquitous_buffer * _Get_buffer_ptr() const __CPU_ONLY
Definition: amprt.h:503
Definition: amprt.h:92
bool _Has_data_source() const
Definition: amprt.h:3246
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.
2805  {
2806  return _Convert<_Value_type2>(this->template _Reinterpret_as<sizeof(_Value_type2)/sizeof(int)>());
2807  }
_Array_view_base< _Rank, _New_element_size > _Reinterpret_as() const __GPU
Definition: amp.h:1922
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.
2687  {
2688  return _Convert<_Value_type>(_Section(_Section_origin, _Section_extent));
2689  }
_Array_view_base _Section(const Concurrency::index< _Rank > &_Section_origin, const Concurrency::extent< _Rank > &_Section_extent) const __GPU
Definition: amp.h:1897
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.
2702  {
2703  return section(_Idx, this->extent - _Idx);
2704  }
Definition: type_traits:974
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:2686
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.
2717  {
2718  return section(Concurrency::index<_Rank>(), _Ext);
2719  }
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:2686
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.
2735  {
2736  static_assert(_Rank == 1, "rank must be 1");
2738  }
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:2686
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.
2760  {
2761  static_assert(_Rank == 2, "rank must be 2");
2762  return section(Concurrency::index<2>(_I0,_I1), Concurrency::extent<2>(_E0,_E1));
2763  }
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:2686
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.
2791  {
2792  static_assert(_Rank == 3, "rank must be 3");
2793  return section(Concurrency::index<3>(_I0,_I1,_I2), Concurrency::extent<3>(_E0,_E1,_E2));
2794  }
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:2686
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.
2935  {
2937 
2938  _Buffer_ptr _PBuf;
2939 
2940  // If the array_view corresponds to a ubiquitous buffer with no data source, then synchronize is a no-op
2941  if ((_Access_type != access_type_none) && this->_M_buffer_descriptor._Get_buffer_ptr()->_Has_data_source())
2942  {
2945  _Get_synchronize_access_mode(_Access_type),
2946  _PBuf)._Get();
2947  }
2948 
2950  }
details::_Reference_counted_obj_ptr< details::_Buffer > _Buffer_ptr
Definition: amprt.h:308
_Event _Get_access_async(const _View_key _Key, accelerator_view _Av, _Access_mode _Mode, _Buffer_ptr &_Buf_ptr)
Definition: amprt.h:3389
_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:537
_AMPIMP ULONG _Start_array_view_synchronize_event_helper(const _Buffer_descriptor &_Buff_desc)
Definition: amprt.h:105
_Ret_ _Ubiquitous_buffer * _Get_buffer_ptr() const __CPU_ONLY
Definition: amprt.h:503
_Access_mode _Get_synchronize_access_mode(access_type cpu_access_type)
Definition: amprt.h:1927
bool _Has_data_source() const
Definition: amprt.h:3246
_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.
2886  {
2888 
2889  _Buffer_ptr _PBuf;
2890  _Event _Ev;
2891 
2892  // If the array_view corresponds to a ubiquitous buffer with no data source, then synchronize is a no-op
2893  if ((_Access_type != access_type_none) && this->_M_buffer_descriptor._Get_buffer_ptr()->_Has_data_source())
2894  {
2897  _Get_synchronize_access_mode(_Access_type),
2898  _PBuf);
2899  }
2900 
2901  return details::_Get_amp_trace()->_Start_async_op_wait_event_helper(_Async_op_id, _Ev);
2902  }
details::_Reference_counted_obj_ptr< details::_Buffer > _Buffer_ptr
Definition: amprt.h:308
_Event _Get_access_async(const _View_key _Key, accelerator_view _Av, _Access_mode _Mode, _Buffer_ptr &_Buf_ptr)
Definition: amprt.h:3389
_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:537
_AMPIMP ULONG _Launch_array_view_synchronize_event_helper(const _Buffer_descriptor &_Buff_desc)
Definition: amprt.h:105
_Ret_ _Ubiquitous_buffer * _Get_buffer_ptr() const __CPU_ONLY
Definition: amprt.h:503
Definition: amprt.h:318
_Access_mode _Get_synchronize_access_mode(access_type cpu_access_type)
Definition: amprt.h:1927
bool _Has_data_source() const
Definition: amprt.h:3246
concurrency::completion_future _Start_async_op_wait_event_helper(ULONG _Async_op_id, _Event _Ev)
Definition: amprt.h:3753
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.
2915  {
2917 
2918  _Buffer_ptr _PBuf;
2919 
2920  if (_Access_type != access_type_none) {
2921  _Get_access_async(this->_M_buffer_descriptor._Get_view_key(), _Accl_view, _Get_synchronize_access_mode(_Access_type), _PBuf)._Get();
2922  }
2923 
2925  }
details::_Reference_counted_obj_ptr< details::_Buffer > _Buffer_ptr
Definition: amprt.h:308
_Event _Get_access_async(const _View_key _Key, accelerator_view _Av, _Access_mode _Mode, _Buffer_ptr &_Buf_ptr)
Definition: amprt.h:3389
_AMPIMP _Ret_ _Amp_runtime_trace *__cdecl _Get_amp_trace()
_Ret_ _View_key _Get_view_key()
Definition: amprt.h:537
_AMPIMP ULONG _Start_array_view_synchronize_event_helper(const _Buffer_descriptor &_Buff_desc)
Definition: amprt.h:105
_Access_mode _Get_synchronize_access_mode(access_type cpu_access_type)
Definition: amprt.h:1927
_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.
2862  {
2864 
2865  _Buffer_ptr _PBuf;
2866  _Event _Ev;
2867 
2868  if (_Access_type != access_type_none) {
2869  _Ev = _Get_access_async(this->_M_buffer_descriptor._Get_view_key(), _Accl_view, _Get_synchronize_access_mode(_Access_type), _PBuf);
2870  }
2871 
2872  return details::_Get_amp_trace()->_Start_async_op_wait_event_helper(_Async_op_id, _Ev);
2873  }
details::_Reference_counted_obj_ptr< details::_Buffer > _Buffer_ptr
Definition: amprt.h:308
_Event _Get_access_async(const _View_key _Key, accelerator_view _Av, _Access_mode _Mode, _Buffer_ptr &_Buf_ptr)
Definition: amprt.h:3389
_AMPIMP _Ret_ _Amp_runtime_trace *__cdecl _Get_amp_trace()
_Ret_ _View_key _Get_view_key()
Definition: amprt.h:537
_AMPIMP ULONG _Launch_array_view_synchronize_event_helper(const _Buffer_descriptor &_Buff_desc)
Definition: amprt.h:105
Definition: amprt.h:318
_Access_mode _Get_synchronize_access_mode(access_type cpu_access_type)
Definition: amprt.h:1927
concurrency::completion_future _Start_async_op_wait_event_helper(ULONG _Async_op_id, _Event _Ev)
Definition: amprt.h:3753
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.
2819  {
2820  return _Convert<_Value_type>(_View_as(_View_extent));
2821  }
_Array_view_base< _New_rank, _Element_size > _View_as(const Concurrency::extent< _New_rank > &_View_extent) const __GPU
Definition: amp.h:1932

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: