Pull Request已成功合入, 合并人@ascend-robot
(感谢 Erwinnn 的贡献)变更摘要
该 PR 主要将 NPU Fast Launch 的 kernel 启动路径从私有 rtKernelLaunch / rtKernelLaunchWithFlagV2 接口迁移到 ACL 提供的 host-args API aclrtLaunchKernelWithHostArgs,并同步更新了对应测试的源码断言。核心改动集中在 torch_npu/_inductor/experimental/python_wrapper_fast_launch/csrc/bindings.cpp:移除了为旧接口自定义的任务配置结构体和弱符号声明,新增 <acl/acl_rt.h> 头文件依赖,并在 SubmitLaunch 中统一通过 aclrtLaunchKernelWithHostArgs 提交 kernel,SIMT 场景下通过 aclrtLaunchKernelAttr 与 aclrtLaunchKernelCfg 传递动态 UBUF 大小。
主要改动
- 启动接口迁移为 ACL host-args API:
SubmitLaunch中将原来的rtKernelLaunch和rtKernelLaunchWithFlagV2调用统一替换为aclrtLaunchKernelWithHostArgs,kernel、block 数量、stream、参数指针和大小均以对应 ACL 类型传入。 - 移除旧私有接口相关定义:删除了
FastLaunchRtTaskCfgInfo、FastLaunchRtHostInputInfo、FastLaunchRtArgsExInfo等结构体及其static_assert,并移除rtKernelLaunchWithFlagV2的extern "C"弱符号声明和FastLaunchRtKernelLaunchWithFlagV2类型别名。 - 新增 ACL 头文件依赖:在
bindings.cpp中引入#include <acl/acl_rt.h>,以支持aclrtLaunchKernelWithHostArgs及相关结构体、枚举的使用。 - SIMT 动态 UBUF 配置改用 ACL 属性:在
enableSimt分支中,通过aclrtLaunchKernelAttr(属性ACL_RT_LAUNCH_KERNEL_ATTR_DYN_UBUF_SIZE)和aclrtLaunchKernelCfg传递sharedMemDynamicSize,替代原先通过FastLaunchRtTaskCfgInfo.localMemorySize的传参方式。 - 同步更新测试断言:
test_npu_fast_launch_static.py中改为断言生成的源码包含aclrtLaunchKernelWithHostArgs与ACL_RT_LAUNCH_KERNEL_ATTR_DYN_UBUF_SIZE,同时不再包含rtKernelLaunch(与rtKernelLaunchWithFlagV2。


代码审查
我已审查完两个改动文件。
审查结论
发现的问题(2 个):
| 优先级 | 文件:行 | 问题 |
|---|---|---|
| P0 | bindings.cpp:349 |
launchAttr.value.dynUBufSize 不是 aclrtLaunchKernelAttrValue 的成员,应使用 localMemorySize,否则编译失败 |
| P1 | bindings.cpp:16 |
#include <acl/acl_rt.h> 与仓库主构建惯例不一致,主构建可能无法解析该头文件 |
各文件审查确认
torch_npu/_inductor/experimental/python_wrapper_fast_launch/csrc/bindings.cpp— 发现 2 个问题(如上)。核心逻辑迁移方向正确(enableSimt分支、aclrtLaunchKernelWithHostArgs参数顺序、返回值处理均与仓库参考实现cpp_wrapper_npu.py一致),但属性值字段名写错会直接阻断编译。test/_inductor/experimental/python_wrapper_fast_launch/test_npu_fast_launch_static.py— no issues。静态断言更新正确(aclrtLaunchKernelWithHostArgs、ACL_RT_LAUNCH_KERNEL_ATTR_DYN_UBUF_SIZE的 assertIn,以及旧 API 的 assertNotIn 均为有效子串匹配,不会误报)。
总体风险判断
高风险,存在编译阻断。P0 的 dynUBufSize 字段名错误几乎必然导致 bindings.cpp 编译失败(仓库自身参考实现使用 localMemorySize),必须修复后才能合入;P1 的 include 路径问题也需按仓库惯例统一,否则主 CMake 构建可能找不到头文件。
| 类型 | 数量 |
|---|---|
| 🔴 阻塞 | 1 |
| 🟡 建议 | 0 |
⛔ 需要修改


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 |
|---|---|---|
| test | ✅ crazyDannyBoy, TonyYA (2/2) | ✅ crazyDannyBoy (1/1) |
| torch_npu/_inductor | ✅ crazyDannyBoy, TonyYA (2/2) | ✅ crazyDannyBoy (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
jiabiao_o, thanks for your pull request. All authors of the commits have signed the CLA. 👍


Linking Issue Notice
@jiabiao_o , the pull request must be linked to at least one issue.
If an issue has already been linked, but the needs-issue label remains, you can remove the label by commenting /check-issue .


当前仓库存在以下 保护分支 :
| Protected Branch | Version | Release |
|---|---|---|
| master | ||
| v2.12.0 | ||
| v2.11.0 | ||
| v2.7.1 | ||
| v2.10.0 | ||
| v2.9.0 | ||
| v2.7.1-26.1.0 | ||
| v2.11.0-26.1.0 | ||
| v2.12.0-26.1.0 | ||
| v2.10.0-26.1.0 | ||
| v2.9.0-26.1.0 | ||
| ci-test |
评论 /sync <branch1> <branch2> ... 可将当前 PR 修改同步到其它分支(创建同步 PR):
a) 如果当前 PR 是 Open 状态,同步操作将延迟到 PR 被合并时执行
b) 如果当前 PR 已经 Merged,将立即执行同步操作
注意:
- /sync 命令可以指定同步到多个分支,仅最后一个 /sync 命令生效
- 如果创建的同步 PR 不正确,可通过向同步 PR 的源分支提交轻量级 PR 完善,或使用 /close 命令关闭


