Merged
feat(cmake): 在现有分类遍历中补充独立 DSL 入口 #15388
feat(cmake): 在现有分类遍历中补充独立 DSL 入口 #15388
Merged
zyh_gitcodeAdd on 4 days ago
zyh_gitcode
zyh_gitcodeCollaborators
4 days ago

描述

只有 op_dsl/CMakeLists.txt 的算子缺少分类目录加载入口。本 PR 沿用分类目录已有遍历,在原有入口判断后补充 DSL 分支,不新增公共 CMake 函数、模块扫描或目录收集流程。

  • attention、mhc、mamba、posembedding、gmm 等已有 root/host 判断的分类,在 host 分支后补充 op_dsl 分支,保留原有 root/host 优先级。
  • 原来只判断根目录入口的分类,仅追加 op_dsl/CMakeLists.txt 存在性判断和加载,不额外检查或排除 op_host/framework。原来已有 op_host 判断的分类保留原分支。
  • mc2 保留公共目录排除和父作用域变量传递,补充 DSL 入口。mc2/tools/CMakeLists.txt 已恢复基线,不再包含其适配。
  • 覆盖仓库已有的 15 个分类入口文件;不新增分类调用,不扩大普通/custom 构建原本会进入的分类范围。

根目录 CMakeLists.txt、cmake/func.cmake、cmake/custom_build.cmake 均恢复为基线内容。没有新增测试文件。

已有 ASC 算子继续由原入口显式 include DSL CMake;纯 DSL 算子只需保留 op_dsl/CMakeLists.txt。原有依赖收集和加载不变,本版不扩展纯 DSL 依赖发现能力。

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for zyh_gitcode's contribution.)
zyh_gitcodezyh_gitcodeCollaborators
4 days ago Created pull request, commit 64298524
atomgit-bot
atomgit-bot
4 days ago Comments:

变更摘要

本 PR 主要解决纯 DSL 写的 attention 算子无法被自动发现的问题:此前普通 attention 与 experimental attention 的算子发现逻辑只检查算子根目录和 op_host 目录下的 CMakeLists.txt,仅提供 op_dsl/CMakeLists.txt 的算子会被跳过,需要额外补一个根目录转发文件。改动在 attention/CMakeLists.txt 与 experimental/attention/CMakeLists.txt 两处发现逻辑中引入第三个入口 op_dsl/CMakeLists.txt,并明确入口优先级,使纯 DSL 算子无需转发文件即可参与构建。

主要改动

  • 新增 op_dsl 发现入口:在两处 attention 算子发现逻辑中加入 op_dsl/CMakeLists.txt,入口优先级依次为 <operator>/CMakeLists.txt、<operator>/op_host/CMakeLists.txt、<operator>/op_dsl/CMakeLists.txt。
  • 保证单入口加载:每个算子只自动加载一个入口,已有 ASC 算子继续走原有入口,由其 op_host/CMakeLists.txt 自行 include DSL 适配,避免同一算子被重复加载。
  • 纯 DSL 算子可直接接入:只有 op_dsl/CMakeLists.txt 的算子可被自动发现,并继续沿用现有的算子选择过滤规则,算子名称过滤行为不变。
  • 改动范围收敛在 CMake 发现逻辑:仅调整 attention/CMakeLists.txt 和 experimental/attention/CMakeLists.txt,不包含算子示例,也不改动公共登记宏。

🧩 本次 Review 已使用自定义 Skill:

likedislike
Incorrect?
CANN-robotCANN-robotCollaborators
4 days ago Added label: cann-cla/yes
CANN-robot
CANN-robotCollaborators
4 days ago Comments:

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.
You can self-configure the PR merge rules for this repository. For more details, please refer to 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
attention ✅ luwei_1104, 蒋礼锐, 马兵 (3/2) ✅ 马兵, luwei_1104, 蒋礼锐 (3/1)
experimental/attention ✅ 蒋礼锐, 马兵, luwei_1104 (3/2) ✅ 蒋礼锐, 马兵, luwei_1104 (3/1)
experimental/ffn ✅ 蒋礼锐, 马兵 (2/2) ✅ 蒋礼锐, 马兵 (2/1)
experimental/gmm ✅ 蒋礼锐, 马兵 (2/2) ✅ 蒋礼锐, 马兵 (2/1)
experimental/mc2 ✅ 蒋礼锐, 马兵, wang-minbo (3/2) ✅ 马兵, wang-minbo, 蒋礼锐 (3/1)
experimental/moe ✅ 蒋礼锐, 马兵 (2/2) ✅ 蒋礼锐, 马兵 (2/1)
experimental/posembedding ✅ 蒋礼锐, 马兵, luwei_1104 (3/2) ✅ 蒋礼锐, 马兵, luwei_1104 (3/1)
ffn ✅ 蒋礼锐, 马兵 (2/2) ✅ 蒋礼锐, 马兵 (2/1)
gmm ✅ 马兵, 蒋礼锐 (2/2) ✅ 蒋礼锐, 马兵 (2/1)
mc2 ✅ wang-minbo, 蒋礼锐, 马兵 (3/2) ✅ 马兵, wang-minbo, 蒋礼锐 (3/1)
mhc ✅ 蒋礼锐, luwei_1104, 马兵 (3/2) ✅ luwei_1104 (1/1)
moe ✅ 蒋礼锐, 马兵 (2/2) ✅ 马兵, 蒋礼锐 (2/1)
posembedding ✅ 蒋礼锐, 马兵, luwei_1104 (3/2) ✅ 蒋礼锐, 马兵, luwei_1104 (3/1)
sig-ops-transformer ✅ 蒋礼锐, 马兵 (2/2) ✅ 蒋礼锐, 马兵 (2/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)

CLA Signature Pass

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

likedislike
CANN-robotCANN-robotCollaborators
4 days ago Set guijianwei,hz36amy_00,yangziqi_007,coder_linx,cheng_zhiwei,juyangokok,monologue815,xuanyuandy,crystalhu,yu-xinjie62,huangwei791,jiang-lirui,yang-binrong,Allan_Yu,huang-wei-chen,liudan12,shasha_an,wangzhe123456789,Wei_NaChuan,zhangshuoleiokok,luwei_1104,cc-z,kdy18482276080,xuchengyang,shen_weiling,gaoxiang618,songjionghui,lining_210,wenxin_fight,miaofangzheng,mabing1118,tang-hao-hw-gitcode,haijie_699874,zzy__,Julius47,yuhao_,L_Euler,wangxun21 as approver
62 messages are collapsed here。 See more
CANN-robotCANN-robotCollaborators
4 days ago Added label: lgtm
wang-minboCollaborators
4 days ago Comments:

/lgtm
/approve

likedislike
luwei_1104Collaborators
3 days ago Comments:

/approve

likedislike
CANN-robotCANN-robotCollaborators
3 days ago Added label: approved
CANN-robotCANN-robotCollaborators
3 days ago Merged pull request