已合并
[Feature][ops] add fused_infer_attention_score op_api files_s for migrate FIA to mindiesd #411
[Feature][ops] add fused_infer_attention_score op_api files_s for migrate FIA to mindiesd #411
已合并
wenjiali_sh创建于 7月3日
wenjiali_sh
wenjiali_sh
7月3日

Which issue(s) this PR fixes or accomplishes

Fix part of #ISSUE 198

Purpose

新增用于 fused_infer_attention_score(融合推理注意力机制)的 C++ ACLNN 算子 API 实现文件,以及算子图模式(op_graph)下的降级回退核心逻辑。
本次新增的文件包括:

  • aclnn_fused_infer_attention_score_v4.cpp / .h (v4 版本的入口点文件)
  • aclnn_fused_infer_attention_score_v5.cpp (v5 版本的入口点实现,未引入头文件)
  • fused_infer_attention_score_inner.h (算子内部公共计算辅助头文件)
  • op_graph/CMakeLists.txt (算子图构建 CMake 配置文件)
  • op_graph/fallback_fused_infer_attention_score.cpp (算子图模式回退逻辑的核心实现)

Test Plan

  1. 本地编译校验:运行 build/build_ops.sh 编译自定义算子库,确认新增的 csrc/ops/fused_infer_attention_score 目录下的 C++ 文件和 CMake 配置可顺利完成构建,且没有任何语法或编译报错。
  2. 校验头文件引用在图模式回退下的编译稳定性。

Test Report

[请在此处粘贴本地编译通过的日志文本或 build_ops.sh 成功执行的终端截图]

likedislike
Pull Request已成功合入, 合并人@ascend-robot
(感谢 wenjiali_sh 的贡献)
wenjiali_shwenjiali_sh
7月3日 创建了 pull request,commit 6e208232
ascend-robotascend-robot成员
7月3日 添加了label:ascend-cla/yes
ascend-robot
ascend-robot成员
7月3日 评论:

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
repo-Ascend/MindIE-SD guowenna1, 蓝王力 (2/2) guowenna1 (1/1)

💡 Tip:

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

CLA Signature Pass

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

likedislike
ascend-robotascend-robot成员
7月3日 添加了label:ci-pipeline-running
atomgit-bot
atomgit-bot
7月3日 评论:

变更摘要

本次 PR 新增了 fused_infer_attention_score(融合推理注意力机制)算子的 C++ ACLNN API 实现文件及其算子图模式(op_graph)降级回退逻辑。主要包括 V4 和 V5 两个版本的入口点实现、内部公共辅助头文件,以及基于 V5 接口的图模式回退核心代码,用于将 FIA 算子迁移至 MindIE 平台。

主要改动

  • 新增 aclnn_fused_infer_attention_score_v4 入口点:提供 aclnnFusedInferAttentionScoreV4GetMaxWorkspaceSizeaclnnFusedInferAttentionScoreV4GetWorkspaceSizeaclnnFusedInferAttentionScoreV4 三个接口,并对 Ascend950(DAV_3510)平台显式返回不支持错误;通过 FakeArray 处理可选的 aclIntArray 类型输入,最终委托给 aclnnInnerEagleFusedInferAttentionScore* 内部函数执行。

  • 新增 aclnn_fused_infer_attention_score_v5 入口点:提供 aclnnEagleFusedInferAttentionScoreV5GetMaxWorkspaceSizeaclnnEagleFusedInferAttentionScoreV5GetWorkspaceSizeaclnnEagleFusedInferAttentionScoreV5 三个接口,相比 V4 新增 qStartIdxOptionalkvStartIdxOptionalpseType 参数,并引入 CheckTensorContiguous 对 key/value 等张量的连续性进行校验,通过弱符号 NnopbaseSupportTensorV2 判断 opbase 版本以决定是否容忍非连续张量。

  • 新增 fused_infer_attention_score_inner.h 公共辅助头文件:声明 TensorPreProcessPrefixTensorPreProcessFakeArrayFusedInferAttentionScoreProcessSoftmaxLseCheckKVContiguous 等跨版本共用的工具函数,以及弱符号 NnopbaseSupportTensorV2,供 V4/V5 入口点复用。

  • 新增 fallback_fused_infer_attention_score.cpp 图模式回退逻辑:实现 FusedInferHostExecuteFunc 函数,从 OpExecuteContext 中提取 29 个输入张量和 15 个属性参数,处理 actualSeqLengths 等可选序列信息,并对 sparseMode 在 [10, 14] 区间做特殊转换(减 10 并将 innerPrecise 置 0),最终通过 EXEC_OPAPI_CMD 宏调用 aclnnEagleFusedInferAttentionScoreV5 完成降级计算,并使用 IMPL_OP(EagleFusedInferAttentionScore) 注册算子。

likedislike
此处折叠了70条消息 查看更多
ascend-robotascend-robot成员
7月4日 合入了pull request
ascend-robot
ascend-robot成员
7月4日 评论:

Pull Request 已合并或已关闭。

If you want to solve this problem, you can click here to do it in the FAQs.

likedislike
ascend-robot
ascend-robot成员
7月4日 评论:

Pull Request 已合并或已关闭。

If you want to solve this problem, you can click here to do it in the FAQs.

likedislike
ascend-robot
ascend-robot成员
7月4日 评论:

Pull Request 已合并或已关闭。

If you want to solve this problem, you can click here to do it in the FAQs.

likedislike
ascend-robot
ascend-robot成员
7月4日 评论:

Pull Request 已合并或已关闭。

If you want to solve this problem, you can click here to do it in the FAQs.

likedislike