已合并
test: 补充ascir目录UT并清理无调用reg_func文件(#210) #2001
test: 补充ascir目录UT并清理无调用reg_func文件(#210) #2001
已合并
Leechi666创建于 9 天前
Leechi666
Leechi666成员
9 天前

Pull Request

描述

Issue #210 收官批次:补充 generator/meta 目录大批单元测试,并清理 reg_func 无调用遗留文件。

新增测试(4 个文件):

源文件 新增内容 覆盖效果
generator/v1_ascir_codegen_impl.h 61 类元数据断言 + policy 探针(unary/binary/trinary/reduce/matmul 五族构图调用 CalcTmpBufSize/IsNodeValid/IsInplace/IsBrcInline) ~25% → 95.4%(函数 99.1%)
generator/v1_ascir_att_impl.h 从 26 类扩展到 77 类全量契约断言 行覆盖 100%
meta/ascir_utils.cpp DebugImplGraphStr 全家桶构图(exec_condition/compute_unit/queue/buffer 内存渲染)+ dtype 变体 + tmp_buffers + dump 前缀环境用例 77.6% → 89.3%(函数 100% 55/55)
meta/ascendc_graph_txt_dumper.cpp 子图模式(VfSubgraph 命名)+ Scalar/broadcast/workspace 构图走 DumpLoopExecutionView 深链 + GetDtypeInfo 全枚举 78.4% → 89.2%(函数 98.4%)

死代码清理: 删除 argmax.cpp/argmax_with_value.cpp/zerosLike.cppdefalut_reg_func.h 对应声明——三个文件的 CalcTmpSize 在全仓库无任何调用方(ZerosLike 算子注册亦不存在),为迁移遗留死代码。

变更类型

关联的Issue

#210

如何测试

  1. sh build.sh -u --module=autofuse_framework -j 8
  2. 全量 801 用例通过(本地实测 795 PASSED + 6 历史 DISABLED,0 失败)
  3. lcov 四二进制口径:三目录合计 94.3%(3089/3277 行;framework 全量含 py_module/e2e 预期更高)

核对清单

其他信息

与 #1953(reg_func)、#1985(generator 前哨)、#1997(codegen 元数据)同属 Issue #210 分批交付,本 PR 为收官批次。剩余少量深渲染分支(~24 行)待 CI 增量覆盖率报告确认后按需补齐。

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

变更摘要

本 PR 是 Issue #210 的收官批次,核心包含两部分:为 generator/meta 目录补充大批量单元测试(新增 test_ascir_codegen_calc.cpptest_ascir_codegen_impl.cpptest_ascir_meta.cpp 三个测试文件,并大幅扩展 test_ascir_att_impl.cpp 的契约断言),同时清理 reg_func 目录中全仓库无调用方的迁移遗留死代码(删除 argmax.cppargmax_with_value.cppzerosLike.cppdefalut_reg_func.h 中的对应声明)。整体以提升 v1_ascir_codegen_impl.hv1_ascir_att_impl.hascir_utils.cppascendc_graph_txt_dumper.cpp 的行/函数覆盖率为目标,据 PR 描述三目录合计覆盖率约达 94.3%。

主要改动

  • 新增 codegen 实现元数据断言与策略探针测试test_ascir_codegen_impl.cpp 对约 60 类算子逐一断言 GetApiCallName/GetApiName/IncludeApiHeaderFiles/LoadApiHeaderFiles 的非空与数量上限,并通过 13 次 IsScalarInputSupported/IsScalarInputSupportedIfExchangeInputs 计数探针驱动标量输入与 brc-inline 策略分支;test_ascir_codegen_calc.cpp 采用 Data→Load→Op→Store→Output 构图覆盖 unary/binary/trinary/reduce/matmul 五族算子,调用 CalcTmpBufSizeIsNodeValidIsInplaceSupportedIsBrcInlineSupported,并对 ArgMaxMultiRPhase1 双输出场景单独构图验证。

  • v1_ascir_att_impl 契约断言从 26 类扩展到 77 类test_ascir_att_impl.cpp 将原先按 ElementWise/ReduceArgMax/NoModeling 拆分的三个测试合并为 GetApiPerfReturnsIrName_AllClasses,并补齐 MaximumReduceMeanClipByValueGeluMaskedFill 等算子的 GetAscendCApiPerfTable 断言。

  • 补充 meta 目录 dump/工具函数单元测试test_ascir_meta.cpp 构造携带非默认 exec_condition、queue/buffer 内存属性(que_id/buf_id/hardware/position)、dtype 变体、tmp_buffers、常量轴与零 stride 广播、Workspace 节点及 _VfSubgraph_ 命名子图的图结构,驱动 DebugImplGraphStrDumpLoopExecutionViewGetDtypeInfoGetAxisTypePriority/GetAxisTypeSuffixCollectInputNames 等渲染路径,并覆盖通过 AUTOFUSE_DFX_FLAGS--codegen_compile_debug)启用时 GetDumpFilePrefix 生成真实前缀的环境用例。

  • 删除 reg_func 无调用遗留死代码:整文件删除 argmax.cppargmax_with_value.cpp(其 CalcArgmaxTmpSize/CalcArgmaxWithValueTmpSize 均回退到 CalcDefaultTmpSize 或固定分配临时 buffer)与 zerosLike.cppCalcZerosLikeTmpSize),并同步从 defalut_reg_func.h 移除 CalcArgmaxTmpSizeCalcArgmaxWithValueTmpSize 两个函数声明。

likedislike
不准确?
atomgit-bot
atomgit-bot
9 天前 评论:

代码审查

✅ 未发现问题

likedislike
不准确?
CANN-robotCANN-robot成员
9 天前 添加了label:cann-cla/yes
此处折叠了74条消息 查看更多
liyuewei
liyuewei成员
2 天前 评论:

/lgtm

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

/approve

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