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
Merged fromqq_43646600/hixl_lyyhixl_lyyintocann/hixlmaster
Pull Request has been successfully merged by CANN-robot.
(Thank you for LuoYangyang's contribution.)Jun 22 Created pull request, commit 8818d75e
Jun 22 Added label: stat/needs-squash
Jun 22 Added label: cann-cla/yes
CANN-robot
Jun 22 Comments:
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
/approveor/lgtm- Commenting
/approveimplies 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. 👍


atomgit-bot
Jun 22 Comments:
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引用已失效变量,同样导致编译错误。


Incorrect?
626 messages are collapsed here。 See more
zhujingjing
Aug 14 Comments:
Aug 14 Comments:
/approve


Aug 14 Added label: approved
CANN-robot
Aug 14 Comments:
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.


Aug 14 Resolved final issue
Aug 14 Merged pull request
提交 PR 前,请先阅读 HIXL贡献指南 ,查看 PR 提交方式并遵守相关提交规范。
类型标签
描述
本需求为 HIXL Engine 新增 Python Binding,通过 pybind11 将 HIXL C++ 公开接口完整暴露为 Python 模块 hixl,使用户可以在 Python 中完成初始化、内存注册、建链、同步/异步传输、通知、能力查询等全部操作。解决issue #461
测试结果
tests/python/test_hixl_engine_api.py

examples/python/hixl_d2rd_multiproc_sample.py


Checklist
其它(可选)