已合并
仓内重名(ffn / torch_extension / mhc / posembedding)整改 #10083
仓内重名(ffn / torch_extension / mhc / posembedding)整改 #10083
已合并
chenyifan创建于 12 天前
chenyifan
chenyifan
12 天前

描述

按仓内重名头文件规范,完成(ffn / torch_extension / mhc / posembedding)整改,消除单仓内同名头冲突。

原因:上述组件存在同名头文件,违反「单仓内原则上不允许重名头文件」;易导致 include 误解析、维护成本上升。

仓内分类规则

对每个重名头文件,先判断 内容是否相同是否对外/包间头文件,再套用:

# 场景 是否整改 处置
1.1 内容不同,均为内部头文件 建议加模块前缀改名
1.2 内容相同,均为内部头文件 只保留一份;改 include 路径,禁止软链接
1.3 部分内部、部分对外/包间 只改内部 那份
1.4 内容相同,均为对外/包间 否(兼容期) 可用软链接保留多路径
1.5 内容不同,均为对外/包间 兼容期内可暂缓 兼容期结束后改名
1.6 其他 原则上不允许重名 特例需评审

原则:除 1.4 外,单仓内原则上不允许重名头文件。

本 PR 实际用到:1.11.31.4(另:aclnn_common.h 为 build 产物与源码重复,不套用上表,忽略 build 路径)。

决策一览

文件名 是否修改 规则 原因 整改方案
ffn.h 1.3 对外公开 + 包内,内容不同 保留 op_api/ffn.hop_kernel/ffn.hffn_kernel.h
aclnn_common.h 源码与 torch_extension/build 产物重复 忽略 build 路径,不改源码
aclnn_rotary_position_embedding.h 1.4 均为对外公开且内容相同 兼容期维持,不改名
mhc_post.h 1.3 对外公开 + 包内(arch22/35),内容不同 保留 op_api;内部 → mhc_post_arch22.h / mhc_post_arch35.h
mhc_post_backward.h 1.3 对外公开 + 包内,内容不同 保留 op_api;内部 → mhc_post_backward_arch22.h
mhc_sinkhorn.h 1.3 对外公开 + 包内,内容不同 保留 op_api;内部 → mhc_sinkhorn_arch35.h
norm_rope_concat_grad.h 1.3 对外公开 + 包内,内容不同 保留 op_api;kernel → norm_rope_concat_grad_kernel.h
apply_rotary_pos_emb_common.h 1.1 两算子包内内容不同 保留 apply 侧原名;inplace 侧 → inplace_partial_rotary_mul_arpe_common.h(避免与已有 inplace_partial_rotary_mul_common.h 冲突)
norm_rope_concat_base.h 1.1 host / kernel 内容不同 *_host.h / *_kernel.h
norm_rope_concat_grad_base.h 1.1 host / kernel 内容不同 *_host.h / *_kernel.h
rope_with_sin_cos_cache_base.h 1.1 arch35 ≠ root arch35 → *_arch35.h;root 保留
rope_with_sin_cos_cache_f_bf16.h 1.1 arch35 ≠ root arch35 → *_arch35.h;root 保留
rope_with_sin_cos_cache_fp32.h 1.1 arch35 ≠ root arch35 → *_arch35.h;root 保留
rotary_position_embedding_a_and_b.h 1.1 跨算子包内内容不同 保留 rotary_position_embedding 侧;inplace → inplace_partial_rotary_mul_a_and_b.h
rotary_position_embedding_ab.h 1.1 跨算子包内内容不同 同上 → inplace_partial_rotary_mul_ab.h
rotary_position_embedding_aba_and_ba.h 1.1 跨算子包内内容不同 同上 → inplace_partial_rotary_mul_aba_and_ba.h
rotary_position_embedding_bab.h 1.1 跨算子包内内容不同 同上 → inplace_partial_rotary_mul_bab.h

改名映射(旧路径 → 新路径)

