Merged
fix(inplace_apply_ftrl): default GEIR examples to device 0 #14365
fix(inplace_apply_ftrl): default GEIR examples to device 0 #14365
Merged
陈展熹Add on 9 days ago
陈展熹
陈展熹Collaborators
9 days ago

描述

InplaceApplyFtrl 的 arch35 静态、动态 GEIR 示例在未设置 GE_DEVICE_ID(或值为空)时默认选择设备 7。在只有一张可见 NPU 的环境中,这会因设备编号不存在而导致 GE 初始化失败。

将两个示例的默认设备号统一改为 0。设置非空 GE_DEVICE_ID 时继续使用调用者指定的设备。

关联的Issue

关联 Issue:#8754 — InplaceApplyFtrl arch35 示例默认设备 7 导致单卡环境无法运行。

测试

  • git diff --check 通过。
  • 定向 pre-commit 检查通过,包括空白、EOF、冲突标记、私钥检测及 OAT(实际扫描 2 个文件)。
  • 使用仓库固定的 clang-format 18.1.8 检查两处修改行,通过;预提交中的整文件 clang-format 以该定向检查替代。
  • 未执行 NPU 设备运行验证。

文档更新

无。

类型标签

AI/Agent生成声明

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for 陈展熹's contribution.)
陈展熹陈展熹Collaborators
9 days ago Created pull request, commit ec4a3484
atomgit-bot
atomgit-bot
9 days ago Comments:

变更摘要

本 PR 修复 InplaceApplyFtrl 的 arch35 GEIR 示例在单卡 NPU 环境下初始化失败的问题。两个示例(静态形状与动态形状)在未设置 GE_DEVICE_ID 环境变量或其值为空时,原先默认使用设备 7,在只有一张可见 NPU 的环境中该设备编号不存在,导致 GE 初始化失败。现将默认设备号统一改为 0,同时保留显式指定 GE_DEVICE_ID 时使用调用者所给设备的行为。

主要改动

  • 静态形状示例默认设备号: optim/inplace_apply_ftrl/examples/arch35/test_geir_inplace_apply_ftrl.cpp 中 devId 的兜底值由 "7" 改为 "0",使未配置环境变量时填充到 ge.exec.deviceId 的设备号为 0。
  • 动态形状示例默认设备号: optim/inplace_apply_ftrl/examples/arch35/test_geir_inplace_apply_ftrl_dynamic.cpp 中 devId 的兜底值同样由 "7" 改为 "0",与静态示例保持一致。
  • 环境变量优先级不变: 两处判断仍为 (envDev && *envDev) ? std::string(envDev) : ...,即 GE_DEVICE_ID 非空时依旧使用调用者指定的设备号,仅调整默认回退取值。

🧩 本次 Review 已使用自定义 Skill:

likedislike
Incorrect?
atomgit-bot
atomgit-bot
9 days ago Comments:

代码审查

✅ 未发现问题


🧩 本次 Review 已使用自定义 Skill:

likedislike
Incorrect?
CANN-robotCANN-robotCollaborators
9 days ago Added label: cann-cla/yes
CANN-robot
CANN-robotCollaborators
9 days ago Comments:

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
optim ✅ 钱泽洪, 上官秦南 (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

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

likedislike
CANN-robotCANN-robotCollaborators
9 days ago Set zengjuan,u010470851,chenfeng61,chaotang233,crystalhu,yu-xinjie62,yangyang016,fanqirui,su-yueming,chenqi317,wang-xing001,liubo75,tangweiwei2,east_yang,pingchuantang,qianzehong as approver
CANN-robotCANN-robotCollaborators
9 days ago Set u010470851,chenfeng61,yu-xinjie62,su-yueming,wang-xing001,east_yang,pingchuantang,qianzehong as approver
陈展熹陈展熹Collaborators
9 days ago Associated issue: [Bug-Report|缺陷反馈]: InplaceApplyFtrl arch35 示例默认设备 7 导致单卡环境无法运行
陈展熹陈展熹Collaborators
9 days ago Modify description of pull request
陈展熹
陈展熹Collaborators
9 days ago Comments:

compile

likedislike
陈展熹陈展熹Collaborators
9 days ago Pre merge succeeded (commit_id: c61e9242737be712f944c6a7e3d75f17bae4bbcb)
CANN-robot
CANN-robotCollaborators
9 days ago Comments:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robotCollaborators
9 days ago Added label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
9 days ago Removed label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
9 days ago Added label: ci-pipeline-passed
sgqt12
sgqt12Collaborators
9 days ago Comments:

/lgtm

likedislike
qianzehong
qianzehongCollaborators
9 days ago Comments:

/lgtm
/approve

likedislike
CANN-robotCANN-robotCollaborators
9 days ago Added label: lgtmapproved
CANN-robotCANN-robotCollaborators
9 days ago Closed associated issue
CANN-robotCANN-robotCollaborators
9 days ago Merged pull request
yuning_chen
yuning_chenCollaborators
9 days ago Comments:

您好,pr合入已准备就绪,请尽快联系committer进行检视,谢谢!
@yangyang016 @su-yueming @chaotang233 @east_yang @yu-xinjie62 @chenfeng61 @pingchuantang

likedislike