GroupBarrier Constructor

Product Support

Product

Supported

Atlas A3 training products/Atlas A3 inference products

x

Atlas A2 training products/Atlas A2 inference products

Atlas 200I/500 A2 inference products

x

Atlas inference product's AI Core

x

Atlas inference product's Vector Core

x

Atlas training products

x

Function

Creates a GroupBarrier object. You can set the constructor parameters to determine the number of blocks in the Arrive group and Wait group.

Prototype

1
2
3
template <PipeMode pipeMode>
class GroupBarrier;
__aicore__ inline GroupBarrier(GM_ADDR groupWorkspace, uint32_t arriveSizeIn, uint32_t waitSizeIn);

Parameters

Table 1 Template parameters

Data Type

Description

PipeMode

Execution unit used by GroupBarrier to send group synchronization messages. Only MTE3_MODE is supported.

1
2
3
4
5
enum class PipeMode : uint8_t { 
  SCALAR_MODE = 0,
  MTE3_MODE = 1,
  MAX 
}
Table 2 GroupBarrier constructor parameters

Parameter

Input/Output

Description

groupWorkspace

Input

Start address of the GroupBarrier object in the GM, which is used to store group synchronization messages. The address must be 512-byte aligned. Users manage such data in the global memory, including address alignment and clearing.

arriveSizeIn

Input

Number of AIVs in the Arrive group.

waitSizeIn

Input

Number of AIVs in the Wait group.

Returns

A GroupBarrier object instance

Restrictions

  • When this API is called, the 1600 bytes at the end of the UB space are occupied.
  • This API cannot be used together with REGIST_MATMUL_OBJ. The resource management API is used by users to manage the inter-core communication between the AIC and AIV. In REGIST_MATMUL_OBJ, the framework manages the inter-core communication between the AIC and AIV. If they are used at the same time, exceptions such as communication message errors may occur.

Example

1
AscendC::GroupBarrier<AscendC::PipeMode::MTE3_MODE> barA(startAddr, 3, 6);  // Six AIVs start the subsequent service after three AIVs arrive. The required address space is 6 × 512 bytes in total. The start address is the user-specified startAddr.