旧路径 新路径
ffn/ffn/op_kernel/ffn.h ffn/ffn/op_kernel/ffn_kernel.h
mhc/mhc_post/op_kernel/arch22/mhc_post.h mhc/mhc_post/op_kernel/arch22/mhc_post_arch22.h
mhc/mhc_post/op_kernel/arch35/mhc_post.h mhc/mhc_post/op_kernel/arch35/mhc_post_arch35.h
mhc/mhc_post_backward/op_kernel/arch22/mhc_post_backward.h mhc/mhc_post_backward/op_kernel/arch22/mhc_post_backward_arch22.h
mhc/mhc_sinkhorn/op_kernel/arch35/mhc_sinkhorn.h mhc/mhc_sinkhorn/op_kernel/arch35/mhc_sinkhorn_arch35.h
posembedding/norm_rope_concat_grad/op_kernel/norm_rope_concat_grad.h posembedding/norm_rope_concat_grad/op_kernel/norm_rope_concat_grad_kernel.h
posembedding/inplace_partial_rotary_mul/op_kernel/arch35/apply_rotary_pos_emb_common.h posembedding/inplace_partial_rotary_mul/op_kernel/arch35/inplace_partial_rotary_mul_arpe_common.h
posembedding/norm_rope_concat/op_host/norm_rope_concat_base.h posembedding/norm_rope_concat/op_host/norm_rope_concat_base_host.h
posembedding/norm_rope_concat/op_kernel/norm_rope_concat_base.h posembedding/norm_rope_concat/op_kernel/norm_rope_concat_base_kernel.h
posembedding/norm_rope_concat_grad/op_host/norm_rope_concat_grad_base.h posembedding/norm_rope_concat_grad/op_host/norm_rope_concat_grad_base_host.h
posembedding/norm_rope_concat_grad/op_kernel/norm_rope_concat_grad_base.h posembedding/norm_rope_concat_grad/op_kernel/norm_rope_concat_grad_base_kernel.h
posembedding/rope_with_sin_cos_cache/op_kernel/arch35/rope_with_sin_cos_cache_base.h posembedding/rope_with_sin_cos_cache/op_kernel/arch35/rope_with_sin_cos_cache_base_arch35.h
posembedding/rope_with_sin_cos_cache/op_kernel/arch35/rope_with_sin_cos_cache_f_bf16.h posembedding/rope_with_sin_cos_cache/op_kernel/arch35/rope_with_sin_cos_cache_f_bf16_arch35.h
posembedding/rope_with_sin_cos_cache/op_kernel/arch35/rope_with_sin_cos_cache_fp32.h posembedding/rope_with_sin_cos_cache/op_kernel/arch35/rope_with_sin_cos_cache_fp32_arch35.h
posembedding/inplace_partial_rotary_mul/op_kernel/arch35/rotary_position_embedding_a_and_b.h posembedding/inplace_partial_rotary_mul/op_kernel/arch35/inplace_partial_rotary_mul_a_and_b.h
posembedding/inplace_partial_rotary_mul/op_kernel/arch35/rotary_position_embedding_ab.h posembedding/inplace_partial_rotary_mul/op_kernel/arch35/inplace_partial_rotary_mul_ab.h
posembedding/inplace_partial_rotary_mul/op_kernel/arch35/rotary_position_embedding_aba_and_ba.h posembedding/inplace_partial_rotary_mul/op_kernel/arch35/inplace_partial_rotary_mul_aba_and_ba.h
posembedding/inplace_partial_rotary_mul/op_kernel/arch35/rotary_position_embedding_bab.h posembedding/inplace_partial_rotary_mul/op_kernel/arch35/inplace_partial_rotary_mul_bab.h

范围汇总

数量 / 说明
同名组(PR1_small) 17
实际改名 18 个路径
不改 2 组(aclnn_common.haclnn_rotary_position_embedding.h
涉及组件 ffnmhcposembeddingtorch_extension 仅判定不改)

关联的Issue

测试

文档更新

类型标签

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 chenyifan 的贡献)
chenyifanchenyifan
12 天前 创建了 pull request,commit f24cff4d
atomgit-bot
atomgit-bot
12 天前 评论:

变更摘要

本 PR 主要针对仓库内的同名头文件进行整改,围绕 ffnmhcposembedding 等模块将易重名的头文件重命名或按架构/用途拆分,并同步更新 #include 路径与 include guard;同时进行了大量无业务逻辑影响的代码格式整理(如构造初始化列表、__gm__ T * 指针写法、注释对齐、} // namespace 风格等)。

主要改动

  • ffn 头文件去重命名: 将 ffn.h 重命名为 ffn_kernel.h,并把 ffn_antiquant.hffn_base.hffn_glu.hffn_quant.hffn_nonquant_nz.h 等文件中的 #include "ffn.h" 统一改为 #include "ffn_kernel.h",消除与其它 ffn.h 的重名。
  • mhc 按架构拆分重命名: 将 mhc_post.h 重命名为 mhc_post_arch22.h/mhc_post_arch35.hmhc_post_backward.h 重命名为 mhc_post_backward_arch22.hmhc_sinkhorn.h 重命名为 mhc_sinkhorn_arch35.h,并更新 mhc_post.cppmhc_post_apt.cppmhc_post_backward.cppmhc_sinkhorn_apt.cpp 中的 include。
  • posembedding rotary 文件统一命名前缀: 将 rotary_position_embedding_a_and_b.hrotary_position_embedding_ab.hrotary_position_embedding_aba_and_ba.hrotary_position_embedding_bab.h 重命名为 inplace_partial_rotary_mul_* 系列,并将 apply_rotary_pos_emb_common.h 重命名为 inplace_partial_rotary_mul_arpe_common.h,同步更新 include guard 与引用。
  • norm_rope_concat 及 grad 的 host/kernel 头文件分离: 将 norm_rope_concat_base.h 拆分为 norm_rope_concat_base_host.hnorm_rope_concat_base_kernel.hnorm_rope_concat_grad_base.h 同理拆分,并将 norm_rope_concat_grad.h 重命名为 norm_rope_concat_grad_kernel.h,更新各 host/kernel 文件的 include。
  • rope_with_sin_cos_cache 增加 _arch35 后缀: 将 rope_with_sin_cos_cache_base.hrope_with_sin_cos_cache_fp32.hrope_with_sin_cos_cache_f_bf16.h 分别重命名为 rope_with_sin_cos_cache_base_arch35.hrope_with_sin_cos_cache_fp32_arch35.hrope_with_sin_cos_cache_f_bf16_arch35.h,并同步更新 rope_with_sin_cos_cache_apt.cpp 中的引用。
