已合并
[Fix] shmem init attr compatibility #39810
pengqihw创建于 7月1日
[Fix] shmem init attr compatibility #39810
已合并
Pull Request已成功合入, 合并人@ascend-robot
(感谢 pengqihw 的贡献)ascend-robot
7月1日 评论:
7月1日 评论:
7月1日 添加了label:ascend-cla/yes
ascend-robot
7月1日 评论:
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
/approveor/lgtm- Commenting
/approveimplies 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. 👍


7月1日 添加了label:needs-issue
此处折叠了52条消息 查看更多
7月2日 删除了label:needs-issue
7月2日 关闭了关联的issue
7月2日 合入了pull request
ascend-robot
7月2日 评论:
7月2日 评论:
Pull Request 已合并或已关闭。
If you want to solve this problem, you can click here to do it in the FAQs.


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


【合入来源】
【修改方案】
问题描述: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 补齐:新版库可以正确读取新增字段,旧版库会忽略该字段。
【资料变更】
不涉及
【接口变更】
不涉及
【功能验证】
【CheckList】