Merged
[feat]: Add HIXL Engine Python binding and whl packaging #658
LuoYangyangAdd on Jun 22
[feat]: Add HIXL Engine Python binding and whl packaging #658
Merged
LuoYangyangAdd on Jun 22
LuoYangyang
Jun 22

提交 PR 前,请先阅读 HIXL贡献指南 ,查看 PR 提交方式并遵守相关提交规范。

类型标签

描述

本需求为 HIXL Engine 新增 Python Binding,通过 pybind11 将 HIXL C++ 公开接口完整暴露为 Python 模块 hixl,使用户可以在 Python 中完成初始化、内存注册、建链、同步/异步传输、通知、能力查询等全部操作。解决issue #461

测试结果

tests/python/test_hixl_engine_api.py
image.png

examples/python/hixl_d2rd_multiproc_sample.py
image.png
image.png

Checklist

其它(可选)

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for LuoYangyang's contribution.)
LuoYangyangLuoYangyang
Jun 22 Created pull request, commit 8818d75e
CANN-robotCANN-robotCollaborators
Jun 22 Added label: stat/needs-squash
CANN-robotCANN-robotCollaborators
Jun 22 Added label: cann-cla/yes
CANN-robot
CANN-robotCollaborators
Jun 22 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
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/hixl ✅ lining23666, zhujingjing, zhaozhihui (3/2) ✅ zhujingjing (1/1)

💡 Tip:

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

CLA Signature Pass

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

likedislike
atomgit-bot
atomgit-bot
Jun 22 Comments:

变更摘要

此 PR 为 HIXL 引擎添加 Python 绑定和 whl 打包支持。主要新增了一个 C++ wrapper 模块(hixl_engine_wrapper),通过 pybind11 将 HIXL C++ API 暴露给 Python,并配套 CMake 构建脚本和 setuptools 打包配置来自动构建 .whl 安装包。

主要改动

  • 新增 HixlEngineWrapper 类:在 hixl_engine_wrapper.h/cc 中实现,封装了 hixl::Hixl 引擎的初始化、内存注册/注销、连接管理、数据传输、通知等全部核心功能,采用全静态方法和 std::shared_mutex 保证线程安全。
  • 新增 pybind11 绑定模块:hixl_wrapper.cc 通过 PYBIND11_MODULE 将 HixlEngineWrapper 的所有方法和状态码常量导出为 Python 模块 hixl_engine_wrapper,使用 py::call_guard<py::gil_scoped_release>() 释放 GIL 以支持并发。
  • 新增 CMake 构建与 whl 打包:hixl_wrapper/CMakeLists.txt 将 wrapper 编译为 .so 动态库模块;hixl_engine/CMakeLists.txt 通过自定义命令调用 setup.py 将 .so 打包为 hixl_engine-0.0.1-py3-none-any.whl。
  • 多处 HIXL_CHECK_NOTNULL 宏返回类型不匹配:RegisterMem、TransferAsync、GetAsyncConnectStatus、GetAllAsyncConnectStatus、GetTransferStatus、GetTransferStatusBatch、GetNotifies 共 7 个函数返回 std::pair<...>,但宏展开为 return hixl::PARAM_INVALID;,类型不兼容导致编译错误。
  • RegisterMem 和 TransferAsync 中 ret 变量作用域错误:ret 在内部 {} 块中声明,块外 return 引用已失效变量,同样导致编译错误。
likedislike
Incorrect?
626 messages are collapsed here。 See more
zhujingjing
zhujingjingCollaborators
Aug 14 Comments:

/approve

likedislike
CANN-robotCANN-robotCollaborators
Aug 14 Added label: approved
CANN-robot
CANN-robotCollaborators
Aug 14 Comments:

The MR can not be merged, because of CodeReview discussion not resolved

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

likedislike
liuhaoliuhaoCollaborators
Aug 14 Resolved final issue
CANN-robotCANN-robotCollaborators
Aug 14 Merged pull request