likedislike
CANN-robotCANN-robot成员
12 天前 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
12 天前 评论:

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
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
ffn 蒋礼锐, 马兵 (2/2) 蒋礼锐 (1/1)
posembedding 蒋礼锐, 马兵 (2/2) 蒋礼锐 (1/1)
sig-ops-transformer 蒋礼锐, 马兵 (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

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

likedislike
CANN-robotCANN-robot成员
12 天前 将hz36amy_00,juyangokok,monologue815,chaotang233,xuanyuandy,chen-linxin4,yu-xinjie62,jiang-lirui,Allan_Yu,songkai111,liudan12,cc-z,mabing1118,yuhao_设为评审人
CANN-robotCANN-robot成员
12 天前 将hz36amy_00,juyangokok,monologue815,chaotang233,xuanyuandy,chen-linxin4,yu-xinjie62,jiang-lirui,Allan_Yu,songkai111,liudan12,cc-z,mabing1118,yuhao_设为审查人
chenyifan
chenyifan
12 天前 评论:

compile

likedislike
chenyifanchenyifan
12 天前 update merge request[project id: 7673863, iid: 10083, commit_id: 12c9a974efaa836fcd517a73d4b6a8d1f4ffa2dc] virtual merging success
CANN-robotCANN-robot成员
12 天前 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
12 天前 评论:

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

任务名称状态日志下载链接
Compile_Ascend_X86 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_experimental ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_experimental ✅ SUCCESS >>>>> >>>>>
Compile_Pre ✅ SUCCESS >>>>>
pre_comment ✅ SUCCESS >>>>>
Compile_Ascend_X86_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_experimental_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_experimental_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_910b ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_910c ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_950 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_experimental_950 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_experimental_950 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_experimental_950_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_experimental_950_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_classify ✅ SUCCESS >>>>>
Compile_Ascend_X86_mobile_station_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_mobile_station ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_mobile_station_9030_ubuntu24 ✅ SUCCESS >>>>> >>>>>
UT_Test ✅ SUCCESS
PreSmoke_A900 ✅ SUCCESS >>>>>
API_Check ✅ SUCCESS >>>>>
PreSmoke_ATK_Test_A2 ✅ SUCCESS >>>>>
UT_Test_report_lcov ⚠️ WARNING >>>>>

[2026-08-14 15:35:51]    CI执行结束

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

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

任务名称状态日志下载链接
codecheck ⚠️ WARNING >>>>>
SCA ✅ SUCCESS >>>>>
antipoison ✅ SUCCESS >>>>>
codecheck_style ✅ SUCCESS >>>>>
StaticCheck_codespell ✅ SUCCESS
StaticCheck_link_validity ✅ SUCCESS
StaticCheck_resource_existence ✅ SUCCESS
StaticCheck_tag_closed ✅ SUCCESS
StaticCheck_markdownlint ✅ SUCCESS
codecheck_checkpr ✅ SUCCESS
codecheck_precommit ✅ SUCCESS >>>>>

[2026-08-14 15:21:06]    CI执行结束

likedislike
CANN-robotCANN-robot成员
12 天前 添加了label:api-check-pass
CANN-robotCANN-robot成员
12 天前 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
12 天前 添加了label:ci-pipeline-passed
chenyifanchenyifan
12 天前 修改了pull request 的描述
chenyifanchenyifan
12 天前 修改了pull request 的描述
wang-minbo成员
11 天前 评论:

/lgtm
/approve

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

The following users do not have permission to comment /lgtm or /approve on any module in this PR:
wang-minbo

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

The following users do not have permission to comment /lgtm or /approve on any module in this PR:
wang-minbo

likedislike
jiang-lirui成员
11 天前 评论:

/approve
/lgtm

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

The following users do not have permission to comment /lgtm or /approve on any module in this PR:
wang-minbo

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

The following users do not have permission to comment /lgtm or /approve on any module in this PR:
wang-minbo

likedislike
mabing成员
9 天前 评论:

/lgtm

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

The following users do not have permission to comment /lgtm or /approve on any module in this PR:
wang-minbo

likedislike
CANN-robotCANN-robot成员
9 天前 添加了label:lgtm
CANN-robotCANN-robot成员
9 天前 合入了pull request