昇腾社区首页
中文
注册
开发者
下载

GetIrIndex

产品支持情况

产品

是否支持

Atlas A3 训练系列产品/Atlas A3 推理系列产品

Atlas A2 训练系列产品/Atlas A2 推理系列产品

Atlas 200I/500 A2 推理产品

Atlas 推理系列产品

Atlas 训练系列产品

头文件

/include/graph/arg_desc_info.h

功能说明

获取当前ArgDescInfo的算子IR索引。只有当type为kIrInput、kIrOutput、kIrInputDesc、kIrOutputDesc时才可以获取到。

函数原型

1
int32_t GetIrIndex() const

参数说明

返回值说明

当前Args地址对应输入/输出的IR索引,未设置时默认值为-1。

约束说明

调用示例

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
graphStatus Mc2GenTaskCallback(const gert::ExeResGenerationContext *context,
    std::vector<std::vector<uint8_t>> &tasks) {
...
  // 设置AI CPU任务
  auto aicpu_task = KernelLaunchInfo::CreateAicpuKfcTask(context,
      "libccl_kernel.so", "RunAicpuKfcSrvLaunch");
  std::vector<ArgDescInfo> aicpu_args_format;
  aicpu_args_format.emplace_back(ArgDescInfo(ArgDescType::kIrOutput, 0));
  // 获取kIrOutput类型的ArgDescInfo的IR索引,此时获取到的值为0
  auto ir_index = aicpu_args_format.back().GetIrIndex();
...
}