Merged
【PR】: pyACL新增Device管理接口适配和rt-kernel接口适配 #5093
wuqifanAdd on Sep 20
【PR】: pyACL新增Device管理接口适配和rt-kernel接口适配 #5093
Merged
wuqifanAdd on Sep 20
wuqifan
wuqifan
Sep 20

Pull Request

描述

本提交新增 pyACL 对 Device Limit 管理接口和 Host Args Kernel 下发接口的适配,使 Python 用户能够调用对应的 AscendCL Runtime 能力。

主要变更如下:

  1. 新增以下 3 个 pyACL 接口:

    • acl.rt.device_set_limit
    • acl.rt.device_get_limit
    • acl.rt.launch_kernel_with_host_args
  2. 新增 Device Limit 接口封装:

    • device_set_limit 完成 Limit 类型和配置值的 Python 参数解析,并调用 aclrtDeviceSetLimit。
    • device_get_limit 调用 aclrtDeviceGetLimit,向 Python 层返回配置值和 ACL 错误码。
  3. 新增 Host Args Kernel 接口封装:

    • 完成 Function Handle、Block Dim、Stream、Kernel 配置、Host Args 和 PlaceHolder 信息的 Python 参数解析。
    • 复用现有 Kernel Launch Config 转换逻辑,将 Python 配置转换为 aclrtLaunchKernelCfg 和 aclrtLaunchKernelAttr。
    • 新增 PlaceHolder 列表转换逻辑,将 Python 字典中的 addrOffset、dataOffset 转换为 aclrtPlaceHolderInfo。
    • 校验 PlaceHolder 参数类型及列表长度,并调用 aclrtLaunchKernelWithHostArgs 完成 Kernel 下发。

本次变更仅新增 Python 接口适配,不修改底层 AscendCL Runtime 接口语义。

变更类型

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

关联的Issue

#1001

如何测试

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

  1. 编译 pyACL,确认新增接口能够正常注册和导入。
  2. 验证 device_set_limit 和 device_get_limit 的设置、查询结果符合预期。
  3. 验证 launch_kernel_with_host_args 能够正确解析 Kernel 配置、Host Args 和 PlaceHolder 参数并完成 Kernel 下发。
  4. 验证非法参数类型场景能够正常报错。

核对清单

其他信息

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

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for wuqifan's contribution.)
wuqifanwuqifan
Sep 20 Added label: enhancement
wuqifanwuqifan
Sep 20 Created pull request, commit 95f6d8f3
wuqifanwuqifan
Sep 20 Associated issue: [Requirement|需求建议]: pyACL新增Device管理接口适配和rt-kernel接口适配
CANN-robotCANN-robotCollaborators
Sep 20 Added label: stat/needs-squash
CANN-robotCANN-robotCollaborators
Sep 20 Added label: cann-cla/yes
CANN-robot
CANN-robotCollaborators
Sep 20 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
repo-cann/runtime ✅ 王涛, 卢煜坤 (2/2) ✅ 卢煜坤, 王涛 (2/1)

💡 Tip:

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

CLA Signature Pass

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

likedislike
CANN-robotCANN-robotCollaborators
Sep 20 Set wangtao43,zhangpengpeng8,yanmingxiang,Reyn52166,ykl999,houyanbao,tingwood as approver
CANN-robotCANN-robotCollaborators
Sep 20 Set wangtao43,zhangpengpeng8,yanmingxiang,Reyn52166,ykl999,houyanbao,tingwood as approver
wuqifan
wuqifan
Sep 20 Comments:

/compile

likedislike
wuqifanwuqifan
Sep 20 Pre merge succeeded (commit_id: 8bc3cffab3182b22a2c3536085f9bd139ef7b5f1)
CANN-robot
CANN-robotCollaborators
Sep 20 Comments:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robotCollaborators
Sep 20 Added label: ci-pipeline-running
wuqifanwuqifan
Sep 20 Modify description of pull request
wuqifanwuqifan
Sep 20 Modify description of pull request
CANN-robotCANN-robotCollaborators
Sep 20 Removed label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
Sep 20 Added label: ci-pipeline-passed
ykl999
ykl999Collaborators
Sep 20 Comments:

/approve
/lgtm

likedislike
CANN-robotCANN-robotCollaborators
Sep 20 Added label: approved
wangtao
wangtaoCollaborators
Sep 21 Comments:

/approve

likedislike
CANN-robotCANN-robotCollaborators
Sep 21 Added label: lgtm
CANN-robotCANN-robotCollaborators
Sep 21 Merged pull request