Concurrency 命名空間函式 (AMP)

all_memory_fence

封鎖磚中所有線程的執行,直到所有記憶體存取都完成為止。 這可確保執行緒磚中的其他執行緒可以看到所有記憶體存取,並以程式循序執行。

inline void all_memory_fence(const tile_barrier& _Barrier) restrict(amp);

參數

_障礙
tile_barrier 物件。

amp_uninitialize

取消初始化 C++ AMP 執行時間。 在應用程式存留期期間多次呼叫此函式是合法的。 呼叫此函式之後呼叫任何 C++ AMP API 將會重新初始化 C++ AMP 執行時間。 請注意,跨對這個函式的呼叫使用 C++ AMP 物件是不合法的,這樣做會導致未定義的行為。 此外,同時呼叫此函式和任何其他 AMP API 是非法的,而且會導致未定義的行為。

void __cdecl amp_uninitialize();

atomic_compare_exchange

以不可部分完成的方式比較儲存在第一個引數中指定的記憶體位置的值,以與第二個指定引數的值相等,如果值相同,則記憶體位置的值會變更為第三個指定引數的值。

inline bool atomic_compare_exchange(
    _Inout_ int* _Dest,
    _Inout_ int* _Expected_value,
    int value
    ) restrict(amp)

inline bool atomic_compare_exchange(
    _Inout_ unsigned int* _Dest,
    _Inout_ unsigned int* _Expected_value,
    unsigned int value
    ) restrict(amp)

參數

_Dest
要比較其中一個值的讀取位置,以及要儲存新值的位置。

_Expected_value
要從中比較第二個值的位置讀取。

value
如果 _Dest 等於 ,則儲存至 中所 _Dest 指定記憶體位置的值。 _Expected_value

傳回值

如果作業成功,則為 true,否則為 false

atomic_exchange函式 (C++ AMP)

將目的地位置的值設定為不可部分完成的作業。

inline int atomic_exchange(
    _Inout_ int* _Dest,
    int value
    ) restrict(amp)

inline unsigned int atomic_exchange(
    _Inout_ unsigned int* _Dest,
    unsigned int value
    ) restrict(amp)

inline float atomic_exchange(
    _Inout_ float* _Dest,
    float value
    ) restrict(amp)

參數

_Dest
目的地位置的指標。

value
新的 值。

傳回值

目的地位置的原始值。

atomic_fetch_add函式 (C++ AMP)

以不可部分完成的方式將值新增至記憶體位置的值。

inline int atomic_fetch_add(
    _Inout_ int* _Dest,
    int value
    ) restrict(amp)

inline unsigned int atomic_fetch_add(
    _Inout_ unsigned int* _Dest,
    unsigned int value
    ) restrict(amp)

參數

_Dest
記憶體位置的指標。

value
要加入的值。

傳回值

記憶體位置的原始值。

atomic_fetch_and函式 (C++ AMP)

以不可部分完成的方式執行值的位 AND 運算,以及記憶體位置的值。

inline int atomic_fetch_and(
    _Inout_ int* _Dest,
    int value
    ) restrict(amp)

inline unsigned int atomic_fetch_and(
    _Inout_ unsigned int* _Dest,
    unsigned int value
    ) restrict(amp)

參數

_Dest
記憶體位置的指標。

value
要用於位 AND 計算中的值。

傳回值

記憶體位置的原始值。

atomic_fetch_dec

以不可部分完成的方式遞減儲存在指定記憶體位置的值。

inline int atomic_fetch_dec(_Inout_ int* _Dest
    ) restrict(amp)

inline unsigned int atomic_fetch_dec(_Inout_ unsigned int* _Dest) restrict(amp);

參數

_Dest
要遞減之值記憶體中的位置。

傳回值

儲存在記憶體位置的原始值。

atomic_fetch_inc

以不可部分完成的方式遞增儲存在指定記憶體位置的值。

inline int atomic_fetch_inc(_Inout_ int* _Dest) restrict(amp);

inline unsigned int atomic_fetch_inc(_Inout_ unsigned int* _Dest) restrict(amp);

參數

_Dest
要遞增之值記憶體中的位置。

