InitSocState
Product Support
|
Product |
Supported |
|---|---|
|
|
√ |
|
|
√ |
|
|
x |
|
|
√ |
|
|
√ |
|
|
x |
Function
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 function at the kernel entry point to initialize the AI Core state.
Prototype
1
|
__aicore__ inline void InitSocState() |
Parameters
None
Returns
None
Restrictions
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(); } |