已合并
修复GatherElementsV2非尾轴场景同步错误 #2828
huang-wei-chen创建于 3月17日
修复GatherElementsV2非尾轴场景同步错误 #2828
已合并
huang-wei-chen创建于 3月17日
huang-wei-chen成员
3月17日

描述

在GatherProcess增加MTE3到Vector的同步,确保多轮计算数据正确

关联的Issue

关联Issue #1542

测试

算子泛化1890个用例通过
典型case复现脚本,修改后输出为True

import torch, torch_npu
x = torch.randn(8192, 128, dtype=torch.float32)
index = torch.randint(0, 8192, size=(8192, 8,)).to(torch.int32)
out_npu = torch.gather(x.npu(), 0, index.npu())
out_cpu = torch.gather(x, 0, index.to(torch.int64))
print(f"结果是否一致:{torch.equal(out_cpu, out_npu.cpu())}")

文档更新

NA

类型标签

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 huang-wei-chen 的贡献)
Hhuang-wei-chen成员
3月17日 创建了 pull request,commit 0fd39bdf
CANN-robot
CANN-robot成员
3月17日 评论:

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
index chenqi317, FelixTang7 (2/2) chenqi317 (1/1)

💡 Tip:

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

CLA Signature Pass

huang-wei-chen, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
CANN-robotCANN-robot成员
3月17日 添加了label:cann-cla/yes
CANN-robotCANN-robot成员
3月17日 将FelixTang7,crystalhu,fanqirui,zhou-qilong,chenqi317,liubo75,tangweiwei2,wangyongguang,zhang-wu设为评审人
CANN-robotCANN-robot成员
3月17日 将FelixTang7,crystalhu,zhou-qilong,chenqi317,liubo75,tangweiwei2,wangyongguang,zhang-wu设为审查人
huang-wei-chen成员
3月17日 评论:

compile

likedislike
CANN-robot
CANN-robot成员
3月17日 评论:

问题/功能描述

本次PR为GatherElementsV2算子内核添加了MTE3到V引擎的硬件同步机制。主要解决了在数据转置和聚集操作过程中,由于MTE3(内存传输引擎)与V(向量计算单元)之间的执行顺序依赖可能导致的数据不一致问题。通过引入同步,确保V引擎在读取工作空间数据前,MTE3已完成数据写入,从而保证计算结果的正确性。

修改方案描述

修改方案分为两部分:首先,在公共基类中新增了一个通用的内联同步函数 MTE3ToVSync,该函数通过调用现有的硬件事件API(SetFlagWaitFlag)来实现MTE3到V引擎的同步等待。其次,在具体的转置实现中,于聚集操作完成之后、将结果写入工作空间之前,插入对此同步函数的调用,从而确保后续从工作空间读取的数据是最新且完整的,消除了潜在的读写冲突风险。

likedislike
CANN-robot
CANN-robot成员
3月17日 评论:

🔵 source code change are detected, tasks labels is removed in this pull request!

likedislike
CANN-robotCANN-robot成员
3月17日 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
3月17日 评论:

流水线任务触发成功
任务链接 [df093c1725d648efb1d1daffee98888a][流水线指导]

任务名称状态日志下载链接
解析CI分支 ✅ SUCCESS
codecheck ✅ SUCCESS >>>>>
anti_virus ✅ SUCCESS >>>>>
Check_Pr ✅ SUCCESS >>>>>
Compile_Ascend_X86_ubuntu24 ❌ FAILED >>>>>
Compile_Ascend_X86_mobile_station ❌ FAILED >>>>>
Compile_Ascend_ARM ❌ FAILED >>>>>
Compile_Ascend_single ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_experimental ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_950 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_950 ✅ SUCCESS >>>>> >>>>>
API_Check ❌ FAILED >>>>>
Pre_Compile ✅ SUCCESS
pre_comment ✅ SUCCESS >>>>>
Compile_Ascend_X86 ❌ FAILED >>>>>
Compile_Ascend_X86_mobile_station_ubuntu24 ❌ FAILED >>>>>
Compile_Ascend_X86_950_ubuntu24 ✅ SUCCESS >>>>>
StaticCheck_codespell_check ✅ SUCCESS
StaticCheck_link_validity_check ✅ SUCCESS
StaticCheck_resource_existence_check ✅ SUCCESS
StaticCheck_tag_closed_check ✅ SUCCESS
StaticCheck_markdownlint ✅ SUCCESS
Compile_Ascend_ARM_ubuntu24 ❌ FAILED >>>>>
Compile_Ascend_single_ubuntu24 ✅ SUCCESS >>>>>
Compile_Ascend_experimental_ubuntu24 ✅ SUCCESS >>>>>
Compile_Ascend_ARM_950_ubuntu24 ✅ SUCCESS >>>>>
UT_Test_ophost ⚪ ABORTED
UT_Test_opapi ⚪ ABORTED
UT_Test_kernel ⚪ ABORTED
UT_Test_opgraph ⚪ ABORTED
Smoke_A900_npupool ⚪ ABORTED

[2026-03-17 19:16:54]    CI执行失败

likedislike
CANN-robotCANN-robot成员
3月17日 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
3月17日 添加了label:ci-pipeline-failed
Hhuang-wei-chen成员
3月17日 关联了issue:[Bug-Report|缺陷反馈]: GatherElementsV2非尾轴场景部分用例精度失败
Hhuang-wei-chen成员
3月17日 修改了pull request 的描述
huang-wei-chen成员
3月17日 评论:

compile

