FreeMessage

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product/Atlas A3 inference product

x

Atlas A2 training product/Atlas A2 inference product

Atlas 200I/500 A2 inference product

x

Atlas inference product AI Core

x

Atlas inference product Vector Core

x

Atlas training product

x

Function Usage

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);
};