IterateAll
Applicability
Product |
Supported |
|---|---|
Atlas 350 Accelerator Card |
√ |
√ |
|
√ |
|
√ |
|
√ |
|
x |
|
x |
Function Usage
Computes a matrix C of size singleCoreM x singleCoreN by each call to IterateAll. The iteration sequence can be adjusted using the tiling parameter iterateOrder.
Prototype
1 | template <bool sync = true> __aicore__ inline void IterateAll(const GlobalTensor<DstT>& gm, uint8_t enAtomic = 0, bool enSequentialWrite = false, bool waitIterateAll = false, bool fakeMsg = false) |
1 | template <bool sync = true> __aicore__ inline void IterateAll(const LocalTensor<DstT>& ubCmatrix, uint8_t enAtomic = 0) |
Parameters
Parameter |
Description |
|---|---|
sync |
Matrix C can be obtained in synchronous or asynchronous mode.
Setting it to true (default) enables the synchronous mode; while setting it to false enables the asynchronous mode. For the |
Parameter |
Input/Output |
Description |
|---|---|---|
gm |
Output |
Matrix C. The type is GlobalTensor. For the Atlas 350 Accelerator Card, the supported data types are half, float, bfloat16_t, int32_t, int8_t, fp8_e4m3fn_t, and hifloat8_t. For the For the For the For the |
ubCmatrix |
Output |
Matrix C. The type is LocalTensor, and TPosition can be TSCM or VECIN. You are advised to use the Iterate API for output to the VECIN tensor. For the Atlas 350 Accelerator Card, the supported data types are half, float, bfloat16_t, int32_t, int8_t, fp8_e4m3fn_t, and hifloat8_t. For the For the For the For the |
enAtomic |
Input |
Enables the Atomic operation or not. Values: 0 (default): disables the Atomic operation. 1: enables the AtomicAdd (accumulation) operation. 2: enables the AtomicMax (maximum value calculation) operation. 3: enables the AtomicMin (minimum value calculation) operation. For the For the |
enSequentialWrite |
Input |
Enables the continuous write mode or not (write to [baseM,baseN] for continuous write and to [singleCoreM,singleCoreN] for discontinuous write). The default value is false (discontinuous write). This parameter is not supported by the |
waitIterateAll |
Input |
Used only in asynchronous scenarios, indicating whether to use WaitIterateAll to wait for the completion of IterateAll execution. true: WaitIterateAll is used to wait for the completion of IterateAll execution. false: WaitIterateAll is not used to wait for the completion of IterateAll execution. Developers can handle this waiting process themselves. |
fakeMsg |
Input |
This parameter is used only in the IBShare scenario (doIBShareNorm is enabled in template parameters) and IntraBlockPartSum scenario (intraBlockPartSum is enabled in template parameters).
|
Returns
None
Restrictions
Ensure that the size of the address space of the input matrix C is greater than or equal to singleCoreM × singleCoreN elements.
Example
The following is an example of calling the IterateAll API. For more operator examples in asynchronous scenarios, see IterateAll asynchronous scenario sample.
1 2 3 4 5 6 7 8 | REGIST_MATMUL_OBJ(&pipe, GetSysWorkSpacePtr(), mm, &tiling); mm.SetTensorA(gm_a); mm.SetTensorB(gm_b); if (tiling.isBias) { mm.SetBias(gmBias); } mm.IterateAll(gm_c); // Computation mm.End(); |