已合并
针对nn仓部分算子存在错误日志问题进行统一整改 #9382
gaomingyuan创建于 8月27日
针对nn仓部分算子存在错误日志问题进行统一整改 #9382
已合并
gaomingyuan创建于 8月27日
gaomingyuan
gaomingyuan
8月27日

描述

本 PR 针对 nn 仓部分算子的日志问题进行统一整改,核心内容包括三方面:一是将 activation/relu_grad_v2 与 activation/softplus 的示例测试程序中失败分支的 printf 日志级别由 INFO 纠正为 ERROR;二是对 relu_grad_v2、softplus、map_index、quant_update_scatter、sparse_slice 等算子的 tiling 代码统一修正 OP_LOGE 调用(将误传的 tilingContext 改为 tilingContext->GetNodeName()),并为失败日志补充 coreNum、ubSize、维度等关键参数,同时删除大量冗余的 OP_LOGD 调试日志;三是在 torch_extension/cann_ops_nn/op_builder/builder.py 中为算子 JIT 编译引入文件锁,避免多进程并发编译冲突。

关联的Issue

关联Issue#5183

测试

本地已完成新精度对比与性能测试,通过静态检查、蓝区冒烟、算子ST以及算子二级冒烟

文档更新

类型标签

AI/Agent生成声明

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 gaomingyuan 的贡献)
gaomingyuangaomingyuan
8月27日 创建了 pull request,commit 6c370c08
atomgit-bot
atomgit-bot
8月27日 评论:

变更摘要

本 PR 针对 nn 仓部分算子的日志问题进行统一整改,核心内容包括三方面:一是将 activation/relu_grad_v2 与 activation/softplus 的示例测试程序中失败分支的 printf 日志级别由 INFO 纠正为 ERROR;二是对 relu_grad_v2、softplus、map_index、quant_update_scatter、sparse_slice 等算子的 tiling 代码统一修正 OP_LOGE 调用(将误传的 tilingContext 改为 tilingContext->GetNodeName()),并为失败日志补充 coreNum、ubSize、维度等关键参数,同时删除大量冗余的 OP_LOGD 调试日志;三是在 torch_extension/cann_ops_nn/op_builder/builder.py 中为算子 JIT 编译引入文件锁,避免多进程并发编译冲突。

主要改动

  • 示例程序错误日志级别修正:在 test_geir_relu_grad_v2.cpp 与 test_geir_softplus.cpp 中,将 GE 初始化失败、RunGraph 失败、GEFinalize 失败三处分支的 printf 日志由 INFO 改为 ERROR,使失败场景的日志级别与语义一致。
  • tiling 错误日志参数修正:在 relu_grad_v2_tiling_arch35.cpp、softplus_tiling_arch35.cpp 等文件中,将 OP_LOGE(tilingContext, ...) 统一修正为 OP_LOGE(tilingContext->GetNodeName(), ...),修复错误日志中传入对象不匹配的问题。
  • 失败日志信息增强:在 map_index_tiling_arch35.cpp、sparse_slice_tiling_arch35.cpp 中为获取 coreNum/ubSize 失败的日志补充具体数值参数,并在 quant_update_scatter_tiling_arch35.cpp 中为 GetTilingNeg2 失败日志补充 updateDim2、updateDim3 维度信息,提升问题定位效率。
  • 冗余调试日志清理:批量删除各 tiling 文件(含 map_index、quant_update_scatter、sparse_slice 等)中多余的 OP_LOGD 入口/出口调试日志,并将 map_index 的 TilingPrepare4MapIndex 简化为单行实现。
  • JIT 编译并发保护:在 builder.py 的 OpBuilder 中新增基于 fcntl.flock 的文件锁(锁文件位于扩展目录 TORCH_EXTENSIONS_DIR 下),编译算子前先获取互斥锁,若算子已加载则直接返回缓存模块,防止并发 JIT 编译冲突。
likedislike
不准确?
atomgit-bot
atomgit-bot
8月27日 评论:

代码审查

✅ 未发现问题

likedislike
不准确?
CANN-robotCANN-robot成员
8月27日 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
8月27日 评论:

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
activation ✅ 唐玮玮, 汤平川, 王星 (3/2) ✅ 汤平川, 王星 (2/1)
index ✅ 唐玮玮, 汤平川, 王星 (3/2) ✅ 汤平川, 王星 (2/1)
torch_extension ✅ 唐玮玮, 汤平川 (2/2) ✅ 唐玮玮 (1/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)

CLA Signature Pass

qq_52874943, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
CANN-robot
CANN-robot成员
8月27日 评论:

CLA Signature Pass

qq_52874943, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
CANN-robotCANN-robot成员
8月27日 将zengjuan,chenfeng61,chaotang233,kevin_huang1234,FelixTang7,crystalhu,yangyang016,fanqirui,wangrui_,renruhai,su-yueming,zhajianqing123,chenqi317,wang-xing001,liubo75,tangweiwei2,liujie12345678,pingchuantang,Chen_HaoWen,qianzehong设为评审人
CANN-robotCANN-robot成员
8月27日 将chenfeng61,chaotang233,kevin_huang1234,FelixTang7,crystalhu,fanqirui,wangrui_,renruhai,su-yueming,zhajianqing123,chenqi317,wang-xing001,liubo75,tangweiwei2,liujie12345678,pingchuantang,Chen_HaoWen,qianzehong设为审查人
gaomingyuan
gaomingyuan
8月27日 评论:

compile

likedislike
gaomingyuangaomingyuan
8月27日 预合并成功(commit_id: 130e4a09d5168a03f5431995113018ba9104bbd0)
CANN-robotCANN-robot成员
8月27日 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
8月27日 评论:

