已合并
test: 补充codegen_impl元数据与meta工具单元测试(#210) #1997
test: 补充codegen_impl元数据与meta工具单元测试(#210) #1997
已合并
Leechi666创建于 9月8日
Leechi666
Leechi666成员
9月8日

Pull Request

描述

补充 autofuse/ascir 目录单元测试(Issue #210 第三批交付,generator codegen 元数据 + meta 公共工具):

源文件 新增内容 覆盖目标 行覆盖率
generator/v1_ascir_codegen_impl.h 53 个算子 CodegenImpl 类的元数据契约断言(GetApiCallName/GetApiName 非空、header 列表容量约束) 大量从未实例化的 Impl 类元数据方法,防止算子 api 名/头文件列表回归 ~25% → 64.2%(本地 lcov 实测,+390 行)
meta/ascir_utils.cpp IdentifierToStr、GetDumpFilePrefix 直测 标识符渲染与 dump 前缀确定性 —
meta/ascendc_graph_txt_dumper.cpp GetDtypeInfo、GetAxisTypePriority/Suffix、ExtractDtype/AxisListFromTensorType、BuildAxisIdToName/TypeMap 共 5 组直测 dtype/轴类型查找与 tensor 类型解析 —

变更含 CMakeLists 接线:test_ascir_ut 新增 2 个测试文件与 ${CODE_ROOT_DIR}/ascir/generator include 路径。

变更类型

关联的Issue

#210

如何测试

  1. sh build.sh -u --module=autofuse_framework -j 8
  2. 运行 AscIrCodegenImplMetaTest 与 AscirMetaUtilsTest 全部通过(本地全量 781 用例 0 失败)
  3. lcov 收集验证 v1_ascir_codegen_impl.h 覆盖率提升至 64.2%

核对清单

其他信息

与 PR #1953(reg_func)、#1985(generator 前哨)同属 Issue #210 分批交付。剩余缺口(codegen_impl 的 Calc/IsNodeValid 构图链路、txt_dumper/ascir_utils 的静态深链函数)将在后续批次补充。

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 Leechi666 的贡献)
Leechi666Leechi666成员
9月8日 创建了 pull request,commit 8074435e
Leechi666Leechi666成员
9月8日 关联了issue:【代码加固】补充autofuse/ascir/目录下单元测试
atomgit-bot
atomgit-bot
9月8日 评论:

变更摘要

本 PR 为 Issue #210 的第三批交付,属于 test: 类型变更,为 autofuse/ascir 目录补充 generator codegen 元数据与 meta 公共工具相关单元测试:新增两个测试文件,分别覆盖 v1_ascir_codegen_impl.h 中 53 个算子 CodegenImpl 类的元数据契约,以及 ascir_utils / ascendc_graph_txt_dumper 中的标识符渲染、dtype/轴类型解析等工具函数,以弥补此前大量从未被实例化的 Impl 类元数据方法与静态工具函数的测试空白。通过 CMakeLists 接线将新用例纳入 test_ascir_ut 构建(本地 lcov 实测将 v1_ascir_codegen_impl.h 行覆盖率由约 25% 提升至 64.2%,全量 781 用例 0 失败)。

主要改动

  • 新增 codegen 元数据契约测试(test_ascir_codegen_impl.cpp):新增 AscIrCodegenImplMetaTest,通过 EXPECT_CODEGEN_META 宏遍历 Abs、MatMul、Conv2D 等 53 个算子,断言各 Impl 类的 GetApiCallName()、GetApiName() 非空,且 IncludeApiHeaderFiles()(必要时含 LoadApiHeaderFiles(false))头文件数量不超过 32 个,防止算子 API 名/头文件列表回归。
  • 新增 meta 工具函数直测(test_ascir_meta.cpp):新增 AscirMetaUtilsTest,覆盖 ascir::utils::IdentifierToStr(标识符渲染稳定非空)、GetDumpFilePrefix(确定性)以及 ascir::dumper 的 GetDtypeInfo、GetAxisTypePriority/GetAxisTypeSuffix、ExtractDtypeFromTensorType/ExtractAxisListFromTensorType、BuildAxisIdToNameMap/BuildAxisIdToTypeMap 等查找与解析逻辑,包含 ge::DT_FLOAT 等常见 dtype 解析及 AscGraph 轴映射用例。
  • 构建接线调整:test_ascir_ut 新增上述 2 个测试文件,并为测试目标增加 ${CODE_ROOT_DIR}/ascir/generator include 路径(依据 PR 描述,该文件无内嵌补丁),使新用例可随 test_ascir_ut 一起编译运行。
likedislike
不准确?
atomgit-bot
atomgit-bot
9月8日 评论:

代码审查

✅ 未发现问题

likedislike
不准确?
CANN-robotCANN-robot成员
9月8日 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
9月8日 评论:

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
repo-cann/graph-autofusion ✅ yangyongqiang0606, liyuewei, xchu42 (3/2) ✅ yangyongqiang0606 (1/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)
likedislike
CANN-robot
CANN-robot成员
9月8日 评论:

CLA Signature Pass

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

likedislike
CANN-robotCANN-robot成员
9月8日 将niuyuhu,yangyongqiang0606,liyuewei,xchu42,zhang_shengjie,depeng1994,wqtshg_wt,peiyang,shengnan666,XuebinYang,sjtulxh,zhanj,zhujingjing,xuyafei,wangxiaotian995设为评审人
CANN-robotCANN-robot成员
9月8日 将niuyuhu,yangyongqiang0606,liyuewei,xchu42,zhang_shengjie,depeng1994,wqtshg_wt,peiyang,shengnan666,XuebinYang,sjtulxh,zhanj,zhujingjing,xuyafei,wangxiaotian995设为审查人
Leechi666
Leechi666成员
9月8日 评论:

compile

likedislike
Leechi666Leechi666成员
9月8日 预合并成功(commit_id: 99814007e3908f573917e31874afebcb40a68fcb)
CANN-robot
CANN-robot成员
9月8日 评论:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robot成员
9月8日 添加了label:ci-pipeline-running
CANN-robotCANN-robot成员
9月8日 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
9月8日 添加了label:ci-pipeline-passed
Leechi666
Leechi666成员
28 天前 评论:

compile

likedislike
Leechi666Leechi666成员
28 天前 预合并成功(commit_id: edb527ff85ca20b91baf47c9c6c86bcbb4537818)
CANN-robot
CANN-robot成员
28 天前 评论:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robot成员
28 天前 删除了label:ci-pipeline-passed
CANN-robotCANN-robot成员
28 天前 添加了label:ci-pipeline-running
CANN-robotCANN-robot成员
28 天前 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
28 天前 添加了label:ci-pipeline-passed
liyuewei
liyuewei成员
28 天前 评论:

/lgtm

likedislike
xchu42
xchu42成员
27 天前 评论:

/lgtm

likedislike
CANN-robotCANN-robot成员
27 天前 添加了label:lgtm
yangyongqiang
yangyongqiang成员
27 天前 评论:

/approve

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