SetSubBlockIdx

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

x

Atlas inference product AI Core

x

Atlas inference product Vector Core

x

Atlas training product

x

Function Usage

Sets the ID of the current AIV. In the separated architecture, an AI Core consists of Cube Cores (AICs) and Vector Cores (AIVs) in a fixed ratio of 1:N. The IDs of the N AIVs are 0, 1, ..., and N-1, respectively.

Prototype

1
__aicore__ inline void SetSubBlockIdx(uint8_t subBlockIdx)

Parameters

Table 1 Parameters

Parameter

Input/Output

Description

subBlockIdx

Input

ID of the current AIV.

Returns

None

Restrictions

  • This API can be used only in the separated architecture.
  • In the separated architecture, the AIV ID is automatically initialized and assigned within the REGIST_MATMUL_OBJ() API. If the REGIST_MATMUL_OBJ() API is used in the operator program, you are not advised to call this API. If the REGIST_MATMUL_OBJ() API is not used, call this API and set the subcore ID to 0.

Example

1
2
3
4
5
6
7
typedef AscendC::MatmulType<AscendC::TPosition::GM, CubeFormat::ND, half> aType; 
typedef AscendC::MatmulType<AscendC::TPosition::GM, CubeFormat::ND, half> bType; 
typedef AscendC::MatmulType<AscendC::TPosition::GM, CubeFormat::ND, float> cType; 
typedef AscendC::MatmulType<AscendC::TPosition::GM, CubeFormat::ND, float> biasType; 

MatmulImpl<aType, bType, cType, biasType, CFG_NORM> mm;
mm.SetSubBlockIdx(0); // Set the subcore ID to 0.