已合并
CleanCode整改——SoftmaxV2、GroupNormV2、LpNormV2 #4031
zhuzixian-lr创建于 4月21日
CleanCode整改——SoftmaxV2、GroupNormV2、LpNormV2 #4031
已合并
zhuzixian-lr创建于 4月21日
zhuzixian-lr成员
4月21日

描述

问题/功能描述

本次PR主要对多个算子(SoftmaxV2、GroupNormV2、LpNormV2)的Tiling实现代码进行了代码规范优化和类型安全重构。核心内容包括:1) 移除全局命名空间std的引用,避免潜在的命名冲突,提升代码可读性;2) 修复GroupNormV2算子中大量使用uint64_t类型表示可能为负值或参与有符号计算的变量所导致的整数溢出和类型转换错误,确保计算逻辑的正确性;3) 优化LpNormV2算子的编译信息获取方式,提升代码健壮性。

修改方案描述

修改方案主要包括三项内容:一是移除了using namespace std;语句,将vector等类型显式指定为std::vector,并补充必要的头文件包含;二是将GroupNormV2算子中相关的静态常量、结构体成员、局部变量和函数参数从uint64_t统一改为int64_t,并修正了__builtin_clzl的参数类型及相关的类型转换逻辑,同时将获取编译信息的方式从reinterpret_cast更新为更安全的模板方法 GetCompileInfo<GroupNormV2CompileInfo();三是将LpNormV2算子中ubSize成员的数据类型修正为int64_t以保持一致性,移除了不必要的全局命名空间引用,并为部分成员变量提供了默认初始化值。

关联的Issue

测试

冒烟和ST全通过

文档更新

类型标签

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 zhuzixian-lr 的贡献)
Zzhuzixian-lr成员
4月21日 创建了 pull request,commit 0cf42826
CANN-robotCANN-robot成员
4月21日 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
4月21日 评论:

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
activation 章武, 查建青 (2/2) 查建青 (1/1)
norm 查建青, 章武 (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

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

likedislike
CANN-robot
CANN-robot成员
4月21日 评论:

CLA Signature Pass

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

likedislike
CANN-robotCANN-robot成员
4月21日 将crystalhu,yangyang016,fanqirui,zhou-qilong,zhajianqing123,chenqi317,liubo75,tangweiwei2,liujie12345678,Chen_HaoWen,wangyongguang,zhang-wu设为评审人
此处折叠了263条消息 查看更多
CANN-robotCANN-robot成员
5月7日 添加了label:api-check-pass
CANN-robotCANN-robot成员
5月7日 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
5月7日 添加了label:ci-pipeline-passed
CANN-robot
CANN-robot成员
5月7日 评论:

Review Guide

This pull-request passes review.
Committers who wrote a comment of /approve are: 查建青.
Reviewers who wrote a comment of /lgtm are: 查建青, 章武.

likedislike
CANN-robotCANN-robot成员
5月7日 合入了pull request