Pull Request has been successfully merged by CANN-robot.
(Thank you for su-yueming's contribution.)变更摘要
本 PR 在 opdev 层引入外部/自定义算子的 Direct Invoke 任务接入框架,以三回调 SPI 替代原描述符式接口,覆盖"实现方自主完成实现选择、tiling 与 kernel 下发"的场景。新增头文件 include/nnopbase/opdev/direct_invoke_task.h 定义接入契约,并在 src/nnopbase/composite_op/aclnn_engine/direct_invoke_task.cpp 中实现任务注册、参数校验、workspace 分配与执行逻辑;同时新增 DIRECT_INVOKE 计算任务类型、OpArgContext 访问接口、打包/桩代码白名单及配套单元测试。
主要改动
- 新增三回调 SPI 接入接口: 在
direct_invoke_task.h中定义DirectInvokePrepareFn、DirectInvokeLaunchFn、DirectInvokeDestroyFn三个不可抛异常的回调类型与DirectInvokeWorkspaceRequest结构,并提供入口函数AddDirectInvokeTask,明确 prepare 同步执行、launch/destroy 生命周期及状态释放语义。 - 新增引擎中立的计算任务类型: 在
op_def.h的CoreType枚举中新增DIRECT_INVOKE,作为引擎中立的计算任务类别而非设备引擎标识。 - 实现 Direct Invoke 任务注册与执行: 新增
DirectInvokeKernelLauncher类及AddDirectInvokeTask实现,负责入参校验(回调、opType、可选输入/必选输出、入口 workspace 必须为空)、按prepare请求通过AppendRequestedWorkspaces分配DT_UINT8workspace、注册到 executor 并调用AbandonCache禁用设备任务缓存;Launch中完成输入输出 dump、溢出检查与基于opType的 DFX 归因。 - 扩展参数上下文查询接口: 在
op_arg_def.h中新增OpArgContext::GetOpArg以按OpArgDef返回OpArgList指针,并将ContainsOpArgType改为const,供新框架读取输入/输出/属性/workspace 参数。 - 完善打包与桩生成配置: 在
opbase.xml与gen_stubapi.py白名单中登记direct_invoke_task.h,将其纳入对外安装头文件与 stub API 生成范围。 - 新增单元测试覆盖: 在
tests/nnopbase/ut/composite_op/test_direct_invoke.cpp中覆盖多回调分派、workspace 分配与校验、prepare/launch 失败路径的状态释放、可选输入与张量列表参数、缓存禁用与重复执行、以及回调边界不产生 profiling 归因等行为。


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 |
|---|---|---|
| 9.2.0 | ✅ gcw_kUomxQ2l, 周奇龙 (2/2) | ✅ gcw_kUomxQ2l (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
su-yueming, thanks for your pull request. All authors of the commits have signed the CLA. 👍


compile


| 🚀 CI 流水线已启动 |
|---|
| 📋 执行详情: 点击查看流水线 |


/approve


/lgtm
/approve


The following users do not have permission to comment /lgtm or /approve on any module in this PR:
/approve: 周奇龙


描述
feat(opdev): add external op task framework integration
此前外部/自定义算子接入 ACLNN 执行框架需依赖 AI Core kernel launcher 或旧的描述符式接口,无法覆盖"实现方自主完成实现选择、tiling 与 kernel 下发"的场景。本 PR 在 opdev 层新增 Direct Invoke 任务接入框架,以三回调 SPI 替代原描述符式接口
原PR:https://gitcode.com/cann/opbase/pull/879/diffs
关联的Issue
#429
测试
文档更新
类型标签