已关闭
[Bug-Report|缺陷反馈]: 责任田部分算子代码违反编程规范 #5808
高逸凡创建于  26 天前关闭于  23 天前
高逸凡
26 天前 创建

Thanks for sending an issue! Please fill in the following template to help quickly solve your problem.

Describe the current behavior / 问题描述 (Mandatory / 必填)

swiglu_group_quant、init_embedding_hash_table存在部分代码片段违反C++语言规范

Environment / 环境信息 (Mandatory / 必填)

任意

Steps to reproduce the issue / 重现步骤 (Mandatory / 必填)

静态检查

Describe the expected behavior / 预期结果 (Mandatory / 必填)

无违反语言规范

违反规范

序号 规范 缺陷描述 文件 代码片段 代码行
1 G.EXP.09-CPP 变量被使用时才声明并初始化 Declare and initialize variables only when they are used. ops/ops-nn/activation/swiglu_group_quant/op_host/arch35/swiglu_group_quant_tiling.cpp ge::graphStatus status; 690
2 G.CNS.02-CPP 不要使用难以理解的字面常量 Do not use magic numbers.The number is 2 ops/ops-nn/activation/swiglu_group_quant/op_host/arch35/swiglu_group_quant_tiling.cpp splitD_ = d_ / 2; 463
3 G.CNS.02-CPP 不要使用难以理解的字面常量 Do not use magic numbers.The number is 12 ops/ops-nn/activation/swiglu_group_quant/op_kernel/arch35/swiglu_mx_quant_perf.h TBufPool?tBufPool; 213
4 G.CNS.02-CPP 不要使用难以理解的字面常量 Do not use magic numbers.The number is 12 ops/ops-nn/activation/swiglu_group_quant/op_kernel/arch35/swiglu_group_quant_perf.h TBufPool?tBufPool; 188
5 G.EXP.36-CPP 控制表达式的结果应是布尔值 The controlling expression (?😃 must be a Boolean value or a Pointer rather than 'int64_t' ops/ops-nn/activation/swiglu_group_quant/op_host/arch35/swiglu_group_quant_tiling.cpp tilingKey_ = outputOrigin_ ? BLOCK_QUANT_YORIGIN_TILING_KEY : BLOCK_QUANT_TILING_KEY; 710
6 G.CNS.04-CPP 对于指针和引用类型的参数,如果不需要修改其引用的对象,应使用const修饰 pointer parameter context can be pointer to const ops/ops-nn/activation/swiglu_group_quant/op_host/arch35/swiglu_group_quant_tiling.cpp ge::graphStatus SwigluGroupQuantTiling::GetPlatformInfoCommon(gert::TilingContext* context, uint64_t& coreNum, 90
7 G.EXP.36-CPP 控制表达式的结果应是布尔值 The controlling expression (if) must be a Boolean value or a Pointer rather than 'int64_t' ops/ops-nn/activation/swiglu_group_quant/op_host/arch35/swiglu_group_quant_tiling.cpp if (outputOrigin_) { 379
8 G.EXP.27-CPP 使用恰当的基本类型作为操作符的操作数 The condition expression type of operator '?:' is improperly 'int64_t' (aka 'long') ops/ops-nn/activation/swiglu_group_quant/op_host/arch35/swiglu_group_quant_tiling.cpp tilingKey_ = outputOrigin_ ? BLOCK_QUANT_YORIGIN_TILING_KEY : BLOCK_QUANT_TILING_KEY; 710
9 G.EXP.36-CPP 控制表达式的结果应是布尔值 The controlling expression (?😃 must be a Boolean value or a Pointer rather than 'const int64_t' ops/ops-nn/activation/swiglu_group_quant/op_host/arch35/swiglu_group_quant_tiling.cpp return outputOrigin_ ? totalSize + yOriginSize : totalSize; 545
10 G.EXP.27-CPP 使用恰当的基本类型作为操作符的操作数 The condition expression type of operator '?:' is improperly 'const int64_t' (aka 'const long') ops/ops-nn/activation/swiglu_group_quant/op_host/arch35/swiglu_group_quant_tiling.cpp return outputOrigin_ ? totalSize + yOriginSize : totalSize; 545
11 G.EXP.15-CPP 避免使用reinterpret_cast do not use reinterpret_cast ops/ops-nn/hash/init_embedding_hash_table/op_host/arch35/init_embedding_hash_table_tiling_arch35.cpp const InitEmbeddingHashTableCompileInfo* compileInfo = reinterpret_cast( 50
12 G.CNS.04-CPP 对于指针和引用类型的参数,如果不需要修改其引用的对象,应使用const修饰 pointer parameter context can be pointer to const ops/ops-nn/activation/swiglu_group_quant/op_host/arch35/swiglu_group_quant_tiling_register.cpp ge::graphStatus TilingPrepareForSwigluGroupQuant(gert::TilingParseContext* context) 32
13 G.EXP.27-CPP 使用恰当的基本类型作为操作符的操作数 The Left operand type of operator '!=' is improperly 'const float' ops/ops-nn/activation/swiglu_group_quant/op_host/arch35/swiglu_group_quant_tiling.cpp if (*clampLimitAttr != DEFAULT_CLAMP_LIMIT) { 131
14 G.EXP.27-CPP 使用恰当的基本类型作为操作符的操作数 The Right operand type of operator '!=' is improperly 'const float' ops/ops-nn/activation/swiglu_group_quant/op_host/arch35/swiglu_group_quant_tiling.cpp if (*clampLimitAttr != DEFAULT_CLAMP_LIMIT) { 131
15 G.EXP.36-CPP 控制表达式的结果应是布尔值 The controlling expression (if) must be a Boolean value or a Pointer rather than 'int64_t' ops/ops-nn/activation/swiglu_group_quant/op_host/arch35/swiglu_group_quant_tiling.cpp } else if (outputOrigin_) { 717
16 G.CNS.04-CPP 对于指针和引用类型的参数,如果不需要修改其引用的对象,应使用const修饰 pointer parameter context can be pointer to const ops/ops-nn/activation/swiglu_group_quant/op_host/arch35/swiglu_group_quant_tiling.h static ge::graphStatus GetPlatformInfoCommon(gert::TilingContext* context, uint64_t& coreNum, uint64_t& ubSize); 28
17 G.CNS.02 不要使用难以理解的字面量 Do not use magic numbers.The number is 12 ops/ops-nn/activation/swiglu_group_quant/op_kernel/arch35/swiglu_mx_quant_perf.h TBufPool?tBufPool; 213
18 G.CNS.02 不要使用难以理解的字面量 Do not use magic numbers.The number is 12 ops/ops-nn/activation/swiglu_group_quant/op_kernel/arch35/swiglu_group_quant_perf.h TBufPool?tBufPool; 188

超大头文件/超大函数

文件路径 行号 描述
ops/ops-nn/activation/swiglu_group_quant/op_kernel/arch35/swiglu_group_quant_base.h 0 the nbnc line of the header file is 1057, it is over 500
ops/ops-nn/norm/group_norm_silu/op_host/group_norm_silu_def.cpp 20 the nbnc line of the method {GroupNormSilu()} is 130, it is over 50
ops/ops-nn/activation/swiglu_group_quant/op_kernel/arch35/swiglu_mxfp4_quant_perf.h 76 the nbnc line of the method {Process()} is 93, it is over 50
ops/ops-nn/activation/swiglu_group_quant/op_kernel/arch35/swiglu_group_quant_base.h 835 the nbnc line of the method {VFProcessSwigluMxFp8InvScaleVf()} is 122, it is over 50
ops/ops-nn/activation/swiglu_group_quant/op_kernel/arch35/swiglu_group_quant_base.h 498 the nbnc line of the method {VFProcessSwigluGroupQuantVf()} is 124, it is over 50
ops/ops-nn/activation/swiglu_group_quant/op_host/arch35/swiglu_group_quant_tiling.cpp 267 the nbnc line of the method {SwigluGroupQuantTiling::CheckOutputInfo()} is 126, it is over 50
ops/ops-nn/activation/swiglu_group_quant/op_kernel/arch35/swiglu_group_quant_perf.h 72 the nbnc line of the method {Process()} is 86, it is over 50
ops/ops-nn/activation/swiglu_group_quant/op_host/swiglu_group_quant_def.cpp 25 the nbnc line of the method {SwigluGroupQuant()} is 97, it is over 50
ops/ops-nn/activation/swiglu_group_quant/op_kernel/arch35/swiglu_mx_quant_perf.h 81 the nbnc line of the method {Process()} is 98, it is over 50
ops/ops-nn/activation/swiglu_group_quant/op_host/arch35/swiglu_group_quant_tiling.cpp 406 the nbnc line of the method {SwigluGroupQuantTiling::GetShapeAttrsInfoInner()} is 53, it is over 50
ops/ops-nn/activation/swi_glu/op_host/swi_glu_tiling.cpp 497 the nbnc line of the method {Tiling4SwiGlu()} is 51, it is over 50
ops/ops-nn/activation/swiglu_group_quant/op_host/swiglu_group_quant_infershape.cpp 46 the nbnc line of the method {InferShape4SwigluGroupQuant()} is 70, it is over 50

Special notes for this issue/备注 (Optional / 选填)

likedislike
高逸凡
26 天前 评论:

/assign

likedislike
CANN-robotCANN-robot成员
26 天前 将 yifangao 设为负责人
高高逸凡
26 天前 关联了pull request:修复部分算子C++规范问题
高高逸凡
26 天前 修改标题为 “[Bug-Report|缺陷反馈]: 责任田部分算子代码违反编程规范”,原标题为“[Bug-Report|缺陷反馈]: 责任田部分算子代码违反C++语言规范”
高高逸凡
26 天前 修改了issue 的描述
高高逸凡
23 天前 issue状态由 进行中 改变为 已完成
高高逸凡
23 天前 关闭了 issue
高高逸凡
21 天前 关联了pull request:fix: 修复swiglu_group_quant/init_embedding_hash_table代码C++规范问题