FreeMessage

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

Refreshes the message status to FREE after the message is processed in the custom callback function logic, or when the message status is waitState. For details about the message status, see the msgState parameter in Table 2.

Prototype

1
2
__aicore__ inline uint16_t FreeMessage(__gm__ CubeMsgType *msg);     
__aicore__ inline uint16_t FreeMessage(__gm__ CubeMsgType *msg, CubeMsgState waitState);   

Parameters

Table 1 API parameters

Parameter

Input/Output

Description

msg

Input

Message space address in the CubeResGroupHandle object.

waitState

Input

msgState to be waited for.

Returns

Address offset between the current message space and the head space of the message queue

Restrictions

The value of waitState cannot be QUIT or FREE.

Example

1
2
3
4
5
6
7
template <int32_t funcId>
__aicore__ inline static typename IsEqual<funcId, 1>::Type CubeGroupCallBack(
    MatmulApiCfg &mm, __gm__ CubeMsgBody *rcvMsg, CubeResGroupHandle<CubeMsgBody> &handle)
{
       // Compute logic on the Cube core, which is implemented by users. After all computations are complete, FreeMessage needs to be called, indicating that rcvMsg has been processed.
       auto tmpId = handle.FreeMessage(rcvMsg);
};