Merged
fix(dsl): 清理框架 UT 并隔离 UT 的 DSL 产物构建 #15464
fix(dsl): 清理框架 UT 并隔离 UT 的 DSL 产物构建 #15464
Merged
zyh_gitcodeAdd on 3 days ago
zyh_gitcode
zyh_gitcodeCollaborators
3 days ago

普通 UT 在 CMake 配置阶段会进入 DSL 产物发布;当 UT 环境的 OpKit 接口与工程不匹配时,测试用例执行前即因 opkit.build(mode=...) 失败。本 PR 将真实 DSL 编译与普通 UT 配置隔离,并删除原有模拟工程的框架 UT。

  • 删除 tests/ut/python/test_cannbotdsl_aclnn.py、test_cannbotdsl_build.py、test_cannbotdsl_package.py,共 1138 行;不保留中间合并的 test_cannbotdsl.py。
  • cmake/func.cmake 的 enable_cannbotdsl_kernel 在 UT_TEST_ALL、OP_HOST_UT、OP_API_UT、OP_KERNEL_UT、OP_GRAPH_UT 模式下提前返回,避免普通 UT 构建 DSL Host 归档或设备资源。
  • 正常工程的 DSL Host/Kernel 构建路径保留。真实 ACLNN/DSL 编译、链接、打包由工程负责,算子正确性测试由各算子维护。

最终范围只有三份测试删除和公共 CMake 新增 4 行;未改算子实现、接口或 CI 镜像。

验证:本分支五种 UT 开关的定向 CMake 检查通过,正常模式仍执行 DSL 可用性检查;git diff --check 通过。另在 PR #15347 的 MQSMLA 源码上验证同一修复,使用匹配的 dev 0.8.2、全量 1008 个真实 DSL 特化完成设备编译,并经工程增量 --pkg 生成含设备二进制的 RUN 包、完成解包核对;该记录不等同于本 PR 的远端 CI 结果。未执行 NPU 数值或性能测试。

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for zyh_gitcode's contribution.)
zyh_gitcodezyh_gitcodeCollaborators
3 days ago Created pull request, commit 580488c2
atomgit-bot
atomgit-bot
3 days ago Comments:

变更摘要

本次变更将 DSL 框架的单元测试从“需要真实编译工具链的集成验证”收敛为纯逻辑回归:删除了在临时目录中重建 CMake 工程、伪造 Native/ACLNN runtime、调用编译器/链接器/nm/readelf 以及构建 wheel 的测试与辅助代码,仅保留针对发布缓存、回滚、资源归属和包结构校验的断言。三份测试文件均只涉及测试代码与导入的精简,未触及算子实现、CMake 脚本、CI 或发布 helper。

主要改动

  • 简化 ACLNN 包校验 fixture:test_cannbotdsl_aclnn.py 中的 publish_aclnn 去掉了 mode 参数与全部 C++ 源码内容,改为按 l0/l2 开关只写入占位文件与 package.json manifest 所需路径,使包校验不再依赖可编译的 runtime。
  • 删除 ACLNN 编译/链接/安装类测试:移除 aclnn_project 工程生成器、publish_native 以及 test_aclnn_build_link_and_install、test_dual_host_caches_are_independent_and_aclnn_runs_without_python、test_reconfigure_removes_only_unselected_host_path、test_separate_declaration_publishes_public_api_with_existing_asc_inner_registration、test_l2_declaration_changes_do_not_republish_native_or_device,并清理 ctypes、shutil、subprocess、Path 等导入;保留发布层级、缓存与 source_exports 标记识别相关用例。
  • 移除 CMake 执行辅助与可选依赖构建测试:test_cannbotdsl_build.py 删除 cmake、build_install 辅助函数及 test_input_dependencies_preserve_cmake_paths,并移除 _optional_dsl_project 构建夹具与 test_real_unavailable_probe_still_builds_and_installs_asc、test_real_unavailable_probe_cleans_owned_stale_resources_and_keeps_asc、test_discoverable_modules_do_not_hide_real_dsl_build_errors;保留原子替换回滚与 sync_kernels 归属保护用例。
  • 删除 wheel 打包回归测试:test_cannbotdsl_package.py 移除了基于 setup.py bdist_wheel 的 test_wheel_includes_recursive_dsl_sources_with_working_relative_imports,同时删除 os、shutil、subprocess、zipfile 导入,仅保留 custom Torch 包内相对导入的 test_custom_builder_loads_without_base_package。

🧩 本次 Review 已使用自定义 Skill:

likedislike
Incorrect?
CANN-robotCANN-robotCollaborators
3 days ago Added label: cann-cla/yes
CANN-robot
CANN-robotCollaborators
3 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
cmake ✅ 蒋礼锐, 刘丹 (2/2) ✅ 蒋礼锐, 刘丹 (2/1)
tests ✅ 蒋礼锐, 刘丹 (2/2) ✅ 刘丹, 蒋礼锐 (2/1)

💡 Tip:

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

CLA Signature Pass

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

likedislike
CANN-robotCANN-robotCollaborators
3 days ago Set monologue815,jiang-lirui,Allan_Yu,wang-minbo,xtqh,liudan12,gaoxiang618,mabing1118,zzzzzzyf_ as approver
43 messages are collapsed here。 See more
liudan12Collaborators
2 days ago Comments:

/lgtm
/approve

likedislike
CANN-robotCANN-robotCollaborators
2 days ago Added label: approved
jiang-liruiCollaborators
2 days ago Comments:

/approve
/lgtm

likedislike
CANN-robotCANN-robotCollaborators
2 days ago Added label: lgtm
CANN-robotCANN-robotCollaborators
2 days ago Merged pull request