InitSocState
Supported Products
|
Product |
Supported/Unsupported |
|---|---|
|
|
√ |
|
|
√ |
|
|
x |
|
|
√ |
|
|
√ |
|
|
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(); } |