| Files | Last commit | Last update |
|---|---|---|
docs: add full HelloWorld sample code and build/run steps Co-authored-by: liuliu876<liuxin429@huawei.com> # message auto-generated for no-merge-commit merge: !6487 merge fix_issue_1777 into master docs: add full HelloWorld sample code and build/run steps Created-by: liuliu876 Commit-by: liuliu876 Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。例如:关联Issue #xxx--> ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] 🐛 fix: Bug 修复 - [ ] ✨ feat: 新功能 - [ ] ⚡ perf: 性能优化 - [ ] ♻️ refactor: 代码重构 - [ ] 🧪 test: 新增或修改测试 - [x] 📝 docs: 文档更新 - [ ] 🔧 ci: CI/CD 配置修改 - [ ] ↩️ revert: 回退 - [ ] 🧹 chore: 其他,请具体描述 See merge request: cann/asc-devkit!6487 | 1 month ago | |
fix(python_exception_dump) correct output dump semantics in async-exception scenarios,align docs with tested behavior Co-authored-by: root<root@n101-025-010.byted.org> # message auto-generated for no-merge-commit merge: !6492 merge fix-output-semantics into master fix(python_exception_dump) correct output dump semantics in async-exception scenarios,align docs with tested behavior Created-by: s_wei Commit-by: root Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。例如:关联Issue #xxx--> ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] 🐛 fix: Bug 修复 - [ ] ✨ feat: 新功能 - [ ] ⚡ perf: 性能优化 - [ ] ♻️ refactor: 代码重构 - [ ] 🧪 test: 新增或修改测试 - [ ] 📝 docs: 文档更新 - [ ] 🔧 ci: CI/CD 配置修改 - [ ] ↩️ revert: 回退 - [ ] 🧹 chore: 其他,请具体描述 See merge request: cann/asc-devkit!6492 | 1 month ago | |
style: ruff 配置行宽 120 并关闭 magic trailing comma Co-authored-by: zhangyujia77<zhangyujia37@huawei.com> # message auto-generated for no-merge-commit merge: !6286 merge style/ruff-line-length-120 into master style: ruff 配置行宽 120 并关闭 magic trailing comma Created-by: zhangyujia77 Commit-by: zhangyujia77 Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> ruff.toml 新增两项配置并据此重排全仓 Python 代码: line-length = 120 行宽从默认 88 放宽到 120 [format] skip-magic-trailing-comma = true 忽略末尾逗号的强制展开语义 ### 为什么改 line-length ruff 的 line-length 此前**从未在仓库任何地方配置过** —— ruff.toml 只设了target-version,全仓搜 line-length 零命中,pre-commit 的 ruff hook 也没传参。 所以生效值 88 是 ruff 内置默认(沿用 Black 的约定),**不是评估过的技术决策**: $ ruff check --show-settings Settings path: ".../asc-devkit/ruff.toml" linter.line_length = 88 120 有三层依据: 1. **本仓 C++ 侧已定 120** —— .clang-format: ColumnLimit: 120。同一仓库 C++ 120、Python 88 本身不一致。 2. **CANN 生态其余 Python 仓统一为 120** —— pyasc、pypto、pto-isa、ops-test-kit、vllm-ascend(ruff),torch_npu、pytorch(flake8)。asc-devkit 是其中唯一没配的。 3. **本仓 Python 历史上事实遵守 120** —— ruff-format 落地前,非空行 P99.5 = 119,99.82% 的行 ≤ 120;超 120 的 38 行基本是嵌在 Python 里的 C++ 模板与宏定义。 88 列会把多参数调用强制拆成逐参数一行,一条语句常常变 3-5 行: python # 前(1 行) raise RuntimeError("Length of ASCENDC_TPL_UINT_{} {} is too short.".format(self.macro_type, self.name)) # 后(5 行) raise RuntimeError( "Length of ASCENDC_TPL_UINT_{} {} is too short.".format( self.macro_type, self.name ) ) ### 为什么关 magic trailing comma 末尾逗号会让 ruff-format 强制保持展开,即使该行放得下。统计范围内现存 886 处此类逗号,**绝大多数是 88 列时期 ruff 自己折行时补上的,并非作者意图** ——换到 120 列后这些调用本可收拢,却因那个自动留下的逗号继续保持展开。 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。例如:关联Issue #xxx--> ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] 🐛 fix: Bug 修复 - [ ] ✨ feat: 新功能 - [ ] ⚡ perf: 性能优化 - [ ] ♻️ refactor: 代码重构 - [ ] 🧪 test: 新增或修改测试 - [ ] 📝 docs: 文档更新 - [ ] 🔧 ci: CI/CD 配置修改 - [ ] ↩️ revert: 回退 - [x] 🧹 chore: 代码格式修改 See merge request: cann/asc-devkit!6286 | 1 month ago | |
修文档中废弃接口及原子操作相关错误描述 Co-authored-by: g00954335<guorenjie3@huawei.com> # message auto-generated for no-merge-commit merge: !6493 merge 2026_09_29_new_fix-agent-scanned-docs-examples-issues into master 修文档中废弃接口及原子操作相关错误描述 Created-by: GRJ_XIDUO Commit-by: g00954335 Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> 分支文档中已废弃或不存在接口的错误使用: - 删除中英文API选型、C API贡献指南和代码风格文档中关于 _sync同步接口的失效说明及示例。 - 将Reg矢量计算示例中的MASK_PATTERN_ALL、asc_adds和asc_muls替换为当前有效的PAT_ALL、asc_add_scalar和asc_mul_scalar。 - 修正C API贡献指南中的接口声明路径和调用模式说明。 修复原子操作分类和样例支持范围: - 将SetStoreAtomicConfig、GetStoreAtomicConfig及对应C API归入标量原子操作,并补充标量原子操作与数据搬运随路原子操作的差异。 - 补充set_atomic_deterministic_computation样例对Ascend 950PR/Ascend 950DT的支持说明。 修复data_copy_gm2l1中英文样例文档,将错误的asc_set_l0c2gm_config和quant_pre更正为样例实际使用的asc_set_l0c_copy_config和 quant_pre_addr。 ## 关联的Issue https://gitcode.com/cann/asc-devkit/issues/1812 ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] 🐛 fix: Bug 修复 - [ ] ✨ feat: 新功能 - [ ] ⚡ perf: 性能优化 - [ ] ♻️ refactor: 代码重构 - [ ] 🧪 test: 新增或修改测试 - [x] 📝 docs: 文档更新 - [ ] 🔧 ci: CI/CD 配置修改 - [ ] ↩️ revert: 回退 - [ ] 🧹 chore: 其他,请具体描述 See merge request: cann/asc-devkit!6493 | 1 month ago | |
修复部分样例非法越界读取问题 Co-authored-by: ca1kw<caikaiwei@huawei.com> # message auto-generated for no-merge-commit merge: !6424 merge issue into master 修复部分样例非法越界读取问题 Created-by: ca1kw Commit-by: ca1kw Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> 本 PR 修复两个 matmul 样例在 mssanitizer(Atlas 950PR / CANN 9.1.0)下报出的内存问题: **一、matmul_a2b2_share(Issue #1672,原报 603 处错误)** 根因与修复: 1. **GM 非法读写(memcheck 210 处)——示例缺少尾核 SetTail 处理**:tiling 中 singleCoreM=285(ceil(7680/27)),尾核 aic(26) 实际仅剩 270 行,但库按 285 行调度,导致 copy_cube_in 读越过 A 缓冲尾部、copy_cube_out 写越过 C 缓冲尾部(仅最后一个核、与 A2B2 共享模式无关,isA2B2Shared=false 同样存在)。按 SetTail 接口文档及官方 matmul 样例的尾块处理模式,在 Init 中记录 M/N 方向核索引,Process 中计算 tailM/tailN/tailK 并调用 SetTail。 **二、matmul_callback(Issue #1678,原报 129 处 illegal read of size 256)** 根因:SetValue 仅写核内 write-back DCache 不立即落 GM(官方 SetValue 文档明确),且 offset list 中每核仅占 2×uint64=16B,20 个核共写同 5 条 Cache Line,DCache 写回时后写回的整行(含其他核 slot 的旧值 0)覆盖先写回的值;回调 CustomDataCopyInA 中 GetValue 读到 0,DataCopy 从 GM 0x0 非法搬读 128 行。 修复(按 DataCacheCleanAndInvalid 文档"示例 1"的正确用法): 1. offset list 布局改为**每核独占一条 64B Cache Line**(每核 8×uint64,容量 50→168,gen_data.py 同步调整); 2. SetValue 后调用 DataCacheCleanAndInvalid<SINGLE_CACHE_LINE, CACHELINE_OUT> 将本核 cache line 立即刷出至 GM。 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。例如:关联Issue #xxx--> https://gitcode.com/cann/asc-devkit/issues/1672 https://gitcode.com/cann/asc-devkit/issues/1678 ## 测试 <!--描述进行了哪些测试来验证您的改动。包括但不限于二级冒烟、算子泛化等。--> 测试环境:Atlas 950PR 实机 + CANN 9.1.0 + devkit 9.1.0 分支等价组合,--cce-enable-sanitizer 编译: | 样例 | 检查项 | 修复前 | 修复后 | |---|---|---|---| | matmul_a2b2_share | memcheck(GM 非法读写) | 210 | **0** | | matmul_a2b2_share | initcheck(GM 未初始化读) | 150 | **0** | | matmul_a2b2_share | initcheck(tbuf_pool 站点 PRIVATE 报错) | 162 | **0**(gA2B2DBFlag_ 改类成员后符号从设备 ELF 消失) | | matmul_callback | memcheck(GM 非法读) | 128 | **0**(连续多次复跑稳定,无失败核漂移) | | 两样例 | verify_result.py 精度校验 | pass | **pass**(误差率 0.0000,容差 0.0010) | | 01_separate_compile | 分离编译(-dc)构建 | — | **通过**(类成员方案不涉及 block-local 语法,不破坏分离编译) | 回归验证:普通 matmul 样例、add 样例错误数无恶化,精度均通过;gA2B2DBFlag_ 成员化后 a2b2_share 精度复验通过(两 matmul 对象乒乓独立、事件状态机不受影响)。 ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> 无。修复方式均遵循现有公开文档约定(SetTail、DataCacheCleanAndInvalid)。 ## 类型标签 <!-- [x] 表示选中 --> - [x] 🐛 fix: Bug 修复 - [ ] ✨ feat: 新功能 - [ ] ⚡ perf: 性能优化 - [ ] ♻️ refactor: 代码重构 - [ ] 🧪 test: 新增或修改测试 - [ ] 📝 docs: 文档更新 - [ ] 🔧 ci: CI/CD 配置修改 - [ ] ↩️ revert: 回退 - [ ] 🧹 chore: 其他,请具体描述 See merge request: cann/asc-devkit!6424 | 1 month ago | |
hifloat8 operator Co-authored-by: lijunjie147<lijunjie147@huawei.com> # message auto-generated for no-merge-commit merge: !6016 merge hif8 into master hifloat8 operator Created-by: lijunjie147 Commit-by: lijunjie147 Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> 新增hif8数据类型算子实践文档。 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。例如:关联Issue #xxx--> ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] 🐛 fix: Bug 修复 - [ ] ✨ feat: 新功能 - [ ] ⚡ perf: 性能优化 - [ ] ♻️ refactor: 代码重构 - [ ] 🧪 test: 新增或修改测试 - [x] 📝 docs: 文档更新 - [ ] 🔧 ci: CI/CD 配置修改 - [ ] ↩️ revert: 回退 - [ ] 🧹 chore: 其他,请具体描述 See merge request: cann/asc-devkit!6016 | 1 month ago | |
bug fix: matmul_s4 Co-authored-by: chen_xu0513<chenxu210@huawei.com> # message auto-generated for no-merge-commit merge: !6302 merge issues into master bug fix: matmul_s4 Created-by: chen_xu0513 Commit-by: chen_xu0513 Merged-by: cann-robot Description: ## 描述 解决matmul_s4样例的两个问题: 1.两个 AIV 核(aiv-0 / aiv-1)执行完全相同的冗余解压。增加if分支判断,多核分别处理解压<!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> 2.跨核同步应覆盖全部 AIV:使用 CrossCoreSetFlag/CrossCoreWaitFlag 时应保证 AIC 能感知到所有 AIV 的完成信号。增加CrossCoreWaitFlag<4, PIPE_MTE2>(24)等待AIV1 ## 关联的Issue 关联Issue [#1723](https://gitcode.com/cann/asc-devkit/issues/1723)<!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。例如:关联Issue #xxx--> ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [x] 🐛 fix: Bug 修复 - [ ] ✨ feat: 新功能 - [ ] ⚡ perf: 性能优化 - [ ] ♻️ refactor: 代码重构 - [ ] 🧪 test: 新增或修改测试 - [ ] 📝 docs: 文档更新 - [ ] 🔧 ci: CI/CD 配置修改 - [ ] ↩️ revert: 回退 - [ ] 🧹 chore: 其他,请具体描述 See merge request: cann/asc-devkit!6302 | 1 month ago | |
feat(tensor_api): add composite and histogram compute APIs Co-authored-by: wyn<18392629693@163.com> # message auto-generated for no-merge-commit merge: !5986 merge feat/tensor-api-composite-histogram-master into master feat(tensor_api): add composite and histogram compute APIs Created-by: wyn6661 Commit-by: wyn Merged-by: cann-robot Description: ## 描述 补充 Tensor API 寄存器向量的复合计算与直方图接口: - 新增 6 个复合计算 Tensor API: abs_diff、axpy、exp_diff、madd、mula、muls_cast。 - 新增直方图 Tensor API:histograms。 - 新增 abs_diff 和 histograms 样例。 - 补充对应接口文档及文档目录。 ## 关联的Issue [Requirement|需求建议]: TensorAPI支持Vector编程:https://gitcode.com/cann/asc-devkit/issues/1316 ## 测试 自验通过 ## 文档更新 新增复合计算和直方图 Tensor API 接口文档,并补充样例 README 与文档目录。 ## 类型标签 <!-- [x] 表示选中 --> - [ ] 🐛 fix: Bug 修复 - [x] ✨ feat: 新功能 - [ ] ⚡ perf: 性能优化 - [ ] ♻️ refactor: 代码重构 - [ ] 🧪 test: 新增或修改测试 - [x] 📝 docs: 文档更新 - [ ] 🔧 ci: CI/CD 配置修改 - [ ] ↩️ revert: 回退 - [ ] 🧹 chore: 其他,请具体描述 See merge request: cann/asc-devkit!5986 | 1 month ago | |
example_tensor_api_snake Co-authored-by: watermelon_milk<NSvQ5oaBy439Dy3ewqp32tDq> # message auto-generated for no-merge-commit merge: !5071 merge tensor_snake into master example_tensor_api_snake Created-by: watermelon_milk Commit-by: watermelon_milk Merged-by: cann-robot Description: ## 描述 example样例切换snake风格 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。例如:关联Issue #xxx--> ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] 🐛 fix: Bug 修复 - [x] ✨ feat: 新功能 - [ ] ⚡ perf: 性能优化 - [ ] ♻️ refactor: 代码重构 - [ ] 🧪 test: 新增或修改测试 - [ ] 📝 docs: 文档更新 - [ ] 🔧 ci: CI/CD 配置修改 - [ ] ↩️ revert: 回退 - [ ] 🧹 chore: 其他,请具体描述 See merge request: cann/asc-devkit!5071 | 2 months ago | |
example_tensor_api_snake Co-authored-by: watermelon_milk<NSvQ5oaBy439Dy3ewqp32tDq> # message auto-generated for no-merge-commit merge: !5071 merge tensor_snake into master example_tensor_api_snake Created-by: watermelon_milk Commit-by: watermelon_milk Merged-by: cann-robot Description: ## 描述 example样例切换snake风格 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。例如:关联Issue #xxx--> ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] 🐛 fix: Bug 修复 - [x] ✨ feat: 新功能 - [ ] ⚡ perf: 性能优化 - [ ] ♻️ refactor: 代码重构 - [ ] 🧪 test: 新增或修改测试 - [ ] 📝 docs: 文档更新 - [ ] 🔧 ci: CI/CD 配置修改 - [ ] ↩️ revert: 回退 - [ ] 🧹 chore: 其他,请具体描述 See merge request: cann/asc-devkit!5071 | 2 months ago |
Sample List
| Directory Name | Description |
|---|---|
| 00_introduction | Simple examples based on Ascend C, implementing custom functions through Ascend C programming language, with corresponding <<<>>> direct invocation implementations |
| 01_utilities | Simple examples based on Ascend C, introducing system tool usage methods such as on-board printing, exception detection, and CPU twin debugging through APIs like printf, assert, and DumpTensor, suitable for debugging phases |
| 02_features | Feature examples based on Ascend C, introducing features such as Aclnn (ge graph entry) projects, LocalMemAllocator, and separate memory allocation for Barrier |
| 03_basic_api | Basic API examples based on Ascend C, introducing usage methods of basic APIs such as data movement and computation |
| 04_advanced_api | Usage examples based on Ascend C API libraries, introducing API libraries such as math libraries and activation functions through <<<>>> direct invocation implementations |
| 05_best_practices | Performance optimization practices based on Ascend C, focusing on key compute and memory access tuning, aimed at improving runtime efficiency on Ascend platforms |
| 06_compatibility_guide | Compatibility examples for incompatible features |
| 07_tensor_api | Tensor API programming samples covering data movement, matrix computation, convolution, and high-performance matrix multiplication practices |