Closed
[Bug-Report|缺陷反馈]: pyACL 未适配 aclrtPtrAttributes 结构体变更,导致编译失败 #1485
wuqifanAdd on  4 days agoClosed at  4 days ago
wuqifan
wuqifan
4 days ago Create

Describe the current behavior / 问题描述 (Mandatory / 必填)

C 接口将 aclrtPtrAttributes 的 rsv[4] 替换为 hostPtr 和 devicePtr。pyACL 的 GetPyDictFromPtrAttributes 仍访问 attributes.rsv,使用同版本的 C 头文件编译时会报成员不存在。

Environment / 环境信息 (Mandatory / 必填)

  • Runtime 源码版本:master,提交 194a90393。
  • 目标环境:64 位 Linux。
  • 最小复现使用仓库中的 C 头文件和 GCC(本地 MinGW),只进行编译检查,无需昇腾设备。

Steps to reproduce the issue / 重现步骤 (Mandatory / 必填)

  1. 检出 Runtime 提交 194a90393,并使用同版本的 include/external/acl/acl_rt.h。
  2. 编译 pyACL 的 python/pyACL/rt/rt_memory.cpp,观察 GetPyDictFromPtrAttributes 中访问 attributes.rsv 时的编译错误。
  3. 也可单独编译一段包含该头文件、对 aclrtPtrAttributes 实例求 sizeof(attributes.rsv) 的 C++ 代码,复现同一错误。

Describe the expected behavior / 预期结果 (Mandatory / 必填)

pyACL 可以使用同版本的 C 头文件编译。acl.rt.pointer_get_attributes(ptr) 返回 (attributes, ret),其中 attributes 包含 location、page_size、host_ptr 和 device_ptr。两个地址字段均为 Python int,C 空指针对应 0。

最小复现的 GCC 诊断

error: 'aclrtPtrAttributes' {aka 'struct aclrtPtrAttributes'} has no member named 'rsv'

Special notes for this issue/备注 (Optional / 选填)

同步更新 pyACL 中英文 aclrtPtrAttributes 文档,将字段名统一为 page_size,并说明 host_ptr 和 device_ptr 的返回值。

C 结构体变更 · pyACL 封装

likedislike
wuqifanwuqifan
4 days ago Associated pull request
wuqifan
wuqifan
4 days ago Comments:

/assign

likedislike
CANN-robotCANN-robotCollaborators
4 days ago Assign weixin_46600764 as responsible person
CANN-robotCANN-robotCollaborators
4 days ago Close issue
ykl999
ykl999Collaborators
4 days ago Comments:

你好,相关结构体pyacl适配pr已合入,感谢贡献!

likedislike
CANN-robotCANN-robotCollaborators
4 days ago Added label: resolved