Pull Request已成功合入, 合并人@CANN-robot
(感谢 zhang-wenbo-beat 的贡献)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 | ✅ tangweiwei2, chenqi317 (2/2) | ✅ tangweiwei2, chenqi317 (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
zhang-wenbo-beat, thanks for your pull request. All authors of the commits have signed the CLA. 👍


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


compile


流水线任务触发成功
任务链接 [fc611912a7eb44a09d34206a1d996f86][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| 解析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-19 19:02:31] CI执行结束


问题/功能描述
本次PR系列主要修复了多个AscendC确定性算子(包括InplaceIndexAdd、ScatterAdd、ScatterNd、ScatterNdAdd)在初始化阶段存在的内存访问时序问题。在多核或异步硬件(如MTE3)并行访问场景下,对全局工作内存(GM)的初始化操作可能与其他核或硬件单元的访问产生数据竞争,导致未定义行为,影响计算的确定性和正确性。
修改方案描述
核心修改方案是在各算子的初始化函数中,在对关键全局内存(如updateSumIdxWsGm_、workspaceCoreLogicCoreSumId_)执行InitGlobalMemory操作之前,显式插入对HardEvent::MTE3_V硬件事件的等待操作。具体通过调用GetTPipePtr()->FetchEventID获取事件ID,并执行SetFlag和WaitFlag,强制后续内存初始化操作等待前序相关内存操作(如对updateSumWsGm_的初始化)完成。此方案相当于在内存访问关键路径上增加了硬件级同步屏障,确保了内存初始化的顺序一致性,消除了潜在的竞态条件。此外,部分算子还优化了初始化代码的执行顺序,进一步保证了工作空间在计算开始前已被正确设置。


/approve


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


描述
在连续两次initGlobalMemory接口(初始化值不同)调用之间插入Vector等待MTE3的流水同步,以避免前者未搬运完但ub中的值被后者修改,导致前者初始化不符合预期。
关联的Issue
https://gitcode.com/cann/ops-nn/issues/1559
测试
1、该问题导致的确定性计算用例已验证精度和确定性通过。
2、在初始化某块GM结束后,打印该空间的值,符合预期。
文档更新
类型标签