已合并
【fix】: modify GraphNode construct func #4256
tang-haojie创建于 15 天前
【fix】: modify GraphNode construct func #4256
已合并
tang-haojie创建于 15 天前
tang-haojie成员
15 天前

Pull Request

描述

GetOption 未设置该 option 时,opt 为空字符串 ""。std::stoi("") 会抛出 std::invalid_argument 异常,被 catch(...) 捕获并打警告日志。虽然不崩溃,但每次构造 GraphNode 时都会触发一次异常,属于日志层面大量打印警告的问题。空 option 时也走了 catch 分支打印 "Option %s param failed:" 警告,属于误报。

变更类型

请选择本次引入的变更类型:

  • 🐛 Bug 修复
  • ✨ 新功能
  • 💄 代码风格更新(格式化,局部变量)
  • ♻️ 重构(既不修复错误也不增加功能的代码变动)
  • 📦 构建过程或辅助工具的变动
  • 📝 文档内容更新

关联的Issue

如何测试

描述测试此变更的步骤和前提条件:
1.
2.

核对清单

  • 我的代码遵循了项目的代码风格
  • 我已对代码进行了自测
  • 我已更新了相关的文档
  • 我在标题中使用了合适的类型标签(如:feat:, fix:
  • 我已经详细阅读了贡献指南(CONTRIBUTING.md),并遵守了其中的所有规定,包括但不限于commit message的格式、无效commit的合并等

其他信息

在此添加任何其他关于本次 PR 的说明。

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 tang-haojie 的贡献)
Ttang-haojie成员
15 天前 添加了label:enhancement
Ttang-haojie成员
15 天前 创建了 pull request,commit 1e908021
atomgit-bot
atomgit-bot
15 天前 评论:

变更摘要

此 PR 修复了 GraphNode 构造函数中因 GetOption 返回空字符串导致 std::stoi("") 抛出异常、进而触发误报警告日志的问题。通过将转换逻辑从 "先转换再捕获异常" 改为 "先检查空值再安全转换",消除了每次构造 GraphNode 时都会产生的 std::invalid_argument 异常和相应的误报警告日志。

主要改动

  • 移除 try-catch 异常处理块:删除了原有的 try { max_num = std::stoi(opt); } catch(...) { ... } 结构,避免依赖异常处理来应对空字符串等无效输入。
  • 新增空值检查和 ConvertToInt32 安全转换:加入了 !opt.empty() 前置检查,并使用 ConvertToInt32(opt, max_num) 替代 std::stoi,只有在转换成功且值大于 0 时才更新 max_load_record_
  • max_load_record_ 赋值改为显式类型转换:将 max_load_record_ = max_num 改为 max_load_record_ = static_cast<uint32_t>(max_num),使 int32_tuint32_t 的类型转换更加明确。
likedislike
atomgit-bot
atomgit-bot
15 天前 评论:

代码审查

✅ 未发现问题

