已合并
[sync] PR-39043: [fix] 连续性判断 #39105
[sync] PR-39043: [fix] 连续性判断 #39105
已合并
ascend-robot创建于 6月23日
ascend-robot
ascend-robot成员
6月23日

1. Origin pull request:

https://gitcode.com/Ascend/pytorch/merge_requests/39043

https://gitcode.com/Ascend/pytorch/issues/2456

Sha Datetime Message
5b0f3512 2026-06-23 15:06:24 +0800 CST update: 更新文件 combine_tensors.py


Signed-off-by: l1919_snow lixinyu68@huawei.com
d4aa904e 2026-06-23 15:01:01 +0800 CST update: 更新文件 combine_tensors.py


Signed-off-by: l1919_snow lixinyu68@huawei.com
a41d3f48 2026-06-23 14:55:42 +0800 CST update: 更新文件 combine_tensors.py
格式

Signed-off-by: l1919_snow lixinyu68@huawei.com
c484f60f 2026-06-23 14:48:30 +0800 CST update: 更新文件 combine_tensors.py
格式修改

Signed-off-by: l1919_snow lixinyu68@huawei.com
e44f6486 2026-06-22 15:32:19 +0800 CST 连续性判断
likedislike
Pull Request已成功合入, 合并人@ascend-robot
(感谢 ascend-robot 的贡献)
ascend-robotascend-robot成员
6月23日 创建了 pull request,commit 3a4118a0
ascend-robotascend-robot成员
6月23日 关联了issue:[Usage]: 接口输入非内存连续实际无校验,但文档描述必须为内存连续,需要加一个校验:输入非连输入校验。
ascend-robotascend-robot成员
6月23日 添加了label:stat/needs-squash
ascend-robotascend-robot成员
6月23日 添加了label:ascend-cla/yes
ascend-robot
ascend-robot成员
6月23日 评论:

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
torch_npu/utils liangsongwei, htchu (2/2) htchu, liangsongwei (2/1)

💡 Tip:

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

CLA Signature Pass

ascend-ds-bot, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
ascend-robot
ascend-robot成员
6月23日 评论:

Ascend docs pipeline is running...

likedislike
ascend-robotascend-robot成员
6月23日 添加了label:docs-ci-pipeline-running
ascend-robot
ascend-robot成员
6月23日 评论:

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

likedislike
ascend-robotascend-robot成员
6月23日 删除了label:docs-ci-pipeline-running
ascend-robotascend-robot成员
6月23日 添加了label:docs-ci-pipeline-success
ascend-robotascend-robot成员
6月23日 update merge request[project id: 7404318, iid: 39105, commit_id: 21df2796042e20ea16ca57a3ad975b980fbe2193] virtual merging success
ascend-robotascend-robot成员
6月23日 强制推送  22 个提交:06ecd6e4-17 commits from branch v2.12.07bff8155-连续性判断,2379f26b-update: 更新文件 combine_tensors.py,7199bccb-update: 更新文件 combine_tensors.py,e102d024-update: 更新文件 combine_tensors.py,b974ea14-update: 更新文件 combine_tensors.py
ascend-robotascend-robot成员
6月23日 update merge request[project id: 7404318, iid: 39105, commit_id: a4ae102a209c5ec7c0f29fe967de135ff58da6b5] virtual merging success
L1919_snow成员
6月23日 评论:

compile

likedislike
ascend-robotascend-robot成员
6月23日 添加了label:ci-pipeline-running
ascend-robot
ascend-robot成员
6月23日 评论:

Ascend docs pipeline is running...

likedislike
ascend-robotascend-robot成员
6月23日 删除了label:docs-ci-pipeline-success
ascend-robotascend-robot成员
6月23日 添加了label:docs-ci-pipeline-running
ascend-robot
ascend-robot成员
6月23日 评论:

Ascend docs pipeline is running...

likedislike
ascend-robot
ascend-robot成员
6月23日 评论:

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

likedislike
ascend-robotascend-robot成员
6月23日 删除了label:docs-ci-pipeline-running
ascend-robotascend-robot成员
6月23日 添加了label:docs-ci-pipeline-success
ascend-robot
ascend-robot成员
6月23日 评论:

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

likedislike
ascend-robotascend-robot成员
6月23日 删除了label:ci-pipeline-running
ascend-robotascend-robot成员
6月23日 添加了label:ci-pipeline-passed
ascend-robot
ascend-robot成员
6月23日 评论:
流水线 PR-pipeline_pytorch#38602 已完成
阶段 任务名 状态 详情
编译构建 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 >>>
likedislike
atomgit-bot
atomgit-bot
6月24日 评论:

根据 PR 标题和文件变更,该同步合并请求来自原始 PR #39043,目的是修复 combine_tensors.py 中的连续性判断逻辑。

变更摘要

此 PR 修复了 torch_npu/utils/combine_tensors.py 中组合张量(combined tensor)有效性校验时对张量**连续性(contiguity)**判断缺失的问题。在 is_combined_tensor_valid 函数中增加了 tensor.is_contiguous() 检查,确保只有内存连续的张量才被判定为有效的组合张量成员,避免了非连续张量因数据指针位置异常而通过校验导致的潜在错误。

主要改动

  • is_combined_tensor_valid 增加连续性校验: 在校验组合张量有效性时,新增对 tensor.is_contiguous() 的检查。原先仅判断张量数据指针是否落在组合张量的地址范围内,现在同时要求张量必须是内存连续的,否则返回 False
  • npu_combine_tensors 输入连续性检查: 在组合张量的输入校验阶段,同样增加了对输入张量是否连续的判断,非连续张量将直接抛出 RuntimeError,与有效性校验函数保持一致的连续性约束。
likedislike
atomgit-bot
atomgit-bot
6月24日 评论:

代码审查

✅ 未发现问题

likedislike
梁松伟
梁松伟成员
6月24日 评论:

/approve

likedislike
ascend-robotascend-robot成员
6月24日 添加了label:approved
htchu成员
6月25日 评论:

/approve

likedislike
ascend-robotascend-robot成员
6月25日 添加了label:lgtm
ascend-robotascend-robot成员
6月25日 合入了pull request
ascend-robot
ascend-robot成员
6月25日 评论:
流水线 pytorch_gitcode_PR_multiVersion#11259 [ commitID:b974ea14 ] 已完成
likedislike