傳回值

儲存在記憶體位置的原始值。

atomic_fetch_max

以不可部分完成的方式計算儲存在第一個引數中指定的記憶體位置值與第二個引數中指定的值之間的最大值,並將其儲存在相同的記憶體位置。

inline int atomic_fetch_max(
    _Inout_ int* _Dest,
    int value
    ) restrict(amp)

inline unsigned int atomic_fetch_max(
    _Inout_ unsigned int* _Dest,
    unsigned int value
    ) restrict(amp)

參數

_Dest
要比較其中一個值的位置是讀取的,以及要儲存兩個值的最大位置。

value
要與指定位置的值比較的值。

傳回值

儲存在指定位置位置的原始值。

atomic_fetch_min

以不可部分完成的方式計算儲存在第一個引數中指定的記憶體位置值與第二個引數中指定的值之間的最小值,並將其儲存在相同的記憶體位置。

inline int atomic_fetch_min(
    _Inout_ int* _Dest,
    int value
    ) restrict(amp)

inline unsigned int atomic_fetch_min(
    _Inout_ unsigned int* _Dest,
    unsigned int value
    ) restrict(amp)

參數

_Dest
要比較其中一個值的讀取位置,以及要儲存兩個值的最小值。

value
要與指定位置的值比較的值。

傳回值

儲存在指定位置位置的原始值。

atomic_fetch_or函式 (C++ AMP)

使用值和記憶體位置的值,以不可部分完成的方式執行位 OR 作業。

inline int atomic_fetch_or(
    _Inout_ int* _Dest,
    int value
    ) restrict(amp)

inline unsigned int atomic_fetch_or(
    _Inout_ unsigned int* _Dest,
    unsigned int value
    ) restrict(amp)

參數

_Dest
記憶體位置的指標。

value
要用於位 OR 計算中的值。

傳回值

記憶體位置的原始值。

atomic_fetch_sub函式 (C++ AMP)

以不可部分完成的方式從記憶體位置減去值。

inline int atomic_fetch_sub(
    _Inout_ int* _Dest,
    int value
    ) restrict(amp)

inline unsigned int atomic_fetch_sub(
    _Inout_ unsigned int* _Dest,
    unsigned int value
    ) restrict(amp)

參數

_Dest
目的地位置的指標。

value
要減去的值。

傳回值

記憶體位置的原始值。

atomic_fetch_xor函式 (C++ AMP)

以不可部分完成的方式執行值的位 XOR 作業和記憶體位置。

inline int atomic_fetch_xor(
    _Inout_ int* _Dest,
    int value
    ) restrict(amp)

inline unsigned int atomic_fetch_xor(
    _Inout_ unsigned int* _Dest,
    unsigned int value
    ) restrict(amp)

參數

_Dest
記憶體位置的指標。

value
要用於 XOR 計算中的值。

傳回值

記憶體位置的原始值。

copy

複製 C++ AMP 物件。 符合所有同步資料傳輸需求。 您無法在加速器上執行程式碼時複製資料。 此函式的一般形式為 copy(src, dest)

template <typename value_type, int _Rank>
void copy(
    const array<value_type, _Rank>& _Src,
    array<value_type, _Rank>& _Dest);

template <typename InputIterator, typename value_type, int _Rank>
void copy(
    InputIterator _SrcFirst,
    InputIterator _SrcLast,
    array<value_type, _Rank>& _Dest);

template <typename InputIterator, typename value_type, int _Rank>
void copy(
    InputIterator _SrcFirst,
    array<value_type, _Rank>& _Dest);

template <typename OutputIterator, typename value_type, int _Rank>
void copy(
    const array<value_type, _Rank>& _Src,
   OutputIterator _DestIter);

template <typename value_type, int _Rank>
void copy(
    const array<value_type, _Rank>& _Src,
    array_view<value_type, _Rank>& _Dest);

template <typename value_type, int _Rank>
void copy(
    const array_view<const value_type, _Rank>& _Src,
    array<value_type, _Rank>& _Dest);

template <typename value_type, int _Rank>
void copy(
    const array_view<value_type, _Rank>& _Src,
    array<value_type, _Rank>& _Dest);

