| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
feat: 完善 0_quickstart 示例的 CANN 环境自动探测 Co-authored-by: weixin_51634168<2082464740@qq.com> Co-authored-by: gitcode-bot<noreply@gitcode.com> # message auto-generated for no-merge-commit merge: !3672 merge master into master feat: 完善 0_quickstart 示例的 CANN 环境自动探测 Created-by: weixin_51634168 Commit-by: chenyang;gitcode-bot;weixin_51634168 Merged-by: cann-robot Description: ## 完善 0_quickstart 示例的 CANN 环境自动探测 ### 概述 在 example/0_quickstart 下继续补齐 CANN 环境自动探测能力,覆盖此前未改造的剩余示例。根据各示例对环境变量的实际需求,分别采用轻量的 example/common/resolve_cann_env.sh 或功能完整的 example/set_sample_env.sh,避免用户手动配置 ASCEND_INSTALL_PATH/SOC_VERSION/ASCENDC_CMAKE_DIR。 同时增强公共脚本 example/common/resolve_cann_env.sh 的安装路径覆盖范围,使其与 example/set_sample_env.sh 保持一致的候选目录。 ### 变更内容 #### 1. 增强 example/common/resolve_cann_env.sh 在候选路径列表中新增 ascend-toolkit/latest 布局,覆盖更多昇腾开发板与容器安装场景: - $HOME/Ascend/ascend-toolkit/latest - /usr/local/Ascend/ascend-toolkit/latest #### 2. 改造 example/0_quickstart/3_cross_version/0_runtime_compatibility/run.sh - 移除对 ASCEND_HOME_PATH 必须手动设置的硬性要求 - 复用 example/common/resolve_cann_env.sh 自动探测 ASCEND_INSTALL_PATH - 探测失败时给出清晰错误提示 #### 3. 改造 example/0_quickstart/4_custom_kernel_launch/run.sh - 该示例编译 AscendC 自定义算子,需要 ASCEND_INSTALL_PATH、SOC_VERSION、ASCENDC_CMAKE_DIR 三个变量 - 直接 source example/set_sample_env.sh 一次性完成全部环境检测 - 保留对 SOC_VERSION、ASCENDC_CMAKE_DIR 及 ascendc.cmake 存在性的校验 ### 设计思路 | 示例 | 所需环境变量 | 采用方案 | 思路 | |---|---|---|---| | 0_hello_cann | ASCEND_INSTALL_PATH | resolve_cann_env.sh | 仅需 CANN 路径,避免 set_sample_env.sh 编译 helper 的开销 | | 1_error_handling | ASCEND_INSTALL_PATH | resolve_cann_env.sh | 同上 | | 2_system_info | ASCEND_INSTALL_PATH | resolve_cann_env.sh | 同上 | | 3_cross_version/0_runtime_compatibility | ASCEND_INSTALL_PATH | resolve_cann_env.sh | 同上 | | 4_custom_kernel_launch | ASCEND_INSTALL_PATH + SOC_VERSION + ASCENDC_CMAKE_DIR | 直接 source set_sample_env.sh | 一次性完成三项检测 | ### 使用场景 - **昇腾开发板** - **容器/云服务器** - **多环境切换** --- ## 变更类型 - [ ] 🐛 Bug 修复 - [x] ✨ 新功能 - [ ] 💄 代码风格更新(格式化,局部变量) - [ ] ♻️ 重构(既不修复错误也不增加功能的代码变动) - [ ] 📦 构建过程或辅助工具的变动 - [ ] 📝 文档内容更新 ## 如何测试 ```bash cd example/0_quickstart/3_cross_version/0_runtime_compatibility ./run.sh cd example/0_quickstart/4_custom_kernel_launch ./run.sh See merge request: cann/runtime!3672 | 3 个月前 | |
fix: Reject incomplete float16 sample data Co-authored-by: aodebiao<18003961989@163.com> # message auto-generated for no-merge-commit merge: !5988 merge fix/verify-float16-byte-length-20261030 into master fix: Reject incomplete float16 sample data Created-by: gxhgxh2475698 Commit-by: aodebiao Merged-by: cann-robot Description: # Pull Request ## Description Reject incomplete float16 elements in sample result files before comparing values. ## Motivation np.fromfile silently ignores a trailing byte when reading float16 data. As a result, a three-byte output can compare equal to a valid two-byte golden file and incorrectly pass sample verification. ## Changes - Check that both file sizes are multiples of the float16 element size before reading. - Add regression cases for partial output, partial golden, both partial, and matching complete elements. ## Change Type - [x] Bug Fix - [ ] New Feature - [ ] Code Style Update - [ ] Refactoring - [ ] Build Process or Auxiliary Tool Changes - [ ] Documentation Content Update ## Associated Issues Fixes #1291 ## How to Test - python tests/ut/runtime/runtime/test/cmake/test_sample_verify_partial_float16.py: three partial-file subcases failed on the baseline; both tests pass after the fix. - git diff --check passed. No CANN/NPU execution was required for this host-side verifier. ## Checklist - [x] My code follows the project's code style - [x] I have self-tested the code - [ ] I have updated related documentation - [x] I used appropriate type labels in the title - [x] I have read the Contributing Guide and followed its regulations ## Additional Information This change affects only sample verification and its regression tests. See merge request: cann/runtime!5988 | 2 天前 |