CreateHcomRecordTask

Function Usage

Creates a record task to wake up wait tasks with the same group_name on other streams.

Prototype

1
static KernelLaunchInfo CreateHcomRecordTask(const gert::ExeResGenerationContext *context, const char *group_name = "group")

Parameters

Parameter

Input/Output

Description

context

Input

Input parameter of the GenerateTask function, which stores the basic information about the operator.

group_name

Input

Group name of the record task. The default value is group. The name is used to pair with wait tasks.

Returns

Information about the created record task.

Constraints

The value of group_name must match the attribute defined in the operator prototype. For example, if an MC2 operator defines an attribute group_ep, you can create record and wait tasks using group_ep as the group_name.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
graphStatus Mc2GenTaskCallback(const gert::ExeResGenerationContext *context,
    std::vector<std::vector<uint8_t>> &tasks) {
  ...
  // Create a record task.
  auto record_task = KernelLaunchInfo::CreateHcomRecordTask(context);
  // Set stream information.
  record_task.SetStreamId(stream_id);
  tasks.insert(tasks.begin() + aicore_index, record_task.Serialize());
  aicore_index++;
  ...
}