likedislike
CANN-robotCANN-robot成员
15 天前 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
15 天前 评论:

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
repo-cann/ge 张德鹏, Mexyy, yuht9 (3/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

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

likedislike
CANN-robotCANN-robot成员
15 天前 将yangyongqiang0606,kobemini,tangqunzhang,xchu42,hugo111,lining23666,fu-jun2,depeng1994,wqtshg_wt,peiyang,shengnan666,zhangfan_hanq,zhanj,zhujingjing,Mexyy,wangxiaotian995,stevenaw0,yuht9设为评审人
CANN-robotCANN-robot成员
15 天前 将yangyongqiang0606,kobemini,tangqunzhang,xchu42,hugo111,lining23666,fu-jun2,depeng1994,wqtshg_wt,peiyang,shengnan666,zhangfan_hanq,zhanj,zhujingjing,Mexyy,wangxiaotian995,stevenaw0,yuht9设为审查人
tang-haojie成员
15 天前 评论:

compile

likedislike
Ttang-haojie成员
15 天前 update merge request[project id: 8824148, iid: 4256, commit_id: 1d9f0a2d5dcf736ee986266a0d273ae2424d108d] virtual merging success
CANN-robotCANN-robot成员
15 天前 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
15 天前 评论:

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

任务名称状态日志下载链接
pre_comment ✅ SUCCESS >>>>>
Compile_ARM_compiler ✅ SUCCESS >>>>> >>>>>
Compile_ARM_executor ✅ SUCCESS >>>>> >>>>>
Compile_ARM_dflow ✅ SUCCESS >>>>> >>>>>
API_Check ✅ SUCCESS >>>>>
PreSmoke_A900_npupool ✅ SUCCESS >>>>>

[2026-08-04 11:35:23]    CI执行结束

likedislike
CANN-robot
CANN-robot成员
15 天前 评论:

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

任务名称状态日志下载链接
pre_comment ✅ SUCCESS >>>>>
Compile_X86_compiler ✅ SUCCESS >>>>> >>>>>
Compile_X86_executor ✅ SUCCESS >>>>> >>>>>
Compile_X86_dflow ✅ SUCCESS >>>>> >>>>>
UT_Test_dflow ✅ SUCCESS
UT_Test_ge_common ✅ SUCCESS
UT_Test_parser ✅ SUCCESS
UT_Test_python ✅ SUCCESS >>>>>
UT_Test_rt ✅ SUCCESS
UT_Test_acl ✅ SUCCESS
UT_Test_autofuse ✅ SUCCESS
UT_Test_executor ✅ SUCCESS
UT_Test_autofuse_ascendc_api ✅ SUCCESS
ST_Test_dflow ✅ SUCCESS
ST_Test_ge_common ✅ SUCCESS
ST_Test_parser ✅ SUCCESS
ST_Test_python ✅ SUCCESS >>>>>
ST_Test_rt ✅ SUCCESS
ST_Test_autofuse ✅ SUCCESS
ST_Test_executor ✅ SUCCESS
ST_Test_hetero ✅ SUCCESS
ST_Test_autofuse_ascendc_api ✅ SUCCESS
ST_Test_autofuse_e2e ✅ SUCCESS
UT_Test_fe ✅ SUCCESS
UT_Test_tefusion ✅ SUCCESS
ST_Test_fe ✅ SUCCESS
ST_Test_tefusion ✅ SUCCESS
ST_Test_ge_common_atc ✅ SUCCESS
UT_Test_Report_graphengine ✅ SUCCESS >>>>>
UT_Test_Report_ge_executor_c ✅ SUCCESS >>>>>
UT_Test_Report_ge_autofuse ✅ SUCCESS >>>>>
ST_Test_Report_graphengine ✅ SUCCESS >>>>>
ST_Test_Report_ge_executor_c ✅ SUCCESS >>>>>
ST_Test_Report_ge_autofuse ✅ SUCCESS >>>>>
UT_Test_Report_fe ✅ SUCCESS >>>>>
ST_Test_Report_fe ✅ SUCCESS >>>>>

[2026-08-04 11:42:31]    CI执行结束

likedislike
CANN-robot
CANN-robot成员
15 天前 评论:

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

任务名称状态日志下载链接
codecheck_Pr ✅ SUCCESS
antipoison ✅ SUCCESS >>>>>
SCA ✅ SUCCESS >>>>>
codecheck_dt ✅ SUCCESS >>>>>
codecheck_precommit ✅ SUCCESS >>>>>
StaticCheck_codespell ✅ SUCCESS
StaticCheck_link_validity ✅ SUCCESS
StaticCheck_resource_existence ✅ SUCCESS
StaticCheck_tag_closed ✅ SUCCESS
StaticCheck_markdownlint ✅ SUCCESS

[2026-08-04 11:33:25]    CI执行结束

likedislike
CANN-robotCANN-robot成员
15 天前 添加了label:api-check-pass
此处折叠了9条事件消息 查看更多
CANN-robotCANN-robot成员
15 天前 添加了label:ci-pipeline-passed
夏国正成员
15 天前 评论:

/lgtm

likedislike
夏国正成员
15 天前 评论:

【MR评价】评价分数:3,
评价意见:
编码规范遵守度:无编码规范问题;
代码设计:不涉及代码设计;
DT质量:基本逻辑DT测试覆盖充足;

likedislike
yuht9成员
15 天前 评论:

/lgtm

likedislike
CANN-robotCANN-robot成员
15 天前 添加了label:lgtm
张德鹏成员
14 天前 评论:

/approve

likedislike
CANN-robotCANN-robot成员
14 天前 添加了label:approved
CANN-robotCANN-robot成员
14 天前 合入了pull request