ascend docs pipeline is running...


✅ 跳过 docs ci 检查,没有需要检查的文档文件


🔴 Critical
建议:将 launchAttr.value.dynUBufSize 改为 launchAttr.value.localMemorySize,与仓库内 cpp_wrapper_npu.py 中同属性的赋值方式保持一致。
|
350 | + launchAttr.value.localMemorySize = |
| 350
351 | static_cast<uint32_t>(sharedMemDynamicSize); |


| 阶段 | 任务名 | 状态 | 详情 |
|---|---|---|---|
| 编译构建 | Build_X86 | ✅ | >>> |
| Build_ARM | ✅ | >>> | |
| Build_LibTorch_x86 | ✅ | >>> | |
| Build_LibTorch_ARM | ✅ | >>> | |
| Build_X86_torchair | 🛑 | >>> | |
| Build_ARM_torchair | 🛑 | >>> | |
| patch_test | 🛑 | >>> | |
| 恶意代码检查 | Antipoison | ✅ | >>> |
| 编码安全与规范检查 | codecheck_pre-commit | ✅ | >>> |
| check_error | ✅ | >>> | |
| lintrunner | ✅ | >>> | |
| 开源片段检查 | SCA | ✅ | >>> |
| 开发者测试 | UT_ARM_A3_Part_01 | 🛑 | >>> |
| UT_ARM_A3_Part_02 | 🛑 | >>> | |
| UT_ARM_A2_Part_01 | ✅ | >>> | |
| UT_ARM_A2_Part_02 | ✅ | >>> | |
| UT_ARM_A2_Part_03 | ✅ | >>> | |
| UT_inductor_Part_01 | ✅ | >>> | |
| UT_inductor_Part_02 | ✅ | >>> | |
| UT_inductor_Part_03 | ✅ | >>> | |
| UT_inductor_Part_04 | ❌ | >>> | |
| UT_DIST_ARM_Part_01 | 🛑 | >>> | |
| UT_DIST_ARM_Part_02 | 🛑 | >>> | |
| UT_DIST_ARM_Part_03 | 🛑 | >>> | |
| UT_DIST_ARM_Part_04 | 🛑 | >>> | |
| UT_ARM_A2_Select_Part_01 | ✅ | >>> | |
| UT_ARM_A2_Select_Part_02 | ✅ | >>> | |
| 流水线 | PR-pipeline_pytorch | ❌ | >>> |
- compile、compile_inductor、compile_torchair : 运行流水线
- retry : 重试流水线所有失败子任务
- retry <任务名> : 仅重试指定失败子任务
- stop : 停止流水线


CLA检查已通过,详情可参考这里


| 阶段 | 任务名 | 状态 | 详情 |
|---|---|---|---|
| 编译构建 | Build_X86 | ✅ | >>> |
| Build_ARM | ✅ | >>> | |
| Build_LibTorch_x86 | ✅ | >>> | |
| Build_LibTorch_ARM | ✅ | >>> | |
| Build_X86_torchair | 🛑 | >>> | |
| Build_ARM_torchair | 🛑 | >>> | |
| patch_test | 🛑 | >>> | |
| 恶意代码检查 | Antipoison | ✅ | >>> |
| 编码安全与规范检查 | codecheck_pre-commit | ✅ | >>> |
| check_error | ✅ | >>> | |
| lintrunner | ✅ | >>> | |
| 开源片段检查 | SCA | ✅ | >>> |
| 开发者测试 | UT_ARM_A3_Part_01 | 🛑 | >>> |
| UT_ARM_A3_Part_02 | 🛑 | >>> | |
| UT_ARM_A2_Part_01 | ✅ | >>> | |
| UT_ARM_A2_Part_02 | ✅ | >>> | |
| UT_ARM_A2_Part_03 | ✅ | >>> | |
| UT_inductor_Part_01 | ✅ | >>> | |
| UT_inductor_Part_02 | ✅ | >>> | |
| UT_inductor_Part_03 | ✅ | >>> | |
| UT_inductor_Part_04 | ✅ | >>> | |
| UT_DIST_ARM_Part_01 | 🛑 | >>> | |
| UT_DIST_ARM_Part_02 | 🛑 | >>> | |
| UT_DIST_ARM_Part_03 | 🛑 | >>> | |
| UT_DIST_ARM_Part_04 | 🛑 | >>> | |
| UT_ARM_A2_Select_Part_01 | ✅ | >>> | |
| UT_ARM_A2_Select_Part_02 | ✅ | >>> | |
| 流水线 | PR-pipeline_pytorch | ✅ | >>> |
- compile、compile_inductor、compile_torchair : 运行流水线
- retry : 重试流水线所有失败子任务
- retry <任务名> : 仅重试指定失败子任务
- stop : 停止流水线


/lgtm


/lgtm
/approve


The following label exists.
needs-issue: The pull request must be linked to at least one issue.


Pull Request 已合并或已关闭。
If you want to solve this problem, you can click here to do it in the FAQs.




【合入来源】
【修改方案】
aclrtLaunchKernelWithHostArgs,移除旧私有接口依赖。【资料变更】
不涉及。
【接口变更】
不涉及跨仓及客户可见接口变更。
【功能验证】
相关静态 UT 及 PR CI 流水线执行通过。
【CheckList】