| feat: migrate aicpu opdef json payloads to cpp defs
Co-authored-by: zhaowenrui666<zhaowenrui7@huawei.com>
# message auto-generated for no-merge-commit merge:
!4390 merge def into master
feat: migrate aicpu opdef json payloads to cpp defs
Created-by: zhaowenrui666
Commit-by: zhaowenrui666
Merged-by: cann-robot
Description: ## 描述
当前部分 AICPU 算子的 opdef 仍以 JSON 形式维护,构建时需要额外收集 JSON 文件,算子定义入口和维护方式不统一,不利于后续持续迁移和统一管理。
本次 PR 做了什么:
1. 将 Elu、Assert、Identity、GatherV2、ReverseSequence、ScatterElements、TensorScatterUpdate、Where 等 AICPU 算子的 opdef 从 JSON 迁移为 C++ 定义文件。
2. 新增 common/inc/aicpu/aicpu_op_def.h,补充 AICPU opdef 的公共声明。
3. 调整相关 CMakeLists.txt 以及 cmake/opbuild.cmake、cmake/symbol.cmake,支持 *_aicpu_def.cpp 的统一收集和构建。
4. 新增 scripts/kernel/binary_script/aicpu_parser_ini_to_json.py,补齐相关脚本能力。
## 关联的Issue
- 关联 Issue #2438
- https://gitcode.com/cann/ops-nn/issues/2438
## 测试
1. 已核对 PR 对应提交为 08453e64840072937d255e0ad154825266439ba4。
2. 已重新执行 cmake -S /home/jiumao/open/ops-nn -B /home/jiumao/open/ops-nn/build_custom,完成 build_custom 配置刷新。
3. 已执行 cmake --build /home/jiumao/open/ops-nn/build_custom --target gen_aicpu_json_from_opdef -j8,重新生成 build_custom/autogen/aicpu_kernel.ini、build_custom/aicpu_opdef_kernel.json、build_custom/cust_aicpu_kernel.json。
4. 已手动执行 python3 scripts/kernel/binary_script/aicpu_parser_ini_to_json.py build_custom/autogen/aicpu_kernel.ini /tmp/ops_nn_aicpu_verify.json,输出 Compile op info cfg successfully.。
5. 已执行 python3 -m unittest tests/scripts/parser_ini_guard/test_aicpu_parser_ini_to_json.py,6/6 用例通过。
6. 已完成 before/after JSON 对比,8 个算子的金标准字段全部保留,无字段缺失。
7. 已完成 I/O normalized vs canndev 校验,Elu、Assert、Identity、GatherV2、ReverseSequence、ScatterElements、TensorScatterUpdate、Where 与 canndev 基线一致。
8. 本次按 skill 仅验证 custom 路径;未修改 parser_ini.py,因此 AICore before/after 回归按口径豁免。
## 文档更新
无
## 类型标签
- [ ] Bug修复
- [x] 新特性
- [ ] 性能优化
- [ ] 文档更新
- [ ] 其他,请描述:
See merge request: cann/ops-nn!4390 | 11 天前 |
| init
| 7 个月前 |