template <typename value_type, int _Rank>
void copy(
    const array_view<const value_type, _Rank>& _Src,
    array_view<value_type, _Rank>& _Dest);

template <typename value_type, int _Rank>
void copy(
    const array_view<value_type, _Rank>& _Src,
    array_view<value_type, _Rank>& _Dest);

template <typename InputIterator, typename value_type, int _Rank>
void copy(
    InputIterator _SrcFirst,
    InputIterator _SrcLast,
    array_view<value_type, _Rank>& _Dest);

template <typename InputIterator, typename value_type, int _Rank>
void copy(
    InputIterator _SrcFirst,
    array_view<value_type, _Rank>& _Dest);

template <typename OutputIterator, typename value_type, int _Rank>
void copy(
    const array_view<value_type, _Rank>& _Src,
    OutputIterator _DestIter);

參數

_Dest
要複製到的物件。

_DestIter
目的地位置的輸出反覆運算器。

InputIterator
輸入迭代器的類型。

OutputIterator
輸出反覆運算器的型別。

_排名
要複製的物件排名,或要複製的物件。

_Src
要複製的物件。

_SrcFirst
來源容器中的起始反覆運算器。

_SrcLast
來源容器中的結束反覆運算器。

value_type
複製之專案的資料類型。

copy_async

複製 C++ AMP 物件,並傳回 可等候的completion_future 物件。 您無法在加速器上執行程式碼時複製資料。 此函式的一般形式為 copy(src, dest)

template <typename value_type, int _Rank>
concurrency::completion_future copy_async(
    const array<value_type, _Rank>& _Src,
    array<value_type, _Rank>& _Dest);

template <typename InputIterator, typename value_type, int _Rank>
concurrency::completion_future copy_async(InputIterator _SrcFirst, InputIterator _SrcLast,
    array<value_type, _Rank>& _Dest);

template <typename InputIterator, typename value_type, int _Rank>
concurrency::completion_future copy_async(InputIterator _SrcFirst,
    array<value_type, _Rank>& _Dest);

template <typename OutputIterator, typename value_type, int _Rank>
concurrency::completion_future copy_async(
    const array<value_type, _Rank>& _Src, OutputIterator _DestIter);

template <typename value_type, int _Rank>
concurrency::completion_future copy_async(
    const array<value_type, _Rank>& _Src,
    array_view<value_type, _Rank>& _Dest);

template <typename value_type, int _Rank>
concurrency::completion_future copy_async(
    const array_view<const value_type, _Rank>& _Src,
    array<value_type, _Rank>& _Dest);

template <typename value_type, int _Rank>
concurrency::completion_future copy_async(
    const array_view<value_type, _Rank>& _Src,
    array<value_type, _Rank>& _Dest);

template <typename value_type, int _Rank>
concurrency::completion_future copy_async(
    const array_view<const value_type, _Rank>& _Src,
    array_view<value_type, _Rank>& _Dest);

template <typename value_type, int _Rank>
concurrency::completion_future copy_async(
    const array_view<value_type, _Rank>& _Src,
    array_view<value_type, _Rank>& _Dest);

template <typename InputIterator, typename value_type, int _Rank>
concurrency::completion_future copy_async(InputIterator _SrcFirst, InputIterator _SrcLast,
    array_view<value_type, _Rank>& _Dest);

template <typename InputIterator, typename value_type, int _Rank>
concurrency::completion_future copy_async(InputIterator _SrcFirst,
    array_view<value_type, _Rank>& _Dest);

template <typename OutputIterator, typename value_type, int _Rank>
concurrency::completion_future copy_async(
    const array_view<value_type, _Rank>& _Src, OutputIterator _DestIter);

參數

_Dest
要複製到的物件。

_DestIter
目的地位置的輸出反覆運算器。

InputIterator
輸入迭代器的類型。

OutputIterator
輸出反覆運算器的型別。

_排名
要複製的物件排名,或要複製的物件。

_Src
要複製的物件。

_SrcFirst
來源容器中的起始反覆運算器。

_SrcLast
來源容器中的結束反覆運算器。

