Pull Request已成功合入, 合并人@CANN-robot
(感谢 Leechi666 的贡献)变更摘要
本 PR 针对 Issue #210(autofuse/ascir 目录单测行覆盖率补足至 95%)中 reg_func 部分的首批提交,为 autofuse/tests/ut/ascir/reg_func/test_reg_func_remainder.cpp 新增用例 CalcRemainderTmpSize_ShouldReturnCorrectSize_WhenSecondInputIsTensor,覆盖 autofuse/ascir/reg_func/remainder.cpp 中「第二输入为普通 tensor」时按 3×dtype 字节数×输入元素数计算临时内存大小的分支,使该文件行覆盖率由 52.9% 提升至 100%(17/17 行)。
主要改动
- 新增第二输入为 tensor 的测试用例: 在
CalcRemainderTmpSizeTest中新增CalcRemainderTmpSize_ShouldReturnCorrectSize_WhenSecondInputIsTensor,构造Data/Load/Remainder/Store/Output完整计算图,并显式设置node->inputs[0].attr.vectorized_strides以进入目标计算分支。 - 构造非全 1 的 repeats 输入: 与既有用例不同,本用例让
x2走Data(真张量)而非Scalar,且x2.y.repeats与load2.y.repeats均设为{s0, s1},使临时内存大小计算走「3 个中间 buffer ×sizeof(float)× 输入元素数」的分支。 - 断言临时内存大小的封顶语义: 用例断言
result[0]->size等于sym::Min(Symbol(65312), Symbol(12) * s0 * s1),即按 12×s0×s1(3×4 字节×元素数)计算并与上限65312取小,与abs测试的断言形式保持一致,同时校验result.size()为 1 且life_time_axis_id为 -1。


Hi @hitLeechi, welcome to submitting your first PR to graph-autofusion!
PR Merge Steps
1. CLA Signing
If the current PR label includes cann-cla/yes, it means you have signed the CLA and can proceed to the next step. If the label includes cann-cla/no, please sign the CLA first. If you have any questions, please refer to the FAQ.
2. CI Check
Please comment /compile to trigger the CI pipeline check. If the CI run is successful, the PR will be tagged with ci-pipeline-passed and you can proceed to the next step. If the CI run fails, the PR will be tagged with ci-pipeline-failed, please check the CI logs to fix the issues in the PR. If you have any questions, please refer to the FAQ.
3. Code Review
After CI passes, please refer to the PR Approval Progress and proactively @ the committers in the table to review the code. After approval, committers will comment /lgtm and /approve. Once the lgtm and approved labels are successfully added, the PR will be merged automatically.


/lgtm


/approve


Pull Request
描述
补充 autofuse/ascir/reg_func 目录多个算子的单元测试,使得该目录下UT覆盖率本地自测达到95.7%覆盖此前未触达的分支(Issue #210 reg_func 部分第一批提交):
lcov 实测:六个文件合计 237/237 行、23/23 函数,100%。
变更类型
关联的Issue
#210
如何测试
sh build.sh -u --module=autofuse_framework -j 8CalcRemainderTmpSizeTest/CalcReduceTmpSizeTest/CalcTrueDivTmpSizeTest/CalcCompareTmpSizeTest/CalcRsqrtTmpSizeTest新增用例全部通过核对清单
其他信息
split.cpp 保持 94.7%(剩余 1 行为 IsAllStaticAligned 内层符号乘积,需要动态输出构图机制,投入产出比低);argmax/argmax_with_value/zerosLike 为无调用方的遗留死代码(12 行),建议另行确认删除。