Merged
test(fused_infer_attention_score): 新增arch38 tiling UT用例并打通UT框架 #17489
HuLinjieAdd on 2 days ago
test(fused_infer_attention_score): 新增arch38 tiling UT用例并打通UT框架 #17489
Merged
HuLinjieAdd on 2 days ago
HuLinjie
HuLinjie
2 days ago

描述

新增 fused_infer_attention_score 算子 arch38 tiling 的 UT 用例,并打通 UT 框架。

关联的Issue

关联 Issue #8936
无

测试

  • 新增 arch38 tiling UT 用例(test_fused_infer_attention_score_arch38_tiling.cpp 及 csv 参数表)
  • 打通 UT 框架(CMakeLists.txt、tiling_case_executor.cpp)
    本地跑通的数据记录:
    image.png

补充说明:

  • 90% 以上(5 个):prompt_tiling、quant_check、mask_sparse、shape_check、pa_check。
  • 85%~90%(3 个):feature_check、tiling_arch38、context_convert。
  • <85%(2 个,拖低整体):
  • tiling_compute.cpp(83.96%,748 行,权重最大)—— 剩余是 512/576 DSizeConst 死桶 + 少量分支。
  • dataconvert.cpp(81.41%)—— 剩余是 SplitBNS(FlashDecode)、SetQKVStartIdx alibi、SetAttenMaskCompressMode/SetLayoutType default,均为死代码。
    整体 87.43%,剩余 12.6% 未覆盖中绝大部分是死代码(死代码后面提新的PR解决),靠补用例能再提升的空间已经很小。

文档更新

无

类型标签

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for HuLinjie's contribution.)
HuLinjieHuLinjie
2 days ago Created pull request, commit ac10ed4e
atomgit-bot
atomgit-bot
2 days ago Comments:

变更摘要

本 PR 为 fused_infer_attention_score 算子新增 arch38(mc62,NpuArch=5102)的 tiling 单元测试用例,并打通该架构在 UT 框架中的支持。核心是通过参数化测试类 FusedInferAttentionScoreArch38TilingTest 从 CSV 参数表驱动执行 ExecuteTestCase,覆盖普通张量输入与 TensorList 输入两种构造方式;同时在 UT 框架的 soc 版本映射与构建脚本中补充 MC62/5102 支持,并解除 arch38 在 test_config.yaml 中的测试排除。

主要改动

  • 新增 arch38 参数化 tiling UT 用例: 新增 test_fused_infer_attention_score_arch38_tiling.cpp,定义 FusedInferAttentionScoreArch38TilingTest 继承 testing::TestWithParam<FusedInferAttentionTilingUtParam>,构造包含 31 个可选输入的算子属性列表与 Arch38SocInfo 硬件参数(L0A/L0B 64KB、L0C 256KB、L1 1MB、UB/253952、cube/vector 各 16 核等),以 "5102" 作为 socVersion 传入 TilingContextPara。
  • 区分普通输入与 TensorList 输入两条路径: 依据 param.isTensorList 分支:非 TensorList 场景直接以输入张量列表和 "5102", 16, 253952, 16384 参数构建 TilingContextPara;TensorList 场景则改用 key/value 的 keyList、valueList 展开,并以 inputInstanceNum/outputInstanceNum 标记各槽位实例数量(按 shape_.GetStorageShape().GetDimNum() != 0 判断输入是否存在),统一调用 ExecuteTestCase 校验 expectResult、expectTilingKey 与 expectTilingDataHash。
  • CSV 参数驱动与用例注册: 通过 INSTANTIATE_TEST_SUITE_P 结合 GetCasesFromCsv / ReplaceFileExtension2Csv(__FILE__) 从同名 csv 参数表加载用例,并用 PrintCaseInfoString 输出用例信息,同时以 GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST 允许参数表为空。
  • UT 框架补充 MC62 架构映射: 在 tiling_case_executor.cpp 的版本映射宏中同时新增 {"5102", "MC62"}(NpuArch → Short_SoC_version)与 {"MC62", "5102"}(反向)两条映射,使 MC62 架构能够经 UT 框架正常进入 tiling 流程。
  • 构建与测试配置放开 arch38: build.sh 的 build_pr_ut_exclude_mc2 中 process_soc_input 增加 mc62,tests/test_config.yaml 移除 attention/fused_infer_attention_score/op_host/arch38 的排除项,使 arch38 tiling 进入 UT 覆盖范围。
likedislike
Incorrect?
CANN-robotCANN-robotCollaborators
2 days ago Added label: cann-cla/yes
CANN-robot
CANN-robotCollaborators
2 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 ✅ 蒋礼锐, wangzhe123456789 (2/2) ✅ 蒋礼锐 (1/1)
build.sh ✅ 蒋礼锐, wang-minbo (2/2) ✅ 蒋礼锐, wang-minbo (2/1)
tests ✅ 蒋礼锐, wang-minbo (2/2) ✅ 蒋礼锐, wang-minbo (2/1)

💡 Tip:

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

CLA Signature Pass

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

likedislike
CANN-robotCANN-robotCollaborators
2 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,wang-minbo,huang-wei-chen,xtqh,liudan12,shasha_an,wangzhe123456789,Wei_NaChuan,zhangshuoleiokok,luwei_1104,cc-z,kdy18482276080,xuchengyang,shen_weiling,gaoxiang618,songjionghui,lining_210,miaofangzheng,mabing1118,tang-hao-hw-gitcode,haijie_699874,zzy__,Julius47,yuhao_,L_Euler,wangxun21,zzzzzzyf_ as approver
CANN-robotCANN-robotCollaborators
2 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,wang-minbo,huang-wei-chen,xtqh,liudan12,shasha_an,wangzhe123456789,Wei_NaChuan,zhangshuoleiokok,luwei_1104,cc-z,kdy18482276080,xuchengyang,shen_weiling,gaoxiang618,songjionghui,lining_210,miaofangzheng,mabing1118,tang-hao-hw-gitcode,haijie_699874,zzy__,Julius47,yuhao_,L_Euler,wangxun21,zzzzzzyf_ as approver
HuLinjie
HuLinjie
2 days ago Comments:

/compile

likedislike
HuLinjieHuLinjie
2 days ago Pre merge succeeded (commit_id: 75cfba803bcf893ec05f98c9ce50c4d7413a34c2)
CANN-robot
CANN-robotCollaborators
2 days ago Comments:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robotCollaborators
2 days ago Added label: ci-pipeline-running
6 event messages are collapsed here。 See more
HuLinjieHuLinjie
2 days ago Modify description of pull request
HuLinjie
HuLinjie
2 days ago Comments:

/compile

likedislike
CANN-robot
CANN-robotCollaborators
2 days ago Comments:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robotCollaborators
2 days ago Removed label: ci-pipeline-passed
CANN-robotCANN-robotCollaborators
2 days ago Added label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
2 days ago Removed label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
2 days ago Added label: ci-pipeline-passed
jiang-lirui
jiang-liruiCollaborators
1 day ago Comments:

/approve
/lgtm

likedislike
CANN-robotCANN-robotCollaborators
1 day ago Added label: approved
wang-minbo
wang-minboCollaborators
1 day ago Comments:

/lgtm
/approve

likedislike
wangzhe123456789
wangzhe123456789Collaborators
1 day ago Comments:

/lgtm

likedislike
CANN-robotCANN-robotCollaborators
1 day ago Added label: lgtm
CANN-robotCANN-robotCollaborators
1 day ago Closed associated issue
CANN-robotCANN-robotCollaborators
1 day ago Merged pull request