InitSocState

Supported Products

Product

Supported/Unsupported

Atlas A3 training products / Atlas A3 inference products

Atlas A2 training products / Atlas A2 inference products

Atlas 200I/500 A2 inference products

x

Atlas inference product 's AI Core

Atlas inference product 's Vector Core

Atlas training products

x

Functions

The AI Core has some global states, such as the atomic accumulation state and mask mode. During actual running, these states may be modified by the operators executed in the previous sequence, resulting in unexpected computation. In the static tensor programming scenario, you must call this function at the kernel entry to initialize the AI Core state.

Prototype

1
__aicore__ inline void InitSocState()

Command-Line Options

None

Return Value Description

None

Restrictions

If this API is not called, problems such as precision errors or suspension may occur in some scenarios.

Examples

1
2
3
4
5
6
7
8
extern "C" __global__ __aicore__ void add_custom(GM_ADDR x, GM_ADDR y, GM_ADDR z)
{
    // Initialize the global state register. (In the TPipe framework programming, the initialization is performed by the TPipe, and you do not need to pay attention to it. In the static tensor programming mode, you need to manually call this function.)
    AscendC::InitSocState();
    KernelAdd op;
    op.Init(x, y, z);
    op.Process(); 
}