已合并
bug fix: experimental 构建报错 'multiple definition of `ops::op_impl_register_infershape_ZerosLike` + gen_compile_option.sh awk 重复告警 #3516
zhaohujie创建于 6月24日
bug fix: experimental 构建报错 'multiple definition of `ops::op_impl_register_infershape_ZerosLike` + gen_compile_option.sh awk 重复告警 #3516
已合并
Pull Request已成功合入, 合并人@CANN-robot
(感谢 zhaohujie 的贡献)6月24日 关联了issue:[Bug-Report|缺陷反馈]: bash build.sh --experimental 报错
6月24日 添加了label:cann-cla/yes
CANN-robot
6月24日 评论:
6月24日 评论:
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
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| experimental | ✅ 查建青, 宋恺, 王林木 (3/2) | ✅ 查建青, 宋恺 (2/1) |
| repo-cann/ops-math | ✅ 宋恺, 王林木 (2/2) | ✅ 宋恺 (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
zhaohujie, thanks for your pull request. All authors of the commits have signed the CLA. 👍


zhaohujie
6月24日 评论:
6月24日 评论:
compile


此处折叠了53条消息 查看更多
6月29日 删除了label:ci-pipeline-running
6月29日 添加了label:ci-pipeline-passed
6月29日 关闭了关联的issue
6月29日 合入了pull request
描述
修复
bash build.sh --experimental --soc=ascend910b实验构建及isin_part_v1示例冒烟的三个问题:1. 链接报
multiple definition of 'ops::op_impl_register_infershape_ZerosLike'experimental/math/isin_part_v1的DEPENDENCIES中含zero_op。--experimental下实验目录无zero_op,add_dependent_ops回退到主线math/zero_op——它本身也是一套 ZerosLike 实现(IMPL_OP_INFERSHAPE(ZerosLike)),与实验自包含算子experimental/conversion/zeros_like同时编入ophost_math_infer_obj,宏展开的全局符号ops::op_impl_register_infershape_ZerosLike重复定义,ophost_math链接失败。isin_part_v1全部冗余DEPENDENCIES(含zero_op),从根上消除重复注册。2. 构建过程中
awk: line 2: syntax error at or near ,大量重复scripts/util/gen_compile_option.sh两处 awk 使用了三参数match($0, regex, arr)(gawk 扩展语法)。系统awk为 mawk(无 gawk)时第三个参数无法解析;脚本对全部算子列表循环、每算子执行两次该 awk,故报错大量重复。属构建脚本可移植性问题,与算子实现无关;不中断构建,但会刷屏并静默丢弃ascendc_config.json中逐算子的compile_options。match()配合RSTART/RLENGTH+substr()。语义与原 gawk 版本一致,同时兼容 mawk 与 gawk。scripts/util/gen_compile_option.sh3.
isin_part_v1run_example 冒烟失败(编译int64_t→const aclTensor*,及运行期255)aclnnCat→Sort→Cast→IsinPartV1多算子流水(experimental/math 中唯一一个驱动 4 个算子的示例)。其一,示例把elementsNum以int64_t传入,而算子定义中elementsNum是 INT32 张量输入,生成的 aclnn 形参为const aclTensor*,编译失败;其二,该流水迫使Cat/Sort/Cast被打入逐算子自定义包,其中 AscendC 版实验Cast(无 DSL_pattern)破坏了aclnnSort内部 Cast 的标准 tiling 路径,运行期返回 255。isin_part_v1自身并不使用这些依赖。value/index/elementsNum(单元素 INT32 张量)三个输入,仅调用aclnnIsinPartV1;同时移除CMakeLists.txt中全部冗余DEPENDENCIES。如此既修复编译错误,又不再触碰存在缺陷的实验Cast,并顺带解决问题 1 的重复定义。experimental/math/isin_part_v1/CMakeLists.txt、experimental/math/isin_part_v1/examples/test_aclnn_isin_part_v1.cpp关联的Issue
https://gitcode.com/cann/ops-math/issues/2036
测试
ophost_math链接成功;实际链接命令link.txt中zeros_like_infershape.cpp.o仅剩 1 个(实验conversion/zeros_like),主线math/zero_op同名目标已不在链接行(修复前ld returned 1)。bash build.sh --experimental --pkg --ops=isin_part_v1 --vendor_name=experimental构建出的自定义包仅含IsinPartV1;run_example isin_part_v1 eager cust编译/链接通过并在 NPU 上成功执行,输出[1, 1, 0, 1, 1](等价isin([1,1,4,1,1], [0,1,2,3])),execute samples success,返回码 0(修复前为编译返回码 1/ 运行返回码 255)。bash -n scripts/util/gen_compile_option.sh通过;对ascendc_config.json真实条目(如Signbit、AdaptiveAvgPool3d)验证两处 awk 输出与原 gawk 版本一致;样例算子对实跑脚本syntax error数量为 0。scripts/下无其他 gawk 专属用法(三参数match(,,)、gensub)残留。文档更新
无。
类型标签
Related Roadmap: https://gitcode.com/cann/ops-math/issues/1259