likedislike
CANN-robotCANN-robot成员
3月17日 删除了label:ci-pipeline-failed
CANN-robotCANN-robot成员
3月17日 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
3月17日 评论:

流水线任务触发成功
任务链接 [a6bc3a20e5364ac693bad5182b86d468][流水线指导]

任务名称状态日志下载链接
解析CI分支 ✅ SUCCESS
codecheck ✅ SUCCESS >>>>>
anti_virus ✅ SUCCESS >>>>>
Check_Pr ✅ SUCCESS >>>>>
Compile_Ascend_X86_ubuntu24 ❌ FAILED >>>>>
Compile_Ascend_X86_mobile_station ❌ FAILED >>>>>
Compile_Ascend_ARM ❌ FAILED >>>>>
Compile_Ascend_single ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_experimental ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_950 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_950 ✅ SUCCESS >>>>> >>>>>
API_Check ❌ FAILED >>>>>
Pre_Compile ✅ SUCCESS
pre_comment ✅ SUCCESS >>>>>
Compile_Ascend_X86 ❌ FAILED >>>>>
Compile_Ascend_X86_mobile_station_ubuntu24 ❌ FAILED >>>>>
Compile_Ascend_X86_950_ubuntu24 ✅ SUCCESS >>>>>
StaticCheck_codespell_check ✅ SUCCESS
StaticCheck_link_validity_check ✅ SUCCESS
StaticCheck_resource_existence_check ✅ SUCCESS
StaticCheck_tag_closed_check ✅ SUCCESS
StaticCheck_markdownlint ✅ SUCCESS
Compile_Ascend_ARM_ubuntu24 ❌ FAILED >>>>>
Compile_Ascend_single_ubuntu24 ✅ SUCCESS >>>>>
Compile_Ascend_experimental_ubuntu24 ✅ SUCCESS >>>>>
Compile_Ascend_ARM_950_ubuntu24 ✅ SUCCESS >>>>>
UT_Test_ophost ⚪ ABORTED
UT_Test_opapi ⚪ ABORTED
UT_Test_kernel ⚪ ABORTED
UT_Test_opgraph ⚪ ABORTED
Smoke_A900_npupool ⚪ ABORTED

[2026-03-17 19:33:36]    CI执行失败

likedislike
CANN-robotCANN-robot成员
3月17日 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
3月17日 添加了label:ci-pipeline-failed
huang-wei-chen成员
3月18日 评论:

compile

likedislike
CANN-robotCANN-robot成员
3月18日 删除了label:ci-pipeline-failed
CANN-robotCANN-robot成员
3月18日 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
3月18日 评论:

流水线任务触发成功
任务链接 [50a24f0f619543d8ace94b3238ae0b71][流水线指导]

任务名称状态日志下载链接
解析CI分支 ✅ SUCCESS
codecheck ✅ SUCCESS >>>>>
anti_virus ✅ SUCCESS >>>>>
Check_Pr ✅ SUCCESS >>>>>
Compile_Ascend_X86_ubuntu24 ✅ SUCCESS >>>>>
Compile_Ascend_X86_mobile_station ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_single ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_experimental ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_950 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_950 ✅ SUCCESS >>>>> >>>>>
API_Check ✅ SUCCESS >>>>>
Pre_Compile ✅ SUCCESS
pre_comment ✅ SUCCESS >>>>>
Compile_Ascend_X86 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_mobile_station_ubuntu24 ✅ SUCCESS >>>>>
Compile_Ascend_X86_950_ubuntu24 ✅ SUCCESS >>>>>
StaticCheck_codespell_check ✅ SUCCESS
StaticCheck_link_validity_check ✅ SUCCESS
StaticCheck_resource_existence_check ✅ SUCCESS
StaticCheck_tag_closed_check ✅ SUCCESS
StaticCheck_markdownlint ✅ SUCCESS
Compile_Ascend_ARM_ubuntu24 ✅ SUCCESS >>>>>
Compile_Ascend_single_ubuntu24 ✅ SUCCESS >>>>>
Compile_Ascend_experimental_ubuntu24 ✅ SUCCESS >>>>>
Compile_Ascend_ARM_950_ubuntu24 ✅ SUCCESS >>>>>
UT_Test_ophost ✅ SUCCESS
UT_Test_opapi ✅ SUCCESS
UT_Test_kernel ✅ SUCCESS
UT_Test_opgraph ✅ SUCCESS
Smoke_A900_npupool ✅ SUCCESS >>>>>

[2026-03-18 09:55:43]    CI执行结束

likedislike
CANN-robotCANN-robot成员
3月18日 添加了label:api-check-pass
CANN-robotCANN-robot成员
3月18日 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
3月18日 添加了label:ci-pipeline-passed
Hhuang-wei-chen成员
3月18日 修改了pull request 的描述
Hhuang-wei-chen成员
3月18日 修改了pull request 的描述
Hhuang-wei-chen成员
3月18日 修改标题为 “修复GatherElementsV2非尾轴场景同步错误”,原标题为“修复GatherElementsV2同步错误”
FelixTang7成员
3月18日 评论:

/lgtm

likedislike
chenqi317成员
3月18日 评论:

/lgtm
/approve

likedislike
CANN-robotCANN-robot成员
3月18日 添加了label:lgtmapproved
CANN-robot
CANN-robot成员
3月18日 评论:

Review Guide

This pull-request passes review.
Committers who wrote a comment of /approve are: chenqi317.
Reviewers who wrote a comment of /lgtm are: FelixTang7, chenqi317.

likedislike
CANN-robotCANN-robot成员
3月18日 合入了pull request