已合并
solve the problem of over copy #8308
wym_666创建于 8月5日
solve the problem of over copy #8308
已合并
wym_666创建于 8月5日
wym_666成员
8月5日

描述

修复了fake_quant_affine_cachemask对齐CopyOut越过calcLength写穿通道边界

关联的Issue

Issue #4520

测试

400条atk用例测试通过,issue中的脚本符合预期
image.png

文档更新

不涉及

类型标签

AI/Agent生成声明

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 wym_666 的贡献)
Wwym_666成员
8月5日 创建了 pull request,commit 0322fdbc
Wwym_666成员
8月5日 关联了issue:[Bug] fake_quant_affine_cachemask 对齐 CopyOut 越过 calcLength 写穿通道边界
atomgit-bot
atomgit-bot
8月5日 评论:

变更摘要

本次 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 的处理。

likedislike
不准确?
atomgit-bot
atomgit-bot
8月5日 评论:

代码审查

✅ 未发现问题

likedislike
不准确?
CANN-robotCANN-robot成员
8月5日 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
8月5日 评论:

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 /approve or /lgtm
  • Commenting /approve implies 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. 👍

likedislike
CANN-robotCANN-robot成员
8月5日 将zengjuan,sxb154714,chenfeng61,chaotang233,crystalhu,yangyang016,fanqirui,su-yueming,zhajianqing123,chenqi317,LinPX,wang-xing001,liubo75,tangweiwei2,wangzitao_leo,xubinglin,liujie12345678,pingchuantang,Chen_HaoWen,liuyang_806设为评审人
CANN-robotCANN-robot成员
8月5日 将sxb154714,chenfeng61,su-yueming,zhajianqing123,LinPX,wang-xing001,wangzitao_leo,xubinglin,liujie12345678,pingchuantang,Chen_HaoWen,liuyang_806设为审查人
Wwym_666成员
8月5日 修改了pull request 的描述
wym_666成员
8月5日 评论:

compile

likedislike
Wwym_666成员
8月5日 预合并成功(commit_id: 28623c346f0125a7f6e8834bd8a7a386d09b4074)
CANN-robotCANN-robot成员
8月5日 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
8月5日 评论:

流水线任务触发成功
任务链接 [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执行结束

likedislike
CANN-robot
CANN-robot成员
8月5日 评论:

流水线任务触发成功
任务链接 [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 >>>>>
likedislike
CANN-robotCANN-robot成员
8月5日 添加了label:api-check-pass
此处折叠了7条事件消息 查看更多
CANN-robotCANN-robot成员
8月6日 添加了label:cann-cla/yes
wym_666成员
8月6日 评论:

compile /codecheck_precommit

likedislike
Wwym_666成员
8月6日 预合并成功(commit_id: 15bc8591eea320469207f5edf2ef7593271f2b7a)
CANN-robotCANN-robot成员
8月6日 删除了label:ci-pipeline-failedapi-check-pass
CANN-robotCANN-robot成员
8月6日 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
8月6日 评论:

流水线任务触发成功
任务链接 [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执行结束

likedislike
CANN-robot
CANN-robot成员
8月6日 评论:

流水线任务触发成功
任务链接 [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执行结束

likedislike
CANN-robotCANN-robot成员
8月6日 添加了label:api-check-pass
CANN-robotCANN-robot成员
8月6日 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
8月6日 添加了label:ci-pipeline-passed
FelixTang7成员
8月7日 评论:

/lgtm
/approve

likedislike
CANN-robot
CANN-robot成员
8月7日 评论:

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

likedislike
CANN-robot
CANN-robot成员
8月7日 评论:

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

likedislike
chenqi317成员
8月7日 评论:

/lgtm
/approve

likedislike
CANN-robot
CANN-robot成员
8月7日 评论:

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

likedislike
CANN-robot
CANN-robot成员
8月7日 评论:

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

likedislike
chenfeng
chenfeng成员
8月7日 评论:

/lgtm
/approve

likedislike
CANN-robot
CANN-robot成员
8月7日 评论:

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

likedislike
CANN-robotCANN-robot成员
8月7日 添加了label:lgtmapproved
CANN-robotCANN-robot成员
8月7日 关闭了关联的issue
CANN-robotCANN-robot成员
8月7日 合入了pull request