已合并
fix(add_layer_norm_quant): 修复static量化空Tensor场景 #9903
rk创建于 9月5日
fix(add_layer_norm_quant): 修复static量化空Tensor场景 #9903
已合并
Pull Request已成功合入, 合并人@CANN-robot
(感谢 rk 的贡献)9月5日 添加了label:cann-cla/yes
CANN-robot
9月5日 评论:
9月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.
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 |
|---|---|---|
| norm | ✅ 钱泽洪, 陈昊文 (2/2) | ✅ 陈昊文, 钱泽洪 (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
wangpengbo26, thanks for your pull request. All authors of the commits have signed the CLA. 👍


9月5日 将zengjuan,chaotang233,kevin_huang1234,crystalhu,yangyang016,fanqirui,wangrui_,renruhai,su-yueming,zhajianqing123,chenqi317,wang-xing001,liubo75,tangweiwei2,chenxingyu18,liujie12345678,pingchuantang,Chen_HaoWen,qianzehong设为评审人
9月5日 将zengjuan,chaotang233,kevin_huang1234,crystalhu,yangyang016,fanqirui,wangrui_,renruhai,su-yueming,zhajianqing123,chenqi317,wang-xing001,liubo75,tangweiwei2,chenxingyu18,liujie12345678,pingchuantang,Chen_HaoWen,qianzehong设为评审人
9月5日 将kevin_huang1234,wangrui_,renruhai,su-yueming,zhajianqing123,wang-xing001,chenxingyu18,liujie12345678,pingchuantang,Chen_HaoWen,qianzehong设为审查人
9月5日 将kevin_huang1234,wangrui_,renruhai,su-yueming,zhajianqing123,wang-xing001,chenxingyu18,liujie12345678,pingchuantang,Chen_HaoWen,qianzehong设为审查人
yuning_chen
9月5日 评论:
9月5日 评论:
您好,pr合入已准备就绪,请尽快联系committer进行检视,谢谢!


CANN-robot
9月7日 评论:
9月7日 评论:
| 🚀 CI 流水线已启动 |
|---|
| 📋 执行详情: 点击查看流水线 |


9月7日 添加了label:ci-pipeline-running
9月7日 删除了label:ci-pipeline-running
9月7日 添加了label:ci-pipeline-passed
yuning_chen
9月7日 评论:
9月7日 评论:
您好,pr合入已准备就绪,请尽快联系committer进行检视,谢谢!


此处折叠了6条事件消息 查看更多
9月8日 删除了label:ci-pipeline-passed
CANN-robot
9月8日 评论:
9月8日 评论:
9月8日 添加了label:cann-cla/yes
yuning_chen
9月8日 评论:
9月8日 评论:
您好,pr合入已准备就绪,请尽快联系committer进行检视,谢谢!


此处折叠了5条事件消息 查看更多
CANN-robot
9月10日 评论:
9月10日 评论:
| 🚀 CI 流水线已启动 |
|---|
| 📋 执行详情: 点击查看流水线 |


9月10日 添加了label:ci-pipeline-running
9月10日 删除了label:ci-pipeline-running
9月10日 添加了label:ci-pipeline-passed
yuning_chen
9月10日 评论:
9月10日 评论:
您好,pr合入已准备就绪,请尽快联系committer进行检视,谢谢!


Chen_HaoWen
9月11日 评论:
9月11日 评论:
/approve


9月11日 添加了label:approved
qianzehong
9月11日 评论:
9月11日 评论:
/approve
/lgtm


9月11日 添加了label:lgtm
9月11日 关闭了关联的issue
9月11日 合入了pull request
描述
修复
aclnnAddLayerNormQuant算子在 static 量化场景下空 Tensor 处理不完整的问题。static 量化场景下
outScales输出无实际意义(static 量化使用 input scales,不依赖 output scales)。原代码在 Regbase(Ascend950)架构上的空 Tensor 早返回判断条件为outScales1Out->IsEmpty():当 x1 为空但outScales1Out不为空时,该条件不成立,算子未走早返回,继续执行导致问题。改动原因
aclnnAddLayerNormQuantGetWorkspaceSize中 Regbase 架构的空 Tensor 早返回判断条件outScales1Out->IsEmpty()不适用于 static 量化场景:static 量化下outScales无实际意义,其是否为空不能作为空 Tensor 的判据。当 x1 为空但outScales1Out非空时,未走早返回路径,算子执行异常。改动方法
IsDynamicQuant(quantMode)区分 dynamic/static 量化(已有函数)。regbaseEmptySkip判据:dynamic 量化看outScales1Out->IsEmpty(),static 量化看x1->IsEmpty(),将 Regbase 空 Tensor 早返回条件由outScales1Out->IsEmpty()改为regbaseEmptySkip,正确覆盖 static 量化下 x1 为空tensor的场景。static_outer_axis_empty:x1={0,64}、gamma={64},验证 outer axis 为空时返回ACL_SUCCESS且workspaceSize==0。static_normalized_axis_empty:x1={2,0}、gamma={0},验证归一化轴为空时返回ACL_SUCCESS且workspaceSize==0。涉及文件:
norm/add_layer_norm_quant/op_host/op_api/aclnn_add_layer_norm_quant.cpp(+3 -2)norm/add_layer_norm_quant/tests/ut/op_host/op_api/test_aclnn_add_layer_norm_quant.cpp(+62 -6)关联的Issue
-https://gitcode.com/cann/ops-nn/issues/5639
测试
static_outer_axis_empty(x1={0,64})和static_normalized_axis_empty(x1={2,0}),验证 static 量化场景下空 Tensor 返回ACL_SUCCESS且workspaceSize==0。SocVersion::ASCEND950。文档更新
不涉及
类型标签
AI/Agent生成声明