已关闭
[Bug-Report|缺陷反馈]: 修复 autofuse/ascir/reg_func/defalut_reg_func.h 文件名拼写错误 #223
Yeats_Liao创建于  8月2日关闭于  12 天前
Yeats_Liao
Yeats_Liao
8月2日 创建

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

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

在 autofuse/ascir/reg_func/ 目录下,头文件 defalut_reg_func.h 的文件名存在拼写错误:

  • 当前(错误):defalut_reg_func.h
  • 应为(正确):default_reg_func.h

单词 default 被误写成了 defalut(字母 l 与 a 的位置颠倒)。

该头文件被至少 38 个文件 #include 引用,主要影响:

  1. 代码可读性:拼写错误的文件名反复出现在大量 #include 语句中;
  2. 开发体验:新开发者容易误填为正确的 default_reg_func.h 而找不到文件;
  3. 命名不一致:同目录下实现文件是 default_reg_func.cpp(拼写正确),但头文件却是 defalut_reg_func.h(拼写错误),两者命名不一致,极易混淆。

引用该头文件的主要文件包括:

  • autofuse/ascir/reg_func/ 下 34 个算子实现文件(如 abs.cpp、argmax.cpp、cast.cpp、pad.cpp、split.cpp、default_reg_func.cpp 等)
  • autofuse/ascir/generator/v1_ascir_codegen_impl.h
  • autofuse/v35/ascir/generator/v2_ascir_codegen_impl.h
  • autofuse/v35/ascir/reg_func/exp2_v2.cpp、pow_v2.cpp
  • autofuse/tests/ut/ascir/reg_func/ 下的测试文件

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

项 值
OS openEuler 24.03
Python 3.12
Package Manager dnf
CANN 9.1.0-beta.3
硬件 昇腾(Ascend)系列 NPU
代码分支 develop
编译方式 sh build.sh -u --module=autofuse_ascendc_api -c -j 8

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

  1. 在仓库根目录执行以下命令,查看 reg_func 目录下的头文件名:

    ls autofuse/ascir/reg_func/
    

    可以看到存在 defalut_reg_func.h 文件。

  2. 搜索该拼写错误被引用的范围:

    grep -rl "defalut_reg_func.h" --include='*.cpp' --include='*.h' --include='*.cc' .
    

    返回至少 38 个引用该错误文件名的文件。

  3. 对比同目录实现文件:

    ls autofuse/ascir/reg_func/ | grep reg_func
    

    可看到实现文件名为 default_reg_func.cpp(拼写正确),而头文件名为 defalut_reg_func.h(拼写错误),两者命名不一致。

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

  • 头文件应命名为 default_reg_func.h(拼写正确);
  • 所有 #include "defalut_reg_func.h" 应更新为 #include "default_reg_func.h";
  • 与同目录实现文件 default_reg_func.cpp 的命名保持一致;
  • 重命名后项目应能正常编译通过、单元测试全绿。

无运行时错误日志(本问题为静态代码命名缺陷,不影响编译和运行)。

可通过以下命令确认缺陷存在:

# 确认头文件错误命名
ls autofuse/ascir/reg_func/defalut_reg_func.h
# 确认同目录实现文件命名正确
ls autofuse/ascir/reg_func/default_reg_func.cpp
# 确认错误命名的引用范围(返回 38+ 文件)
grep -rl "defalut_reg_func.h" --include='*.cpp' --include='*.h' --include='*.cc' .

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

建议的修复步骤:

  1. 重命名头文件:
    git mv autofuse/ascir/reg_func/defalut_reg_func.h autofuse/ascir/reg_func/default_reg_func.h
    
  2. 批量替换所有引用:
    grep -rl 'defalut_reg_func.h' --include='*.cpp' --include='*.h' --include='*.cc' . | \
      xargs sed -i 's/defalut_reg_func\.h/default_reg_func.h/g'
    
  3. 编译验证:sh build.sh -u --module=autofuse_ascendc_api -c -j 8

优先级:低(不影响功能,仅影响代码质量与可读性)。

likedislike
Yeats_LiaoYeats_Liao
8月2日 issue类型由 任务 改变为 缺陷
wei_shi
wei_shi成员
8月3日 评论:

待分析处理

likedislike
wei_shiwei_shi成员
8月3日 将 wei_shi 设为负责人
wei_shi
wei_shi成员
8月3日 评论:

简单任务,已放共建任务清单中,欢迎开源小伙伴领取,熟悉代码上库流程

likedislike
wei_shiwei_shi成员
13 天前 关联了pull request:fix: 修改文件名default拼写错误
wei_shiwei_shi成员
12 天前 issue状态由 待办的 改变为 已完成
wei_shiwei_shi成员
12 天前 关闭了 issue
CANN-robotCANN-robot成员
12 天前 添加了label:resolved