Pull Request已成功合入, 合并人@CANN-robot
(感谢 wym_666 的贡献)变更摘要
本次 PR 修复了 fake_quant_affine_cachemask 算子中 CopyOut 越过 calcLength 边界写入通道的越界拷贝问题。核心改动在于重新设计 tile 分块计算逻辑:tileNum 改为向上取整,移除不可靠的 lastTileLength 成员变量,lastActulTileLength 改用基于 tileNum 直接推算的方式,并在 fp16/fp32 两个后端子类中统一改为始终执行最后一个 tile 的处理(不再依赖条件分支),从而确保拷贝长度严格受 calcLength 约束,避免写穿通道边界。
主要改动
-
fake_quant_affine_cachemask_base.h— tile 分块计算逻辑重构:tileNum计算从整除totalLengthAligned / tileLength改为向上取整(totalLengthAligned + tileLength - 1) / tileLength;移除成员变量lastTileLength;lastActulTileLength从calcLength % tileLength改为calcLength - (tileNum - 1) * tileLength,确保最后一个 tile 的实际长度由实际剩余数据量精确确定。 -
fake_quant_affine_cachemask_fp16.h— 消除 lastTileLength 条件分支并保障最后一个 tile 始终执行:主循环从j < this->tileNum改为j < this->tileNum - 1(仅处理前 N-1 个完整 tile);移除if (this->lastTileLength > 0)条件判断,最后一个 tile 的处理变为无条件执行,且 CopyIn/CopyOut 均使用lastActulTileLength作为实际拷贝长度。 -
fake_quant_affine_cachemask_fp32.h— 与 fp16 保持一致的越界修复:应用与fake_quant_affine_cachemask_fp16.h完全相同的修改模式,确保 fp32 路径同样不会因lastTileLength为 0 而跳过最后一个不完整 tile 的处理。


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 |
|---|---|---|
| quant | ✅ 陈风, 陈琦 (2/2) | ✅ 陈风 (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
wym_666, thanks for your pull request. All authors of the commits have signed the CLA. 👍


流水线任务触发成功
任务链接 [5f13814588644da7b322e3546afe945f][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| 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 | >>>>> | >>>>> |
| Compile_Pre | ✅ SUCCESS | >>>>> | |
| pre_comment | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_mobile_station_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_950_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_single_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_experimental_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_950_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_910b | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_910c | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_950 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_classify | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_mobile_station_9030_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| UT_Test_ophost | ✅ SUCCESS | ||
| UT_Test_opapi | ✅ SUCCESS | ||
| UT_Test_kernel | ✅ SUCCESS | ||
| UT_Test_opgraph | ✅ SUCCESS | ||
| PreSmoke_A900 | ✅ SUCCESS | >>>>> | |
| API_Check | ✅ SUCCESS | >>>>> | |
| PreSmoke_ATK_Test_A2 | ✅ SUCCESS | >>>>> | |
| UT_Test_harmony-infer-chs-nn | ✅ SUCCESS | ||
| UT_Test_harmony-infer-chs-nn-1 | ✅ SUCCESS | ||
| UT_Test_harmony-infer-cpro-nn | ✅ SUCCESS | ||
| UT_Test_report_lcov | ✅ SUCCESS | >>>>> |
[2026-08-05 17:29:59] CI执行结束


流水线任务触发成功
任务链接 [bd17603794f94b2993c1325a73d2226b][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| antipoison | ✅ SUCCESS | >>>>> | |
| codecheck_checkpr | ✅ SUCCESS | ||
| StaticCheck_codespell | ✅ SUCCESS | ||
| StaticCheck_link_validity | ✅ SUCCESS | ||
| StaticCheck_resource_existence | ✅ SUCCESS | ||
| StaticCheck_tag_closed | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ✅ SUCCESS | ||
| codecheck_precommit | ❌ FAILED | >>>>> | >>>>> |
| SCA | ✅ SUCCESS | >>>>> |


流水线任务触发成功
任务链接 [8e1057208bd4496eb461a175a50b7764][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| 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 | >>>>> | >>>>> |
| Compile_Pre | ✅ SUCCESS | >>>>> | |
| pre_comment | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_mobile_station_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_950_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_single_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_experimental_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_950_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_910b | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_910c | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_950 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_classify | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_mobile_station_9030_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| UT_Test_ophost | ✅ SUCCESS | ||
| UT_Test_opapi | ✅ SUCCESS | ||
| UT_Test_kernel | ✅ SUCCESS | ||
| UT_Test_opgraph | ✅ SUCCESS | ||
| PreSmoke_A900 | ✅ SUCCESS | >>>>> | |
| API_Check | ✅ SUCCESS | >>>>> | |
| PreSmoke_ATK_Test_A2 | ✅ SUCCESS | >>>>> | |
| UT_Test_harmony-infer-chs-nn | ✅ SUCCESS | ||
| UT_Test_harmony-infer-chs-nn-1 | ✅ SUCCESS | ||
| UT_Test_harmony-infer-cpro-nn | ✅ SUCCESS | ||
| UT_Test_report_lcov | ✅ SUCCESS | >>>>> |
[2026-08-06 10:44:00] CI执行结束


流水线任务触发成功
任务链接 [fb9822d5a1484264a2f0bc7f90047930][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| antipoison | ✅ SUCCESS | >>>>> | |
| codecheck_checkpr | ✅ SUCCESS | ||
| StaticCheck_codespell | ✅ SUCCESS | ||
| StaticCheck_link_validity | ✅ SUCCESS | ||
| StaticCheck_resource_existence | ✅ SUCCESS | ||
| StaticCheck_tag_closed | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ✅ SUCCESS | ||
| codecheck_precommit | ✅ SUCCESS | >>>>> | |
| SCA | ✅ SUCCESS | >>>>> |
[2026-08-06 10:25:48] CI执行结束


/lgtm
/approve


The following users do not have permission to comment /lgtm or /approve on any module in this PR:
唐燕峰


The following users do not have permission to comment /lgtm or /approve on any module in this PR:
唐燕峰


The following users do not have permission to comment /lgtm or /approve on any module in this PR:
唐燕峰


The following users do not have permission to comment /lgtm or /approve on any module in this PR:
唐燕峰


/lgtm
/approve


The following users do not have permission to comment /lgtm or /approve on any module in this PR:
唐燕峰


描述
修复了fake_quant_affine_cachemask对齐CopyOut越过calcLength写穿通道边界
关联的Issue
Issue #4520
测试
400条atk用例测试通过,issue中的脚本符合预期

文档更新
不涉及
类型标签
AI/Agent生成声明