| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
【PR】: 新增 Context 作用域确定性配置样例 Co-authored-by: 2403_89963296<2540257541@qq.com> # message auto-generated for no-merge-commit merge: !5024 merge example/1_basic_features/context/1_context_scoped_determinism into master 【PR】: 新增 Context 作用域确定性配置样例 Created-by: 2403_89963296 Commit-by: 2403_89963296 Merged-by: cann-robot Description: # Pull Request ## 描述 新增 example/1_basic_features/context/1_context_scoped_determinism 单 Device 样例。 样例观察 aclrtSetDevice 前后默认 Context 的激活状态,保存并恢复进程级确定性配置,并为两个显式 Context 分别设置不同的确定性计算模式。通过切换 Context 后重新读取配置,验证 Context 级参数相互隔离。 同时新增中英文使用文档、CMake 构建配置和运行脚本,并更新 Context 样例导航。 ## 变更类型 - [ ] 🐛 Bug 修复 - [x] ✨ 新功能 - [ ] 💄 代码风格更新(格式化,局部变量) - [ ] ♻️ 重构(既不修复错误也不增加功能的代码变动) - [ ] 📦 构建过程或辅助工具的变动 - [x] 📝 文档内容更新 ## 如何测试 1. 加载 CANN 环境并进入样例目录。 2. 执行 bash run.sh。 3. 确认默认 Context 状态按预期变化。 4. 确认 Context A、Context B 的配置分别保持为 1 和 0。 5. 确认进程级配置已恢复,并输出样例执行成功标记。 测试结果: - CMake 配置及编译通过。 - Ascend 环境实机运行通过。 - clang-format 和 OAT pre-commit 检查通过。 - git diff --check 与 bash -n 检查通过。 ## 核对清单 - [x] 我的代码遵循了项目的代码风格 - [x] 我已对代码进行了自测 - [x] 我已更新了相关的文档 - [x] 我在标题中使用了合适的类型标签 - [x] 我已经详细阅读了贡献指南,并遵守其中的规定 ## 其他信息 配置读回用于验证 Context 作用域隔离和配置生效,不表示任意算子在对应配置下都具备确定性。 See merge request: cann/runtime!5024 | 8 天前 | |
【PR】: 新增基于设备能力的计数汇总样例 Co-authored-by: 2403_89963296<2540257541@qq.com> # message auto-generated for no-merge-commit merge: !5020 merge example/1_basic_features/device/4_capability_based_aggregation into master 【PR】: 新增基于设备能力的计数汇总样例 Created-by: 2403_89963296 Commit-by: 2403_89963296 Merged-by: cann-robot Description: # Pull Request ## 描述 新增 example/1_basic_features/device/4_capability_based_aggregation 单 Device 样例。样例校验物理设备 ID 到用户可见设备 ID 再到物理设备 ID 的往返映射,使用 Vector Core 数量确定 Kernel 并行度,并根据 Host/Device 有符号 32 位原子加能力选择映射 Host 内存直接原子汇总或 Device 分块结果加 Host 汇总路径。 样例对 1024 条确定性输入的 8 类计数逐项比对 CPU 参考结果,并补充中英文 README、构建运行脚本及 Device 主题导航。 ## 变更类型 - [ ] 🐛 Bug 修复 - [x] ✨ 新功能 - [ ] 💄 代码风格更新(格式化,局部变量) - [ ] ♻️ 重构(既不修复错误也不增加功能的代码变动) - [ ] 📦 构建过程或辅助工具的变动 - [x] 📝 文档内容更新 ## 如何测试 1. 加载 CANN 和样例环境并运行指定物理 Device: bash source /home/developer/Ascend/cann/set_env.sh source /mnt/workspace/runtime/example/set_sample_env.sh cd example/1_basic_features/device/4_capability_based_aggregation bash run.sh 10 Ascend910_9362 实机结果:物理 ID 10 -> 0 -> 10 往返校验成功;查询到 40 个 Vector Core;Host/Device DMA_ADD 能力为 0x0,选择 Device 分块结果加 Host 汇总路径;8 类统计结果全部与 CPU 参考值一致。 2. 使用 SOC_VERSION=Ascend950PR_9599 完成交叉编译,构建成功。 3. 对本次 9 个变更文件执行 pre-commit run --show-diff-on-failure --files ...,clang-format 和 OAT 检查通过;bash -n 与 git diff --check 通过。 ## 核对清单 - [x] 我的代码遵循了项目的代码风格 - [x] 我已对代码进行了自测 - [x] 我已更新了相关的文档 - [x] 我在标题中使用了合适的类型标签(如:feat:, fix:) - [x] 我已经详细阅读了贡献指南(CONTRIBUTING.md),并遵守了其中的所有规定,包括但不限于commit message的格式、无效commit的合并等 ## 其他信息 当前实机的 Host/Device 有符号 32 位原子加能力掩码为 0x0,因此实机验证覆盖了 Device 分块结果加 Host 汇总路径。映射 Host 内存直接原子汇总路径已通过 Ascend950PR_9599 编译验证,尚未在具备对应原子能力的设备上运行。 See merge request: cann/runtime!5020 | 8 天前 | |
【PR】: 新增算子与跨流 Event 分层超时控制样例 Co-authored-by: 2403_89963296<2540257541@qq.com> # message auto-generated for no-merge-commit merge: !5025 merge example/1_basic_features/event/3_bounded_cross_stream_execution into master 【PR】: 新增算子与跨流 Event 分层超时控制样例 Created-by: 2403_89963296 Commit-by: 2403_89963296 Merged-by: cann-robot Description: # Pull Request ## 描述 新增 3_bounded_cross_stream_execution 单 Device 样例,演示应用如何组合算子执行超时、跨 Stream Event 等待超时和 Device 同步超时,并通过实际数据结果验证任务依赖。 - 覆盖 aclrtGetOpTimeOutInterval、aclrtSetOpExecuteTimeOut、aclrtSetOpExecuteTimeOutV2、aclrtGetOpExecuteTimeout、aclrtSetOpWaitTimeout 和 aclrtSynchronizeDeviceWithTimeout。 - 读取硬件算子超时时间粒度,设置秒级超时并回读硬件实际值。 - 设置非粒度整数倍的微秒超时,验证硬件向上对齐后的实际生效值。 - 为消费者 Stream 的 Event Wait 任务设置 5 秒等待预算。 - 提交生产者 Host 到 Device 异步复制和消费者 Device 到 Host 异步复制,在 5000 毫秒内完成 Device 同步。 - 逐项比较 256 个输入输出值,验证跨 Stream Event 依赖正确执行。 - 补充中英文样例文档、构建运行脚本以及 Event 主题中英文导航。 ## 变更类型 - [ ] 🐛 Bug 修复 - [x] ✨ 新功能 - [ ] 💄 代码风格更新(格式化,局部变量) - [ ] ♻️ 重构(既不修复错误也不增加功能的代码变动) - [ ] 📦 构建过程或辅助工具的变动 - [x] 📝 文档内容更新 ## 如何测试 1. 在环境加载 CANN 和样例编译环境: bash source ${install_root}/cann/set_env.sh source ${git_clone_path}/example/set_sample_env.sh 2. 构建并运行样例: bash cd ${git_clone_path}/example/1_basic_features/event/3_bounded_cross_stream_execution bash run.sh 3. 检查运行结果: text [INFO] Hardware operation timeout interval: 4294967 us. [INFO] Second-level request: 1 s; hardware readback: 4295 ms. [INFO] Microsecond request: 4294968 us; actual: 8589934 us. [INFO] Event wait budget: 5 s. [INFO] Device synchronized within 5000 ms. [INFO] Verified 256 values transferred across the Event dependency. [INFO] [SUCCESS] Bounded cross-Stream execution sample completed successfully. [SUCCESS] Bounded cross-Stream execution sample executed successfully. 验证环境: - CANN:9.2.0-weekly.20260909.01 - Device:Ascend910_9362(Atlas A2) - pre-commit:clang-format、OAT 均通过 - 脚本语法、差异空白检查、CMake 构建和 Device 运行均通过 ## 核对清单 - [x] 我的代码遵循了项目的代码风格 - [x] 我已对代码进行了自测 - [x] 我已更新了相关的文档 - [x] 我在标题中使用了合适的类型标签(如:feat:, fix:) - [x] 我已经详细阅读了贡献指南(CONTRIBUTING.md),并遵守了其中的所有规定,包括但不限于commit message的格式、无效commit的合并等 ## 其他信息 - 关键 API 的产品支持范围交集为 Atlas A2、Atlas A3 和 Ascend 950PR/Ascend 950DT。 - 6 个目标 API 均已纳入样例,没有未覆盖接口。 - 本次仅新增编号样例并更新直属 Event 主题导航,不修改已有可运行样例或共享辅助代码。 See merge request: cann/runtime!5025 | 8 天前 | |
【PR】: 新增批量张量 Host/Device 往返传输样例 Co-authored-by: 2403_89963296<2540257541@qq.com> # message auto-generated for no-merge-commit merge: !5047 merge example/1_basic_features/memory/15_batch_tensor_round_trip into master 【PR】: 新增批量张量 Host/Device 往返传输样例 Created-by: 2403_89963296 Commit-by: 2403_89963296 Merged-by: cann-robot Description: # Pull Request ## 描述 新增 15_batch_tensor_round_trip 样例,演示同一组小张量在四种批量复制模式下完成 Host/Device 往返传输。 主要变更: - 覆盖 aclrtMemcpyBatch、aclrtMemcpyBatchV2、 aclrtMemcpyBatchAsync 和 aclrtMemcpyBatchAsyncV2。 - 每种模式分别执行 H2D 和 D2H。 - 使用锁页 Host 内存保证异步复制语义。 - 逐张量、逐元素校验复制结果。 - 验证旧版接口的 failIndex,并展示 V2 接口无 failIndex 输出参数的差异。 - 新增中英文 README、构建运行脚本,并更新 memory 主题导航。 ## 变更类型 - [ ] 🐛 Bug 修复 - [x] ✨ 新功能 - [ ] 💄 代码风格更新(格式化,局部变量) - [ ] ♻️ 重构(既不修复错误也不增加功能的代码变动) - [ ] 📦 构建过程或辅助工具的变动 - [x] 📝 文档内容更新 ## 如何测试 1. 加载 CANN 和 Runtime 样例环境。 2. 进入 example/1_basic_features/memory/15_batch_tensor_round_trip。 3. 执行 bash run.sh。 测试结果: - CANN 9.3.0、Ascend910_9362 环境编译运行成功。 - 四种批量复制模式均执行成功。 - 4、7、11 元素的三个张量均通过逐元素校验。 - 旧版同步和异步接口的 H2D、D2H failIndex 均为 SIZE_MAX。 - pre-commit、clang-format、OAT hook、bash -n 和 git diff --check 均通过。 ## 核对清单 - [x] 我的代码遵循了项目的代码风格 - [x] 我已对代码进行了自测 - [x] 我已更新了相关的文档 - [x] 我在标题中使用了合适的类型标签(如:feat:, fix:) - [x] 我已经详细阅读了贡献指南(CONTRIBUTING.md),并遵守了其中的所有规定,包括但不限于commit message的格式、无效commit的合并等 ## 其他信息 样例编号使用 15,避免与另一pr的 14_reusable_data_buffer 发生目录冲突。 See merge request: cann/runtime!5047 | 5 天前 | |
【PR】: 新增 Stream 资源预算与线程绑定样例 Co-authored-by: 2403_89963296<2540257541@qq.com> # message auto-generated for no-merge-commit merge: !4923 merge example/1_basic_features/stream/4_stream_resource_budget into master 【PR】: 新增 Stream 资源预算与线程绑定样例 Created-by: 2403_89963296 Commit-by: 2403_89963296 Merged-by: cann-robot Description: # Pull Request ## 描述 新增 Stream 资源预算与线程绑定样例 example/1_basic_features/stream/4_stream_resource_budget。 样例演示查询 Stream 可用数量,设置、查询和重置 Vector Core 资源上限,将 Stream 资源配置绑定到当前线程,并在限定资源下执行最小 Kernel。通过配置回读、Kernel 输出和重置结果完成闭环校验。 同步新增中英文 README、CMakeLists.txt、run.sh,并更新 Stream 主题中英文导航。 ## 变更类型 - [ ] 🐛 Bug 修复 - [x] ✨ 新功能 - [ ] 💄 代码风格更新(格式化,局部变量) - [ ] ♻️ 重构(既不修复错误也不增加功能的代码变动) - [ ] 📦 构建过程或辅助工具的变动 - [x] 📝 文档内容更新 ## 如何测试 1. 配置并运行样例: source /home/developer/Ascend/cann/set_env.sh source /mnt/workspace/runtime/example/set_sample_env.sh bash example/1_basic_features/stream/4_stream_resource_budget/run.sh 2. 确认输出包含以下结果: - Stream 可用数量由 1982 变为 1981。 - Vector Core 资源上限由默认值 40 设置为 1。 - Kernel 输出为 42,与预期一致。 - 解除线程绑定后,资源上限重置为默认值 40。 - 输出 [SUCCESS] Stream resource budget sample executed successfully.。 ## 核对清单 - [x] 我的代码遵循了项目的代码风格 - [x] 我已对代码进行了自测 - [x] 我已更新了相关的文档 - [x] 我在标题中使用了合适的类型标签(如:feat:, fix:) - [x] 我已经详细阅读了贡献指南(CONTRIBUTING.md),并遵守了其中的所有规定,包括但不限于commit message的格式、无效commit的合并等 ## 其他信息 - 验证环境:SOC_VERSION=Ascend910_9362 - 本地样例编译、运行和结果校验均通过。 - 支持 Ascend 950PR/950DT、Atlas A3 和 Atlas A2 系列产品。 See merge request: cann/runtime!4923 | 11 天前 | |
优化example示例中 产品支持情况 描述 Co-authored-by: qiang_zq<qiang.zhangqiang@huawei.com> # message auto-generated for no-merge-commit merge: !1276 merge sample into master 优化example示例中 产品支持情况 描述 Created-by: qiang_zq Commit-by: qiang_zq Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> 1、补充部分新增example示例 readme 缺少的“产品支持情况”描述 2、历史example示例 readme 中“产品支持情况”与docs中API描述不一致 3、优化example样例执行步骤,run.sh中编译完成后自动执行,将原来编译+运行 2步操作 合为一步 4、目录 README 补全: 为 device、stream、event、memory、kernel、callback、model_ri、notify、tdt_buffer、tdt_channel、tdt_queue、built_in_task 等目录新增了 README.md,改善了导航体验 5、链接路径修正: 修正了嵌套目录的相对路径(从 ../../README.md 改为 ../../../README.md) 代码审查报告 https://gitcode.com/cann/runtime/pull/1276?ref=&did=65e24693459e9d96f1d4ad02bef022d0968fba55#tid-166839878 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。例如:关联Issue #000--> https://gitcode.com/cann/runtime/issues/299 ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> /example/0_quickstart/0_hello_cann$ bash run.sh Configuring CMake... -- The C compiler identification is GNU 13.3.0 -- The CXX compiler identification is GNU 13.3.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring done -- Generating done -- Build files have been written to: /mnt/workspace/gitCode/qiang_zq/runtime/example/0_quickstart/0_hello_cann/build Building... [ 50%] Building CXX object CMakeFiles/main.dir/main.cpp.o [100%] Linking CXX executable main [100%] Built target main Build completed successfully! Executable location: /mnt/workspace/gitCode/qiang_zq/runtime/example/0_quickstart/0_hello_cann/build/main Run the sample: ./build/main ACL init successfully Set device 0 successfully Create stream successfully Input vectors: self: [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0] other: [0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0] alpha: 1.0 Create output aclDataBuffer successfully, buffer addr = 0x12c0c0016000 Get workspace size successfully, workspace size = 0 [Warning]: tiling struct [ReduceOpTilingDataV2] is conflict with one in file kl_div_v2.cc, line 41 [Warning]: tiling struct [RepeatInterleaveGradTilingData] is conflict with one in file repeat_interleave_grad_tiling.h, line 21 [Warning]: tiling struct [IndexFillTilingData] is conflict with one in file index_fill_tiling.h, line 21 [Warning]: tiling struct [MapIndexTilingData] is conflict with one in file map_index_tiling_arch35.h, line 23 [Warning]: tiling struct [MaskedSelectV3TilingData] is conflict with one in file masked_select_v3_tiling.h, line 27 [Warning]: tiling struct [MaskedSelectV3TilingData] is conflict with one in file masked_select_v3_tiling.h, line 27 [Warning]: tiling struct [ScatterPaKvCacheTilingData] is conflict with one in file scatter_pa_kv_cache_tiling.h, line 35 [Warning]: tiling struct [ScatterPaKvCacheTilingData] is conflict with one in file scatter_pa_kv_cache_tiling.h, line 35 [Warning]: tiling struct [TopKTopPSampleTilingData] is conflict with one in file top_k_top_p_sample_tiling.h, line 26 [Warning]: tiling struct [AvgPool3dGradTilingBlockParam] is conflict with one in file avg_pool_3d_grad_tiling.h, line 99 [Warning]: tiling struct [AvgPool3dGradTilingParam] is conflict with one in file avg_pool_3d_grad_tiling.h, line 125 [Warning]: tiling struct [FusedCrossEntropyLossWithMaxSumTilingData] is conflict with one in file fused_cross_entropy_loss_with_max_sum_tiling.h, line 27 [Warning]: tiling struct [TilingDataBackgroundReplace] is conflict with one in file background_replace_tiling.h, line 22 [Warning]: tiling struct [TilingDataBlendImages] is conflict with one in file blend_images_custom_tiling.h, line 24 Launch aclnnAdd successfully Synchronize stream successfully Vector addition result: result[0] = 1.5 (expected: 1.5) result[1] = 3.0 (expected: 3.0) result[2] = 4.5 (expected: 4.5) result[3] = 6.0 (expected: 6.0) result[4] = 7.5 (expected: 7.5) result[5] = 9.0 (expected: 9.0) result[6] = 10.5 (expected: 10.5) result[7] = 12.0 (expected: 12.0) Free device memory successfully Destroy stream successfully Reset device successfully ACL finalize successfully Sample run successfully! /example/0_quickstart/1_error_handling$ bash run.sh Configuring CMake... -- The C compiler identification is GNU 13.3.0 -- The CXX compiler identification is GNU 13.3.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring done -- Generating done -- Build files have been written to: /mnt/workspace/gitCode/qiang_zq/runtime/example/0_quickstart/1_error_handling/build Building... [ 50%] Building CXX object CMakeFiles/main.dir/main.cpp.o [100%] Linking CXX executable main [100%] Built target main Build completed successfully! Executable location: /mnt/workspace/gitCode/qiang_zq/runtime/example/0_quickstart/1_error_handling/build/main Run the sample: ./build/main [INFO] ACL init and set device successfully [INFO] Current run mode: ACL_HOST [INFO] Triggering an expected invalid-parameter error with aclrtGetRunMode(nullptr) [ERROR] Diagnostics: ret=100000, peekErr=0, lastErr=0, recentErrMsg=[PID: 2238268] 2026-03-30-14:54:54.405.703 Invalid_Argument_Null_Pointer(EH0002): Argument [runMode] must not be null. Solution: Try again with a correct pointer argument. [WARN] aclrtGetErrorVerbose(0) returned error code 207000 [INFO] After diagnostics are consumed once: peekErr=207000, lastErr=207000, recentErrMsg=<null> [INFO] ACL finalize successfully ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> example/0_quickstart/1_error_handling/README.md example/1_basic_features/device/0_device_normal/README.md .... example/*/README.md ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [x] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: See merge request: cann/runtime!1276 | 5 个月前 | |
【PR】: Add English md files Co-authored-by: ycm0028<yechengmei@huawei.com> Co-authored-by: gitcode-bot<noreply@gitcode.com> # message auto-generated for no-merge-commit merge: !2990 merge master into master 【PR】: Add English md files Created-by: ycm0028 Commit-by: ycm0028;gitcode-bot Merged-by: cann-robot Description: # Pull Request ## 描述 Add English md files ## 变更类型 请选择本次引入的变更类型: <!-- [x] 表示选中 --> - [ ] 🐛 Bug 修复 - [ ] ✨ 新功能 - [ ] 💄 代码风格更新(格式化,局部变量) - [ ] ♻️ 重构(既不修复错误也不增加功能的代码变动) - [ ] 📦 构建过程或辅助工具的变动 - [.x] 📝 文档内容更新 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在当前页面的右侧'关联Issue'部分添加相应Issue链接,并勾选'合并后关闭已关联的 Issue'选项。 --> ## 如何测试 The English md files have been checked. ## 核对清单 <!-- [x] 表示选中 --> - [ ] 我的代码遵循了项目的代码风格 - [ ] 我已对代码进行了自测 - [ x] 我已更新了相关的文档 - [ ] 我在标题中使用了合适的类型标签(如: feat:, fix:) - [ ] 我已经详细阅读了贡献指南(CONTRIBUTING.md),并遵守了其中的所有规定,包括但不限于commit message的格式、无效commit的合并等 ## 其他信息 在此添加任何其他关于本次 PR 的说明。 See merge request: cann/runtime!2990 | 3 个月前 |