已合并
【ACLNN】sacle、zeroPoint to contiguous #2714
张喻翔创建于 3月14日
【ACLNN】sacle、zeroPoint to contiguous #2714
已合并
张喻翔创建于 3月14日
张喻翔
张喻翔
3月14日

描述

将输入scale、zeropoint转连续后计算,避免产生非连续报错问题

关联的Issue

关联Issue #1498

测试

单算子custom包功能和精度验证成功。

文档更新

类型标签

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 张喻翔 的贡献)
张喻翔张喻翔
3月14日 创建了 pull request,commit ab91838b
CANN-robot
CANN-robot成员
3月14日 评论:

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
*/*/op_host/op_api/*.h wangyongguang, zhou-qilong (2/2) wangyongguang (1/1)
quant zhou-qilong, wangyongguang, zhajianqing123 (3/2) wangyongguang, zhajianqing123, zhou-qilong (3/1)

💡 Tip:

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

CLA Signature Pass

zhangyuxiang0119, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
CANN-robotCANN-robot成员
3月14日 添加了label:cann-cla/yes
CANN-robotCANN-robot成员
3月14日 将sxb154714,crystalhu,fanqirui,zhou-qilong,zhajianqing123,chenqi317,liubo75,tangweiwei2,wangzitao_leo,liujie12345678,wangyongguang,zhang-wu设为评审人
CANN-robotCANN-robot成员
3月14日 将sxb154714,crystalhu,zhou-qilong,zhajianqing123,chenqi317,liubo75,tangweiwei2,wangzitao_leo,liujie12345678,wangyongguang,zhang-wu设为审查人
CANN-robot
CANN-robot成员
3月14日 评论:

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

likedislike
张喻翔
张喻翔
3月14日 评论:

compile

likedislike
张喻翔张喻翔
3月14日 关联了issue:[Bug-Report|缺陷反馈]: aclnnFakeQuantPerChannelAffineCachemaskGetWorkspaceSize接口内没有将输入tensor转连续
CANN-robotCANN-robot成员
3月14日 添加了label:ci-pipeline-running
张喻翔张喻翔
3月14日 修改了pull request 的描述
CANN-robot
CANN-robot成员
3月14日 评论:

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

任务名称状态日志下载链接
解析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 ⚠️ WARNING >>>>>
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-14 17:23:28]    CI执行结束

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

问题/功能描述

本次PR主要对aclnn_fake_quant_per_channel_affine_cachemaskaclnn_fake_quant_per_tensor_affine_cachemask两个假量化算子进行代码重构。核心目标是消除两个算子实现中重复的输入张量连续性处理和数据类型提升逻辑,以提升代码的可维护性和一致性。

修改方案描述

通过创建公共头文件fake_quant_common.h和实现文件fake_quant_common.cpp,将重复的输入张量ContiguousCast操作封装至新的公共函数GetContiguousInput中。该函数统一处理输入张量的连续内存转换和数据类型提升。重构后,两个算子的主逻辑大幅简化,仅需调用此公共函数即可获得处理后的输入,有效减少了代码冗余。

likedislike
CANN-robot
CANN-robot成员3月14日进行代码检视1
quant/fake_quant_affine_cachemask/op_host/op_api/fake_quant_common.h
@@ -0,0 +33,4 @@
33+ const aclTensor* zeroPoint, aclOpExecutor* executor);
34+}
35+ 
36+#endif
CANN-robot
CANN-robot3月14日评论:
代码结构与可维护性: 文件末尾缺少换行符(No newline at end of file)。虽然这不是功能性问题,但违反了许多代码规范(如POSIX标准),可能导致某些工具(如编译器、版本控制系统)处理时出现问题。
问题类型: 代码结构与可维护性
文件路径: quant/fake_quant_affine_cachemask/op_host/op_api/fake_quant_common.h
行号: 36
问题代码:
#endif
修改建议:
在#endif后添加一个换行符,确保文件以换行符结束。
---
此评论由代码审查工具自动生成
likedislike
CANN-robot
CANN-robot成员3月14日进行代码检视1
quant/fake_quant_affine_cachemask/op_host/op_api/fake_quant_common.h
@@ -0,0 +8,4 @@
8+ * See LICENSE in the root of the software repository for the full text of the License.
9+ */
10+ 
11+/*!
CANN-robot
CANN-robot3月14日评论:
代码结构与可维护性: 文件头注释中的文件名与实际文件名不一致。注释中写的是fake_quant_common.cpp,但实际文件是fake_quant_common.h。这种不一致可能导致开发者混淆,影响代码的可维护性。
问题类型: 代码结构与可维护性
文件路径: quant/fake_quant_affine_cachemask/op_host/op_api/fake_quant_common.h
行号: 11
问题代码:
/*!
 * \file fake_quant_common.cpp
 * \brief
 */
修改建议:
将注释中的文件名更正为fake_quant_common.h,确保文档与实际代码一致。
---
此评论由代码审查工具自动生成
likedislike
CANN-robot
CANN-robot成员3月14日进行代码检视1
quant/fake_quant_affine_cachemask/op_host/op_api/fake_quant_common.h
@@ -0,0 +8,4 @@
8+ * See LICENSE in the root of the software repository for the full text of the License.
9+ */
10+ 
11+/*!
CANN-robot
CANN-robot3月14日评论:
代码文档不一致: 文件头注释中声明的文件名与实际文件名不一致。注释中写的是'fake_quant_common.cpp',但实际文件是头文件'fake_quant_common.h'。这种不一致可能导致开发者在查找或理解代码时产生混淆。
问题类型: 代码文档不一致
文件路径: quant/fake_quant_affine_cachemask/op_host/op_api/fake_quant_common.h
行号: 11
问题代码:
/*!
 * \file fake_quant_common.cpp
 * \brief
 */
修改建议:
将文件头注释中的文件名修改为实际的文件名'fake_quant_common.h',确保文档与实际代码保持一致。
---
此评论由代码审查工具自动生成
likedislike
CANN-robotCANN-robot成员
3月14日 添加了label:api-check-failed
zhajianqing123成员
3月14日 评论:

/lgtm
/approve

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

/lgtm
/approve

likedislike
sunday成员
3月14日 评论:

/lgtm
/approve

likedislike
wangyongguang成员
3月16日 评论:

/lgtm
/approve

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

Review Guide

This pull-request passes review.
Committers who wrote a comment of /approve are: zhajianqing123, zhou-qilong, wangyongguang.
Reviewers who wrote a comment of /lgtm are: zhajianqing123, zhou-qilong, wangyongguang.

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

The MR can not be merged, because of CodeReview discussion not resolved

If you want to solve this problem, you can click here to do it in the FAQs.

likedislike
chenqi317成员
3月16日 评论:

/lgtm
/approve

likedislike
张喻翔张喻翔
3月16日 解决了最后一个问题
CANN-robot
CANN-robot成员
3月16日 评论:

Review Guide

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

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