Pull Request已成功合入, 合并人@CANN-robot
(感谢 王璐瑶 的贡献)变更摘要
该 PR 修复 event sync(事件同步)不准确问题:在 sqHead - 1 位置读取已完成任务 id 时可能读到新下发任务的 id。此修复通过 lastTaskId_ 快照、二次读取 tail 等方式校验读到的任务 id 是否属于新下发任务,并对未初始化任务 id(MAX_UINT16_NUM)增加防护判断。本 PR 将原始修复(#4496)cherry-pick 同步到 9.1.0 分支并适配其代码风格(如 Device_() 访问器),同时更新了相关单元测试。
主要改动
GetFinishedTaskIdBySqHead增加任务 id 有效性校验:在stream.cc中于入口处保存lastTaskId_快照,并在从sqHead - 1位置读取endTaskId后增加三道校验——tail 未变但lastTaskId_已变、tail 变化且新 tail 到达sqHead、或endTaskId比入口时最新任务更新时,均判定可能读到新下发任务并直接返回RT_ERROR_NONE,避免把新任务 id 当作已完成任务。SynchronizeDelayTime增加MAX_UINT16_NUM防护:在TASK_ID_GEQ(executeEndTaskid_.Value(), taskId)判断前增加executeEndTaskid_.Value() != MAX_UINT16_NUM检查,防止任务 id 未初始化时误判执行完成。SynchronizeExecutedTask增加MAX_UINT16_NUM防护:将GetExecuteEndTaskId()结果存入exeEndTaskId,并在IsTaskExcuted判断前增加exeEndTaskId != MAX_UINT16_NUM条件,避免未初始化任务 id 导致的错误同步判定。- 适配单元测试:
rt_utest_david_stream.cc的TestSeparateSendAndRecycle3/4增加stream->SetExecuteEndTaskId(0);rt_utest_david_task_recycle.cc的SyncTaskRecycleBySqHead、SyncTaskRecycleBySqHeadV2、DvppWaitGroupCommonTaskReportLogicCq增加stream->SetLastTaskId(task->id),以匹配新的校验逻辑。


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.
You can self-configure the PR merge rules for this repository. For more details, please refer to Here.
For more, you also can visit HICANN.
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| 9.1.0 | ✅ Andy-lb, 卢煜坤 (2/2) | ✅ Andy-lb (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
wangluyao17, thanks for your pull request. All authors of the commits have signed the CLA. 👍


流水线任务触发成功
任务链接 [0fbb5828e67f406cb7b0d9797756c3db][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| Compile_Ascend_X86 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM | ✅ SUCCESS | >>>>> | >>>>> |
| pre_comment | ✅ SUCCESS | >>>>> | |
| UT_Test_acl | ✅ SUCCESS | >>>>> | |
| UT_Test_rts_v201 | ✅ SUCCESS | >>>>> | |
| UT_Test_rts_c | ✅ SUCCESS | >>>>> | |
| UT_Test_rts_david | ✅ SUCCESS | >>>>> | |
| UT_Test_rts_910b | ✅ SUCCESS | >>>>> | |
| UT_Test_rts_common | ✅ SUCCESS | >>>>> | |
| UT_Test_platform | ✅ SUCCESS | >>>>> | |
| UT_Test_qs | ✅ SUCCESS | >>>>> | |
| UT_Test_aicpusd | ✅ SUCCESS | >>>>> | |
| UT_Test_tsd | ✅ SUCCESS | >>>>> | |
| UT_Test_error_manager | ✅ SUCCESS | >>>>> | |
| UT_Test_slog | ✅ SUCCESS | >>>>> | |
| UT_Test_atrace | ✅ SUCCESS | >>>>> | |
| UT_Test_adump | ✅ SUCCESS | >>>>> | |
| UT_Test_mmpa | ✅ SUCCESS | >>>>> | |
| PreSmoke_A900_npupool | ✅ SUCCESS | >>>>> | |
| UT_Test_msprof | ✅ SUCCESS | >>>>> | |
| UT_Test_rts_report | ✅ SUCCESS | >>>>> | |
| UT_Test_msprof_report | ✅ SUCCESS |
[2026-08-27 16:03:19] CI执行结束


流水线任务触发成功
任务链接 [1d2d1cd926944d33afd35213f07cafc2][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| codecheck | ✅ SUCCESS | >>>>> | |
| SCA | ✅ SUCCESS | >>>>> | |
| antipoison | ✅ SUCCESS | >>>>> | |
| codecheck_Check_Pr | ✅ SUCCESS | ||
| codecheck_style | ✅ SUCCESS | >>>>> | |
| codecheck_precommit | ⚠️ WARNING | >>>>> | >>>>> |
| StaticCheck_codespell_check | ✅ SUCCESS | ||
| StaticCheck_link_validity_check | ✅ SUCCESS | ||
| StaticCheck_resource_existence_check | ✅ SUCCESS | ||
| StaticCheck_tag_closed_check | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ❌ FAILED |


流水线任务触发成功
任务链接 [c93db47cd05a485693b38dab5c0cdb00][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| Compile_Ascend_X86 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM | ✅ SUCCESS | >>>>> | >>>>> |
| pre_comment | ✅ SUCCESS | >>>>> | |
| UT_Test_acl | ✅ SUCCESS | >>>>> | |
| UT_Test_rts_v201 | ✅ SUCCESS | >>>>> | |
| UT_Test_rts_c | ✅ SUCCESS | >>>>> | |
| UT_Test_rts_david | ✅ SUCCESS | >>>>> | |
| UT_Test_rts_910b | ✅ SUCCESS | >>>>> | |
| UT_Test_rts_common | ✅ SUCCESS | >>>>> | |
| UT_Test_platform | ✅ SUCCESS | >>>>> | |
| UT_Test_qs | ✅ SUCCESS | >>>>> | |
| UT_Test_aicpusd | ✅ SUCCESS | >>>>> | |
| UT_Test_tsd | ✅ SUCCESS | >>>>> | |
| UT_Test_error_manager | ✅ SUCCESS | >>>>> | |
| UT_Test_slog | ✅ SUCCESS | >>>>> | |
| UT_Test_atrace | ✅ SUCCESS | >>>>> | |
| UT_Test_adump | ✅ SUCCESS | >>>>> | |
| UT_Test_mmpa | ✅ SUCCESS | >>>>> | |
| PreSmoke_A900_npupool | ✅ SUCCESS | >>>>> | |
| UT_Test_msprof | ✅ SUCCESS | >>>>> | |
| UT_Test_rts_report | ✅ SUCCESS | >>>>> | |
| UT_Test_msprof_report | ✅ SUCCESS |
[2026-08-27 17:50:52] CI执行结束


流水线任务触发成功
任务链接 [b976819e05484ec19336cfcb8382ac5f][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| codecheck | ✅ SUCCESS | >>>>> | |
| SCA | ✅ SUCCESS | >>>>> | |
| antipoison | ✅ SUCCESS | >>>>> | |
| codecheck_Check_Pr | ✅ SUCCESS | ||
| codecheck_style | ✅ SUCCESS | >>>>> | |
| codecheck_precommit | ⚠️ WARNING | >>>>> | >>>>> |
| StaticCheck_codespell_check | ✅ SUCCESS | ||
| StaticCheck_link_validity_check | ✅ SUCCESS | ||
| StaticCheck_resource_existence_check | ✅ SUCCESS | ||
| StaticCheck_tag_closed_check | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ✅ SUCCESS |
[2026-08-27 17:36:12] CI执行结束


/lgtm


描述
修改eventsync不准确问题,sqhead - 1 位置的taskid 读到了新下发的任务id。
本次为将该修复同步到9.1.0分支(原始PR: #4496)。
变更类型
请选择本次引入的变更类型:
关联的Issue
如何测试
描述测试此变更的步骤和前提条件:
核对清单
其他信息
该PR将 #4496 的修改cherry-pick同步到9.1.0分支,并适配了9.1.0分支的代码风格(如Device_()访问器)。