InitSocState

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

Atlas inference product Vector Core

Atlas training product

x

Function Usage

Initializes the AI Core state. The AI Core has some global states, such as the atomic accumulation state and mask mode. During actual running, these values can be modified by previously executed operators, resulting in unexpected computation behavior. In static tensor programming scenarios, you must call this API at the kernel entry point.

Prototype

1
__aicore__ inline void InitSocState()

Parameters

None

Returns

None

Constraints

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

Example

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 status register. (In TPipe framework programming, the initialization is completed by TPipe and does not require your attention. In static tensor programming, you need to manually call this API.)
    AscendC::InitSocState();
    KernelAdd op;
    op.Init(x, y, z);
    op.Process(); 
}