SetSkipMsg

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

Instructs the AIC to skip processing a specified number of fake messages. This API is called only in the callback function. In the following figure, Block 0 calls SetSkipMsg to skip three fake messages.

Figure 1 SetSkipMsg

Prototype

1
 __aicore__ inline void SetSkipMsg(uint8_t skipCnt)

Parameters

Table 1 API parameters

Parameter

Input/Output

Description

skipCnt

Input

Number of messages to be skipped by the AIC.

Returns

None

Restrictions

The fake message needs to be sent for the last n (skipCnt) message queues in the message space of the task.

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
 __aicore__ inline static void Call(
    MatmulApiCfg &mm, __gm__ CubeMsgBody *rcvMsg, CubeResGroupHandle<CubeMsgBody> &handle)
{
    //  AIC computation logic, which is implemented by users.
    auto skipNum = 3;//(rcvMsg->head).skipCnt. The number of fake messages can be defined by the user in the callback computation structure or passed through the custom message structure.
    auto tmpId = handle.FreeMessage(rcvMsg, AscendC::CubeMsgState::VALID);    // The current message has been processed. FreeMessage is called, indicating that the message pointed to by rcvMsg has been processed.
    for (int i = 1; i < skipNum + 1; i++) {  
         // Because three fake messages are sent subsequently, FreeMessage needs to be called, indicating that the fake messages are processed.
         auto tmpId = handle.FreeMessage(rcvMsg + i, AscendC::CubeMsgState::FAKE);
    }
    // If the fake messages exist, call SetSkipMsg to instruct the Cube core not to process the last three fake messages.
    handle.SetSkipMsg(skipNum);
};