已合并
[Inductor] fix AOTI update_constant_buffer bug #41499
zhucehw创建于 7月13日
[Inductor] fix AOTI update_constant_buffer bug #41499
已合并
Pull Request已成功合入, 合并人@ascend-robot
(感谢 zhucehw 的贡献)atomgit-bot
7月13日 评论:
7月13日 评论:
变更摘要
此 PR 主要修复了 AOTI 运行时 model_container.h 中 update_constant_buffer 函数的 NPU 内存拷贝方向错误,并将相关测试用例的数据类型从 float16 调整为 float32。
主要改动
- 修复
update_constant_buffer中aclrtMemcpy的拷贝方向:在torch_npu/csrc/inductor/aoti_runtime/model_container.h中,将常量缓冲区更新时的aclrtMemcpy拷贝方向参数从ACL_MEMCPY_HOST_TO_DEVICE改为ACL_MEMCPY_DEFAULT,使拷贝方向根据源地址和目标地址自动推断,避免在非 Host→Device 场景下的拷贝错误。 - 测试用例数据类型调整:在
test/_inductor/test_aoti_user_defined_op.py中,将Model类的Linear层、输入张量x_input、y_input以及 CPU 端张量z_input的数据类型统一从torch.float16改为torch.float32,以适配常量缓冲区修复后的行为或满足精度要求。


ascend-robot
7月13日 评论:
7月13日 评论:
atomgit-bot
7月13日 评论:
7月13日 评论:
7月13日 添加了label:ascend-cla/yes
ascend-robot
7月13日 评论:
7月13日 评论:
ascend-robot
7月13日 评论:
7月13日 评论:
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, rain-666 (2/2) | ✅ crazyDannyBoy (1/1) |
| torch_npu/csrc/inductor | ✅ crazyDannyBoy, rain-666 (2/2) | ✅ crazyDannyBoy (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)


ascend-robot
7月13日 评论:
7月13日 评论:
当前仓库存在以下 保护分支 :
| Protected Branch | Version | Release |
|---|---|---|
| master | ||
| v2.7.1 | ||
| v2.9.0 | ||
| v2.10.0 | ||
| v2.11.0 | ||
| v2.12.0 | ||
| v2.9.0-26.1.0 | ||
| v2.10.0-26.1.0 | ||
| v2.7.1-26.1.0 | ||
| v2.12.0-26.1.0 | ||
| v2.11.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-robot
7月13日 评论:
7月13日 评论:
通过PR创建命令启动流水线PR-pipeline_pytorch失败:获取流水线webHook失败!


ascend-robot
7月13日 评论:
7月13日 评论:
ascend docs pipeline is running...


7月13日 添加了label:docs-ci-pipeline-running
ascend-robot
7月13日 评论:
7月13日 评论:
✅ 跳过 docs ci 检查,没有需要检查的文档文件


7月13日 删除了label:docs-ci-pipeline-running
7月13日 添加了label:docs-ci-pipeline-success
7月13日 添加了label:ci-pipeline-running
ascend-robot
7月13日 评论:
7月13日 评论:
流水线 PR-pipeline_pytorch#44938 [ commitID:b06b58f3 ] 运行中
>>>代码风格自动修复执行成功(无修复内容)
| 阶段 | 任务名 | 状态 | 详情 |
|---|---|---|---|
| 编译构建 | Build_X86 | 🕚 | >>> |
| Build_ARM | 🕚 | >>> | |
| Build_LibTorch_x86 | 🕚 | >>> | |
| Build_LibTorch_ARM | 🕚 | >>> | |
| Build_X86_torchair | 🕚 | >>> | |
| Build_ARM_torchair | 🕚 | >>> | |
| patch_test | 🕚 | >>> | |
| 恶意代码检查 | Antipoison | 🕚 | >>> |
| 编码安全与规范检查 | CodeCheck | 🕚 | >>> |
| check_error | 🕚 | >>> | |
| CodeCheck_lintrunner | 🕚 | >>> | |
| 开源片段检查 | SCA | 🕚 | >>> |
| 开发者测试 | UT_X86_Part_01 | 🕚 | >>> |
| UT_X86_Part_02 | 🕚 | >>> | |
| 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 : 停止流水线


ascend-robot
7月13日 评论:
7月13日 评论:
ascend docs pipeline is running...


7月13日 删除了label:docs-ci-pipeline-success
7月13日 添加了label:docs-ci-pipeline-running
ascend-robot
7月13日 评论:
7月13日 评论:
✅ 跳过 docs ci 检查,没有需要检查的文档文件


7月13日 删除了label:docs-ci-pipeline-running
7月13日 添加了label:docs-ci-pipeline-success
ascend-robot
7月13日 评论:
7月13日 评论:
重试流水线失败:PR-pipeline_pytorch 仅失败状态流水线支持重试操作。


7月13日 删除了label:ci-pipeline-running
7月13日 添加了label:ci-pipeline-passed
ascend-robot
7月13日 评论:
7月13日 评论:
流水线 PR-pipeline_pytorch#44938 (重试第2次) [ commitID:b06b58f3 ] 已完成
>>>代码风格自动修复执行成功(无修复内容)
| 阶段 | 任务名 | 状态 | 详情 |
|---|---|---|---|
| 编译构建 | Build_X86 | ✅ | >>> |
| Build_ARM | ✅ | >>> | |
| Build_LibTorch_x86 | ✅ | >>> | |
| Build_LibTorch_ARM | ✅ | >>> | |
| Build_X86_torchair | 🛑 | >>> | |
| Build_ARM_torchair | 🛑 | >>> | |
| patch_test | 🛑 | >>> | |
| 恶意代码检查 | Antipoison | ✅ | >>> |
| 编码安全与规范检查 | CodeCheck | ✅ | >>> |
| check_error | ✅ | >>> | |
| CodeCheck_lintrunner | ✅ | >>> | |
| 开源片段检查 | SCA | ✅ | >>> |
| 开发者测试 | UT_X86_Part_01 | 🛑 | >>> |
| UT_X86_Part_02 | 🛑 | >>> | |
| 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 : 停止流水线


rain-666
7月13日 评论:
7月13日 评论:
/lgtm


dezheng889
7月13日 评论:
7月13日 评论:
/lgtm
/approve


7月13日 添加了label:approvedlgtm
7月13日 关闭了关联的issue
7月13日 合入了pull request
ascend-robot
7月13日 评论:
7月13日 评论:
ascend-robot
7月14日 评论:
7月14日 评论:
流水线 pytorch_gitcode_PR_multiVersion#12476 [ commitID:b06b58f3 ] 已完成


【合入来源】
https://gitcode.com/Ascend/pytorch/issues/2826?ref=&did=4160764#tid-4160764
【修改方案】
【资料变更】
不涉及
【接口变更】
不涉及
【功能验证】
CI PASS
【CheckList】