SetSingleShape

Applicability

Product

Supported

Atlas A3 training products/Atlas A3 inference products

Atlas A2 training products/Atlas A2 inference products

Atlas 200I/500 A2 inference products

Atlas inference product's AI Core

Atlas inference product's Vector Core

x

Atlas training products

x

Function

Sets the Matmul single-core computation shape parameters: singleCoreM, singleCoreN, and singleCoreK, with the unit being elements. It is used to modify the shape during runtime, for example, using a Matmul object to process tail blocks. This API has the same function as the SetTail API. You are advised to use this API.

Prototype

1
__aicore__ inline void SetSingleShape(int singleM, int singleN, int singleK)

Parameters

Table 1 Parameters

Parameter

Input/Output

Description

singleM

Input

Size of singleCoreM. The unit is element.

singleN

Input

Size of singleCoreN. The unit is element.

singleK

Input

Size of singleCoreK. The unit is element.

Returns

None

Restrictions

None

Example

1
2
3
4
5
6
REGIST_MATMUL_OBJ(&pipe, GetSysWorkSpacePtr(), mm, &tiling);
mm.SetTensorA(gm_a);
mm.SetTensorB(gm_b);
mm.SetBias(gm_bias);
mm.SetSingleShape(tailM,tailN,tailK);    // If it is a tail core, adjustments need to be made to singleCoreM, singleCoreN, and singleCoreK.
mm.IterateAll(gm_c);