SetTail

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product/Atlas A3 inference product

Atlas A2 training product/Atlas A2 inference product

Atlas 200I/500 A2 inference product

Atlas inference product AI Core

Atlas inference product Vector Core

x

Atlas training product

x

Function Usage

Resets singleCoreM, singleCoreN, and singleCoreK for the current computation without changing tiling. The unit is element.

Prototype

1
__aicore__ inline void SetTail(int tailM = -1, int tailN = -1, int tailK = -1)

Parameters

Parameter

Input/Output

Description

tailM

Input

singleCoreM value after resetting

tailN

Input

singleCoreN value after resetting

tailK

Input

singleCoreK value after resetting

Returns

None

Restrictions

None

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
REGIST_MATMUL_OBJ(&pipe, GetSysWorkSpacePtr(), mm, &tiling);

// tailM: number of remaining elements in the M direction; tailN: number of remaining elements in the N direction; tailK: number of remaining elements in the K direction.
// In the tail-core scenario, the number of remaining elements may be less than the number of elements to be computed by a single core. In this case, you need to use SetTail to reset the number of elements for the current computation.
if (tailM < tiling.singleCoreM || tailN < tiling.singleCoreN || tailK < tiling.singleCoreK) {
    matmulObj.SetTail(tailM, tailN, tailK);
}

mm.SetTensorA(gm_a);
mm.SetTensorB(gm_b);
if (tiling.isBias) {
    mm.SetBias(gmBias);
}
mm.IterateAll(gm_c);
mm.End();