CreateHcomWaitTask

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product/Atlas A3 inference product

Atlas A2 training product/Atlas A2 inference product

Atlas 200I/500 A2 inference product

Atlas inference product

Atlas training product

Header File/Library File

  • Header file: #include <graph/kernel_launch_info.h>
  • Library file: libregister.so

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.

Restrictions

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++;
  ...
}