Pull Request已成功合入, 合并人@CANN-robot
(感谢 ClarkXie 的贡献)变更摘要
本 PR 统一 OM2 的 kernel launch 回调机制:新增 GertLaunchType 枚举(GERT_LAUNCH_KERNEL/GERT_LAUNCH_DSA)、GertKernelLaunchParams、GertDsaLaunchParams、GertLaunchParams union、GertTaskLaunchInfo 及 GertLaunchFunc 回调类型,重构 GertModelCallbacks(移除 report_task_preprocess/report_task_postprocess/get_data_dump_enabled,新增 launch_func 字段)。executor 侧以通用 LaunchTask 按 launch_type 分发,codegen 侧 AICore 分发流程改为统一组装 GertTaskLaunchInfo 并调用回调;DSA 分支与 Custom 弱符号 Report 路径(ReportDfxTaskPreprocess/ReportDfxTaskPostprocess)均保留,为后续 SQE launch 接入预留。
主要改动
- 新增统一 launch 回调接口(
inc/framework/runtime/dump/model_dump_c_api.h与stable_part_provider.cc生成的稳定代码):新增GertLaunchType、GertKernelLaunchParams、GertDsaLaunchParams、GertLaunchParams、GertTaskLaunchInfo及GertLaunchFunc定义;GertModelCallbacks删除三个旧回调字段,仅保留report_model_base_info并新增launch_func。 - executor 实现通用分发(
om2_model_executor.cc):新增LaunchTask按launch_type分发到LaunchKernelTask/LaunchDsaTask;LaunchKernelTask依次完成ReportDfxTaskPreprocess、aclrtLaunchKernelV2下发、aclrtGetThreadLastTaskId记录task_id及ReportDfxTaskPostprocess;LaunchDsaTask预留并返回ACL_ERROR_API_NOT_SUPPORT,GertModelCallbacks初始化改为launch_func = LaunchTask。 - AICore 分发流程改造(
kernel_task_code_builder.cc):KernelTaskDistribute签名由(io_addrs, args_info, func_handle, block_dim, stream, config)改为(launch_info, launch_func, instance_handle),优先走launch_func回调;分发前改为通过AssembleOm2TaskInfo组装Om2TaskInfo并构造GertKernelLaunchParams/GertLaunchParams/GertTaskLaunchInfo,移除ReportOm2TaskPreprocess/ReportLaunchedOm2Task调用,MemcpySargs 拷贝移到 launch 之后。 - 模型类新增 launch 回调成员(
om2_model_class_generator_base.cc/.h、interface_file_code_generator.cc、resources_file_code_generator.cc、load_and_run_file_code_generator.cc):模型类新增launch_func_(GertLaunchFunc)字段,构造函数中初始化为nullptr,Load 阶段在callbacks非空且launch_func非空时将其赋值给launch_func_。 - 测试同步更新(
om2_codegen_unittest.cc、program_generator_unittest.cc):接口 dump 测试校验新增 launch 结构体存在且旧字段report_task_preprocess/report_task_postprocess/get_data_dump_enabled已移除;新增 AICore 生成代码使用统一回调的测试,校验KernelTaskDistribute(&launch_info, ...)新签名及AssembleOm2TaskInfo组装流程。


Thanks for your pull-request.
The full list of commands accepted by me can be found at here.
You can get sig-info at here.
You can self-configure the PR merge rules for this repository. For more details, please refer to Here.
For more, you also can visit HICANN.
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| repo-cann/ge | ✅ yangyongqiang0606, Mexyy (2/2) | ✅ yangyongqiang0606 (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
ClarkXie, thanks for your pull request. All authors of the commits have signed the CLA. 👍


/approve


Pull Request
描述
本 PR 统一 OM2 模型生成代码中 AICore、AICPU、TensorFlow AICPU 和 DSA 任务的启动回调流程,通过 GertModelLaunchTask 回调承接不同类型的任务启动,并保留未配置回调时直接调用运行时接口的 fallback 路径。
变更类型
请选择本次引入的变更类型:
关联的Issue
本 PR 暂无关联 Issue。
如何测试
描述测试此变更的步骤和前提条件:
核对清单
其他信息
本 PR 仅涉及 OM2 任务启动回调、运行时 executor 回调和相关生成代码;按当前范围不修改独立设计文档。