value_type
複製之專案的資料類型。

傳回值

future<void>可以等候的 。

direct3d_abort

使用 restrict(amp) 限制子句中止函式執行。 當 AMP 執行階段偵測到呼叫時,會引發 runtime_exception 例外狀況,並顯示錯誤訊息 "Reference Rasterizer: Shader abort instruction hit"。

void direct3d_abort() restrict(amp);

direct3d_errorf

將格式化字串列印至 Visual Studio 輸出視窗。 它會從具有限制子句的 restrict(amp) 函式呼叫。 當 AMP 執行時間偵測到呼叫時,它會使用相同的格式字串引發 runtime_exception 例外狀況。

void direct3d_errorf(
    const char *,
...) restrict(amp);

direct3d_printf

將格式化字串列印至 Visual Studio 輸出視窗。 它會從具有限制子句的 restrict(amp) 函式呼叫。

void direct3d_printf(
    const char *,
...) restrict(amp);

global_memory_fence

封鎖磚中所有線程的執行,直到所有全域記憶體存取都完成為止。 這可確保執行緒磚中的其他執行緒可以看到全域記憶體存取,並以程式循序執行。

inline void global_memory_fence(const tile_barrier& _Barrier) restrict(amp);

參數

_障礙
tile_barrier 物件

parallel_for_each函式 (C++ AMP)

跨計算網域執行函式。 如需詳細資訊,請參閱 C++ AMP 概觀

template <int _Rank, typename _Kernel_type>
void parallel_for_each(
    const extent<_Rank>& _Compute_domain,
    const _Kernel_type& _Kernel);

template <int _Dim0, int _Dim1, int _Dim2, typename _Kernel_type>
void parallel_for_each(
    const tiled_extent<_Dim0, _Dim1, _Dim2>& _Compute_domain,
   const _Kernel_type& _Kernel);

template <int _Dim0, int _Dim1, typename _Kernel_type>
void parallel_for_each(
    const tiled_extent<_Dim0, _Dim1>& _Compute_domain,
    const _Kernel_type& _Kernel);

template <int _Dim0, typename _Kernel_type>
void parallel_for_each(
    const tiled_extent<_Dim0>& _Compute_domain,
    const _Kernel_type& _Kernel);

template <int _Rank, typename _Kernel_type>
void parallel_for_each(
    const accelerator_view& _Accl_view,
    const extent<_Rank>& _Compute_domain,
    const _Kernel_type& _Kernel);

template <int _Dim0, int _Dim1, int _Dim2, typename _Kernel_type>
void parallel_for_each(
    const accelerator_view& _Accl_view,
    const tiled_extent<_Dim0, _Dim1, _Dim2>& _Compute_domain,
    const _Kernel_type& _Kernel);

template <int _Dim0, int _Dim1, typename _Kernel_type>
void parallel_for_each(
    const accelerator_view& _Accl_view,
    const tiled_extent<_Dim0, _Dim1>& _Compute_domain,
    const _Kernel_type& _Kernel);

template <int _Dim0, typename _Kernel_type>
void parallel_for_each(
    const accelerator_view& _Accl_view,
    const tiled_extent<_Dim0>& _Compute_domain,
    const _Kernel_type& _Kernel);

參數

_Accl_view
accelerator_view 執行平行計算的物件。

_Compute_domain
extent物件,包含計算的資料。

_Dim0
物件的維度 tiled_extent

_Dim1
物件的維度 tiled_extent

_Dim2
物件的維度 tiled_extent

_內核
Lambda 或函式物件,接受類型為 「index < _Rank > 」 的引數,並執行平行計算。

_Kernel_type
Lambda 或 functor。

_排名
範圍的排名。

tile_static_memory_fence

封鎖磚中所有線程的執行,直到所有未 tile_static 處理的記憶體存取都完成為止。 這可確保 tile_static 執行緒磚中其他執行緒可以看到記憶體存取,而且存取會依程式循序執行。

inline void tile_static_memory_fence(const tile_barrier& _Barrier) restrict(amp);

參數

_障礙
tile_barrier 物件。

另請參閱

Concurrency 命名空間 (C++ AMP)