已合并
[Fix] shmem init attr compatibility #39810
pengqihw创建于 7月1日
[Fix] shmem init attr compatibility #39810
已合并
pengqihw创建于 7月1日
pengqihw
pengqihw成员
7月1日

【合入来源】

如有社区issue,请关联issue链接
请勿携带内部流程信息(需求链接、问题单、内部issue等)

  • 需求
  • 问题单
  • issue/工单
  • 重构优化
  • 资料更新

【修改方案】

问题描述:torch_npu 2.7.1 中 third_party/shmem 引入的 aclshmemx_init_attr_t 结构体定义与 shmem 1.5.0 运行时库不一致,缺少 instance_id 字段,导致用例执行时读到随机值导致校验失败。
修改方案:对齐 third_party/shmem/include/shmem_host_def.h 中 aclshmemx_init_attr_t 的结构体布局,补充 instance_id 字段并设置默认值为 0,同时为 ip_port 和 comm_args 增加默认初始化。该修改保持与新版 shmem 头文件一致。

对旧版本兼容性说明:该修改只在 aclshmemx_init_attr_t 结构体尾部新增 instance_id 字段,并补充默认初始化,不改变已有字段的顺序和含义。
对新版 shmem 库:shmem 1.5.0 会读取并校验 instance_id,补齐该字段后可避免运行时读取越界或读取异常栈值,保证默认使用 instance_id = 0 的单实例初始化流程。
对旧版 shmem 库:旧库只读取原有字段,不会访问新增的尾部字段,因此结构体尾部扩展对旧库兼容。同时本次未修改 legacy shmem_init_attr_t、shmem_uniqueid_t 等旧接口结构体,避免影响旧 shmem_* fallback 路径。
整体上,这是一个向后兼容的 ABI 补齐:新版库可以正确读取新增字段,旧版库会忽略该字段。

【资料变更】

不涉及

【接口变更】

不涉及

【功能验证】

image.png
image.png

【CheckList】

PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]

  • 代码注释完备,正确记录错误日志
  • 代码实现进行了返回值、空指针等校验
  • PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等
  • PR持续集成流水线(CI)执行通过,代码检查无异常
likedislike
Pull Request已成功合入, 合并人@ascend-robot
(感谢 pengqihw 的贡献)
pengqihwpengqihw成员
7月1日 创建了 pull request,commit ce270e1d
ascend-robotascend-robot成员
7月1日 添加了label:ascend-cla/yes
ascend-robot
ascend-robot成员
7月1日 评论:

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-Ascend/pytorch liujunzhu, zhenyu10 (2/2) liujunzhu (1/1)

💡 Tip:

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

CLA Signature Pass

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

likedislike
ascend-robotascend-robot成员
7月1日 添加了label:needs-issue
此处折叠了52条消息 查看更多
ascend-robotascend-robot成员
7月2日 删除了label:needs-issue
ascend-robotascend-robot成员
7月2日 关闭了关联的issue
ascend-robotascend-robot成员
7月2日 合入了pull request
ascend-robot
ascend-robot成员
7月2日 评论:

Pull Request 已合并或已关闭。

If you want to solve this problem, you can click here to do it in the FAQs.

likedislike
ascend-robot
ascend-robot成员
7月2日 评论:
流水线 pytorch_gitcode_PR_multiVersion#11766 [ commitID:d05b87d2 ] 已完成
likedislike