流水线任务触发成功
任务链接 [78ef4d5398234302853139b747e2f3e0][流水线指导]

任务名称状态日志下载链接
Compile_Ascend_X86_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_mobile_station ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_single ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_experimental ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_950 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_950 ✅ SUCCESS >>>>> >>>>>
Compile_Pre ✅ SUCCESS >>>>>
pre_comment ✅ SUCCESS >>>>>
Compile_Ascend_X86 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_mobile_station_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_950_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_single_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_experimental_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_950_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_910b ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_910c ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_950 ✅ SUCCESS >>>>> >>>>>
Compile_classify ✅ SUCCESS >>>>>
Compile_Ascend_X86_mobile_station_9030_ubuntu24 ✅ SUCCESS >>>>> >>>>>
UT_Test_ophost ✅ SUCCESS
UT_Test_opapi ✅ SUCCESS
UT_Test_kernel ✅ SUCCESS
UT_Test_opgraph ✅ SUCCESS
PreSmoke_A900 ✅ SUCCESS >>>>>
API_Check ✅ SUCCESS >>>>>
PreSmoke_ATK_Test_A2 ✅ SUCCESS >>>>>
UT_Test_report_lcov ✅ SUCCESS >>>>>

[2026-08-27 21:59:16]    CI执行结束

likedislike
CANN-robot
CANN-robot成员
8月27日 评论:

流水线任务触发成功
任务链接 [e2d50481aea54d04a54e822a43945f45][流水线指导]

任务名称状态日志下载链接
antipoison ✅ SUCCESS >>>>>
codecheck_checkpr ✅ SUCCESS
codecheck_precommit ❌ FAILED >>>>> >>>>>
SCA ✅ SUCCESS >>>>>
StaticCheck_md ✅ SUCCESS
likedislike
CANN-robotCANN-robot成员
8月27日 添加了label:api-check-pass
CANN-robotCANN-robot成员
8月27日 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
8月27日 添加了label:ci-pipeline-failed
gaomingyuangaomingyuan
8月27日 预合并成功(commit_id: dee553fa21add81b3999280cbab08026f88264d9)
gaomingyuangaomingyuan
8月27日 强制推送  1 个提交:ab880d52-针对nn仓部分算子存在错误日志问题进行统一整改
gaomingyuangaomingyuan
8月27日 预合并成功(commit_id: c838a20c117164b66248445c7b0701cfd2bb5161)
gaomingyuan
gaomingyuan
8月27日 评论:

compile

likedislike
gaomingyuangaomingyuan
8月27日 预合并成功(commit_id: 08c49cd53477cf3429a9fcfae8cab9c9868da106)
CANN-robotCANN-robot成员
8月27日 删除了label:cann-cla/yes
CANN-robotCANN-robot成员
8月27日 添加了label:cann-cla/yes
CANN-robotCANN-robot成员
8月27日 删除了label:ci-pipeline-failedapi-check-pass
CANN-robotCANN-robot成员
8月27日 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
8月27日 评论:

流水线任务触发成功
任务链接 [9dbf3bd0d69a4bc5af7233dcb3021562][流水线指导]

任务名称状态日志下载链接
Compile_Ascend_X86_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_mobile_station ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_single ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_experimental ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_950 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_950 ✅ SUCCESS >>>>> >>>>>
Compile_Pre ✅ SUCCESS >>>>>
pre_comment ✅ SUCCESS >>>>>
Compile_Ascend_X86 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_mobile_station_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_950_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_single_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_experimental_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_950_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_910b ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_910c ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_950 ✅ SUCCESS >>>>> >>>>>
Compile_classify ✅ SUCCESS >>>>>
Compile_Ascend_X86_mobile_station_9030_ubuntu24 ✅ SUCCESS >>>>> >>>>>
UT_Test_ophost ✅ SUCCESS
UT_Test_opapi ✅ SUCCESS
UT_Test_kernel ✅ SUCCESS
UT_Test_opgraph ✅ SUCCESS
PreSmoke_A900 ✅ SUCCESS >>>>>
API_Check ✅ SUCCESS >>>>>
PreSmoke_ATK_Test_A2 ✅ SUCCESS >>>>>
UT_Test_report_lcov ✅ SUCCESS >>>>>

[2026-08-27 22:19:54]    CI执行结束

likedislike
CANN-robot
CANN-robot成员
8月27日 评论:

流水线任务触发成功
任务链接 [e932f73606b94099a16217d5b938301f][流水线指导]

任务名称状态日志下载链接
antipoison ✅ SUCCESS >>>>>
codecheck_checkpr ✅ SUCCESS
codecheck_precommit ✅ SUCCESS >>>>>
SCA ✅ SUCCESS >>>>>
StaticCheck_md ✅ SUCCESS

[2026-08-27 22:09:50]    CI执行结束

likedislike
CANN-robotCANN-robot成员
8月27日 添加了label:api-check-pass
CANN-robotCANN-robot成员
8月27日 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
8月27日 添加了label:ci-pipeline-passed
gaomingyuangaomingyuan
8月28日 修改了pull request 的描述
TangPC
TangPC成员
8月28日 评论:

/lgtm
/approve

likedislike
wang-xing001成员
8月28日 评论:

/lgtm
/approve

likedislike
tangweiwei2成员
8月28日 评论:

/lgtm
/approve

likedislike
CANN-robotCANN-robot成员
8月28日 添加了label:lgtmapproved
CANN-robotCANN-robot成员
8月28日 合入了pull request