已合并
refactor(fa): 删除op_kernel头文件的__has_include守卫, 统一使用attention/common路径 #11073
jiang-lirui创建于 25 天前
refactor(fa): 删除op_kernel头文件的__has_include守卫, 统一使用attention/common路径 #11073
已合并
Pull Request已成功合入, 合并人@CANN-robot
(感谢 jiang-lirui 的贡献)25 天前 创建了 pull request,commit 171ed286
atomgit-bot
25 天前 评论:
25 天前 评论:
变更摘要
本 PR 是一次纯重构改动(refactor(fa)),针对 attention/flash_attn/op_kernel 目录下的头文件,删除其中用于头文件路径兼容的 __has_include 条件编译守卫及其 #else 分支(旧的 ../../common/... 回退路径),统一改为只保留 ../../../common/op_kernel/... 这一条标准 include 路径(即 attention/common 路径),消除冗余的双路径维护逻辑。改动共涉及 8 个文件,全部为删除代码(净删除 57 行),无新增逻辑,不改变任何头文件的实际包含目标。
主要改动
- 移除
matmul.h的__has_include守卫:在flash_attn_block_cube_dn.h与flash_attn_block_cube_nd.h中删除了#if __has_include("../../../common/op_kernel/matmul.h")及其#else回退分支,统一直接包含../../../common/op_kernel/matmul.h。 - 统一
arch35相关公共头文件的包含路径:在flash_attn_block_vec_dn.h与flash_attn_block_vec_nd.h中删除__has_include守卫及整段#else分支(flash_attention_score_common_regbase_arch35.h、vf_mul_sel_softmaxflashv2_cast_nz.h等旧路径包含),仅保留../../../common/op_kernel/arch35/...路径。 - 精简
vf_flash_decode_arch35.h与memory_copy_arch35.h的条件包含:flash_attn_block_vec_flashdecode.h删除了对vf_flash_decode_arch35.h的__has_include判断;memory_copy_arch35.h删除了对vector_common.h、fa_gm_tensor.h、attn_copy_gm_to_l1.h、copy_ub_to_gm.h的条件包含及旧路径分支。 - 统一入口文件与类型头文件的包含方式:
flash_attn.cpp与flash_attn_type.h中删除对flash_attention_score_common_regbase_arch35.h的__has_include守卫及../common/arch35/...回退路径,统一使用../../../common/op_kernel/arch35/...。


不准确?
25 天前 添加了label:stat/needs-squash
25 天前 添加了label:cann-cla/yes
CANN-robot
25 天前 评论:
25 天前 评论:
此处折叠了54条消息 查看更多
23 天前 添加了label:approved
23 天前 添加了label:lgtm
23 天前 关闭了关联的issue
23 天前 合入了pull request
描述
在
attention/flash_attn/op_kernel/flash_attn.cpp中,存在以下条件编译代码:#if __has_include("../../common/op_kernel/arch35/flash_attention_score_common_regbase.h") #include "../../common/op_kernel/arch35/flash_attention_score_common_regbase.h" #else #include "../common/arch35/flash_attention_score_common_regbase.h" #endif这种方式维护不便,而且这是编译工程问题,不应该传递带算子层
关联的Issue
Issue #4407
测试
按README.md中的Quick Start操作,执行用例时加--graph_mode参数可使能在线编译,编译不报错表明正确
已验证编译OK
文档更新
不涉及
类型标签