已合并
激活和量化算子的示例中的输出类型不匹配 #8372
季骏创建于 14 天前
激活和量化算子的示例中的输出类型不匹配 #8372
已合并
季骏创建于 14 天前
季骏
季骏
14 天前

描述

部分激活算子和量化算子的aclnn demo中,存在变量申请的类型和使用的类型不匹配的问题

关联的Issue

#4608

测试

已跑最新demo

文档更新

更新了
activation/ge_glu_grad_v2/docs/aclnnGeGluBackward.md
activation/ge_glu_grad_v2/docs/aclnnGeGluV3Backward.md
quant/dynamic_quant_v2/docs/aclnnDynamicQuantV2.md

类型标签

AI/Agent生成声明

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 季骏 的贡献)
季骏季骏
14 天前 创建了 pull request,commit 5dd8499a
atomgit-bot
atomgit-bot
14 天前 评论:

变更摘要

此 PR 修复了部分激活算子和量化算子 aclnn demo 中输出缓冲区类型与实际算子输出类型不匹配的问题。具体而言,GeGluBackwardGeGluV3Backward 的 demo 错误地使用 float 类型接收 aclFloat16 输出,而 DynamicQuantV2 的 demo 错误地使用 float 类型接收 int8_t 量化输出,导致内存拷贝和打印结果不正确。修复将变量类型、格式化字符串和内存大小计算统一为与算子实际输出一致的类型。

主要改动

  • test_aclnn_ge_glu_backward.cpptest_aclnn_ge_glu_v3_backward.cpp 结果缓冲区类型修正: 将 std::vector<float> resultData 改为 std::vector<aclFloat16> resultData,使缓冲区类型与算子输出的半精度浮点类型一致。
  • 激活算子 demo 打印转换: 在 LOG_PRINT 中将直接打印 resultData[i] 改为 aclFloat16ToFloat(resultData[i]),确保半精度数据被正确转换为浮点数后再格式化输出。
  • test_aclnn_dynamic_quant_v2.cpp 结果缓冲区类型修正: 将 PrintOutResult 函数中的 std::vector<float> resultData 改为 std::vector<int8_t> resultData,匹配量化算子的 int8_t 输出类型。
  • 量化算子 demo 格式化字符串修正: 将 LOG_PRINT 中的 %f 改为 %d,以正确打印 int8_t 整型结果。
  • 量化算子模板函数内存大小计算修正: 在 CreateAclTensor 模板函数中将 sizeof(float) 改为 sizeof(T),使内存分配大小与实际模板类型参数匹配,避免泛型函数中硬编码 float 大小。
likedislike
atomgit-bot
atomgit-bot
14 天前 评论:

代码审查

✅ 未发现问题

likedislike
CANN-robotCANN-robot成员
14 天前 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
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
*/*/docs/acl*.md 陈娇, 陈琦 (2/2) 陈娇 (1/1)
activation 王星, 苏跃明, 陈琦 (3/2) 苏跃明, 王星 (2/1)
quant 王星, 苏跃明, 陈琦 (3/2) 王星, 苏跃明 (2/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)
likedislike
CANN-robot
CANN-robot成员
14 天前 评论:

CLA Signature Pass

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

likedislike
CANN-robotCANN-robot成员
14 天前 将zengjuan,sxb154714,chenfeng61,chaotang233,kevin_huang1234,crystalhu,yangyang016,fanqirui,gitee-duhuiping,renruhai,su-yueming,zhajianqing123,chenqi317,LinPX,wang-xing001,liubo75,tangweiwei2,wangzitao_leo,xubinglin,gitcode-chenjiao,liujie12345678,pingchuantang,Chen_HaoWen,zhouwenfang,wuyao51511,liuyang_806,caiwenwen设为评审人
CANN-robotCANN-robot成员
14 天前 将sxb154714,chenfeng61,kevin_huang1234,gitee-duhuiping,renruhai,su-yueming,zhajianqing123,LinPX,wang-xing001,wangzitao_leo,xubinglin,gitcode-chenjiao,liujie12345678,pingchuantang,Chen_HaoWen,zhouwenfang,wuyao51511,liuyang_806,caiwenwen设为审查人
季骏季骏
14 天前 修改了pull request 的描述
季骏
季骏
14 天前 评论:

compile

likedislike
季骏季骏
14 天前 update merge request[project id: 7665709, iid: 8372, commit_id: 0f8e60ac3a476f078258012c42e5ca75502e6928] virtual merging success
CANN-robotCANN-robot成员
14 天前 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
14 天前 评论:

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

任务名称状态日志下载链接
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 ❌ FAILED >>>>>
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 >>>>> >>>>>
likedislike
CANN-robot
CANN-robot成员
14 天前 评论:

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

任务名称状态日志下载链接
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成员
14 天前 删除了label:ci-pipeline-running
此处折叠了5条事件消息 查看更多
CANN-robotCANN-robot成员
13 天前 添加了label:cann-cla/yes
季骏
季骏
13 天前 评论:

compile

likedislike
季骏季骏
13 天前 update merge request[project id: 7665709, iid: 8372, commit_id: 8752c94be254acef46033361a41774ce6d76ed92] virtual merging success
CANN-robotCANN-robot成员
13 天前 删除了label:ci-pipeline-failed
CANN-robotCANN-robot成员
13 天前 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
13 天前 评论:

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

任务名称状态日志下载链接
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 ⚠️ WARNING >>>>>

[2026-08-07 16:11:01]    CI执行结束

likedislike
CANN-robot
CANN-robot成员
13 天前 评论:

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

任务名称状态日志下载链接
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-07 15:52:36]    CI执行结束

likedislike
CANN-robotCANN-robot成员
13 天前 添加了label:api-check-pass
CANN-robotCANN-robot成员
13 天前 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
13 天前 添加了label:ci-pipeline-passed
chenjiao成员
13 天前 评论:

/approve

likedislike
wang-xing001成员
12 天前 评论:

/lgtm
/approve

likedislike
CANN-robotCANN-robot成员
12 天前 添加了label:approved
su-yueming成员
12 天前 评论:

/lgtm
/approve

likedislike
chenqi317成员
12 天前 评论:

/lgtm
/approve

likedislike
CANN-robotCANN-robot成员
12 天前 添加了label:lgtm
CANN-robotCANN-robot成员
12 天前 关闭了关联的issue
CANN-robotCANN-robot成员
12 天前 合入了pull request