CreateHcomWaitTask

Function Usage

Creates a wait task to block the stream. When a record task with the same group_name is executed, the stream is unblocked.

Prototype

1
static KernelLaunchInfo CreateHcomWaitTask(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 wait task. The default value is group. The name is used to pair with record tasks.

Returns

Information about the created wait 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
graphStatus Mc2GenTaskCallback(const gert::ExeResGenerationContext *context,
    std::vector<std::vector<uint8_t>> &tasks) {
  ...
  // Create a wait task.
  auto wait_task = KernelLaunchInfo::CreateHcomWaitTask(context);
  wait_task.SetStreamId(attach_stream_id);
  tasks.insert(tasks.begin() + aicore_index, wait_task.Serialize());
  aicore_index++;
  ...
}