Pull Request已成功合入, 合并人@CANN-robot
(感谢 zhangshunwei2 的贡献)变更摘要
此 PR 主要涉及两项改动:一是在混合编程的 integer fast div 样例中移除 C++ 风格接口调用(AscendC::GetBlockIdx()),使代码风格与项目规范保持一致;二是将 SIMT 编程样例的支持版本更新为 9.1.0。整体变更规模较小,涉及 31 个文件,均为删除或修改单行内容。
主要改动
- 移除
AscendC::GetBlockIdx()C++ 风格接口: 在integer_div.asc中删除了uint32_t block_idx = AscendC::GetBlockIdx();这一行,去除对 C++ 风格 API 的调用,使样例代码更符合纯 C 风格的编程规范。 - SIMT 编程样例支持版本更新: 将 SIMT 编程相关样例的支持版本号修改为 9.1.0(具体涉及文件中版本号字符串的替换)。


代码审查
所有文件已审查完毕。以下是汇总:
审查总结
审查覆盖(31 个变更文件)
| 文件 | 状态 |
|---|---|
examples/03_simt_api/00_introduction/00_quickstart/hello_world_simt/README.md |
无问题 |
examples/03_simt_api/00_introduction/00_quickstart/hello_world_simt/README_en.md |
无问题 |
examples/03_simt_api/01_utilities/00_printf/README.md |
无问题 |
examples/03_simt_api/01_utilities/00_printf/README_en.md |
无问题 |
examples/03_simt_api/01_utilities/01_assert/README.md |
无问题 |
examples/03_simt_api/01_utilities/01_assert/README_en.md |
无问题 |
examples/03_simt_api/01_utilities/02_clock/README.md |
无问题 |
examples/03_simt_api/01_utilities/02_clock/README_en.md |
无问题 |
examples/03_simt_api/02_features/00_framework/00_pytorch/torch_library_roll/README.md |
无问题 |
examples/03_simt_api/02_features/00_framework/00_pytorch/torch_library_roll/README_en.md |
无问题 |
examples/03_simt_api/02_features/01_api_features/00_memory_access/insert_hash_table/README.md |
无问题 |
examples/03_simt_api/02_features/01_api_features/00_memory_access/insert_hash_table/README_en.md |
无问题 |
examples/03_simt_api/02_features/01_api_features/01_sync_instruction/memory_fence/README.md |
无问题 |
examples/03_simt_api/02_features/01_api_features/01_sync_instruction/memory_fence/README_en.md |
无问题 |
examples/03_simt_api/02_features/01_api_features/02_atomic_operation/histogram/README.md |
无问题 |
examples/03_simt_api/02_features/01_api_features/02_atomic_operation/histogram/README_en.md |
无问题 |
examples/03_simt_api/02_features/06_compile/00_basic_compile/README.md |
无问题 |
examples/03_simt_api/02_features/06_compile/00_basic_compile/README_en.md |
无问题 |
examples/03_simt_api/02_features/06_compile/01_separate_compile/README.md |
无问题 |
examples/03_simt_api/02_features/06_compile/01_separate_compile/README_en.md |
无问题 |
examples/03_simt_api/02_features/06_compile/02_dynamic_library_compile/README.md |
无问题 |
examples/03_simt_api/02_features/06_compile/02_dynamic_library_compile/README_en.md |
无问题 |
examples/03_simt_api/02_features/06_compile/03_static_library_compile/README.md |
无问题 |
examples/03_simt_api/02_features/06_compile/03_static_library_compile/README_en.md |
无问题 |
examples/03_simt_api/03_best_practices/00_memory_optimizations/aligned_types/README.md |
无问题 |
examples/03_simt_api/03_best_practices/00_memory_optimizations/aligned_types/README_en.md |
无问题 |
examples/03_simt_api/03_best_practices/00_memory_optimizations/cache_hint/README.md |
无问题 |
examples/03_simt_api/03_best_practices/00_memory_optimizations/cache_hint/README_en.md |
无问题 |
examples/03_simt_api/03_best_practices/00_memory_optimizations/short_vector_add/README.md |
无问题 |
examples/03_simt_api/03_best_practices/00_memory_optimizations/short_vector_add/README_en.md |
无问题 |
examples/05_simd_simt_hybrid/02_best_practices/simd_simt_integer_fast_div/integer_div.asc |
P0: 编译错误 |
按优先级统计
- P0: 1
- P1: 0
- P2: 0
- P3: 0
整体风险评估
高风险。integer_div.asc 中删除了 block_idx 的声明行但未补充 C 风格替代写法,导致变量 block_idx 未定义,该文件无法通过编译。30 个 SIMT README 的版本号更新(9.0.0 → 9.1.0)均无问题。建议在合入前补上 asc_get_block_idx() 或 get_block_idx() 调用。
| 类型 | 数量 |
|---|---|
| 🔴 阻塞 | 1 |
| 🟡 建议 | 0 |
⛔ 需要修改


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
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| docs | ✅ munanhw, wulinyu (2/2) | ✅ munanhw (1/1) |
| examples | ✅ munanhw, wulinyu (2/2) | ✅ munanhw (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
zhangshunwei2, thanks for your pull request. All authors of the commits have signed the CLA. 👍


/compile


流水线任务触发成功
任务链接 [2fc52e0cd38345c6b6f707a36f51a45d][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| SCA | ✅ SUCCESS | >>>>> | |
| antipoison | ✅ SUCCESS | >>>>> | |
| codecheck | ✅ SUCCESS | >>>>> | |
| codecheck_Pr | ✅ SUCCESS | ||
| pre_comment | ✅ SUCCESS | >>>>> | |
| StaticCheck_codespell | ✅ SUCCESS | ||
| StaticCheck_link_validity | ✅ SUCCESS | ||
| StaticCheck_resource_existence | ✅ SUCCESS | ||
| StaticCheck_tag_closed | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ⚠️ WARNING | >>>>> | |
| codecheck_codestyle | ✅ SUCCESS | >>>>> | |
| codecheck_precommit | ✅ SUCCESS | >>>>> |
[2026-07-15 10:55:53] CI执行结束


流水线任务触发成功
任务链接 [3d18a24a3fa142ca826601ecf2e7657a][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| Compile_Ascend_X86 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM | ✅ SUCCESS | >>>>> | >>>>> |
| pre_comment | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| PreSmoke_A900_npupool | ✅ SUCCESS | >>>>> |
[2026-07-15 11:01:03] CI执行结束


流水线任务触发成功
任务链接 [7c1132a85f84456fb6a4b435738882aa][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| Compile_Ascend_X86_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| pre_comment | ✅ SUCCESS | >>>>> | |
| UT_Test_adv_test_one | ✅ SUCCESS | ||
| UT_Test_adv_test_two | ✅ SUCCESS | ||
| UT_Test_basic_test_one | ✅ SUCCESS | ||
| UT_Test_basic_test_two | ✅ SUCCESS | ||
| UT_Test_basic_test_three | ✅ SUCCESS | ||
| UT_Test_basic_test_four | ✅ SUCCESS | ||
| UT_Test_basic_test_five | ✅ SUCCESS | ||
| UT_Test_arm | ✅ SUCCESS | ||
| API_Check | ✅ SUCCESS | >>>>> | |
| UT_Test_report | ✅ SUCCESS | >>>>> |
[2026-07-15 11:03:20] CI执行结束


🔴 Critical
该 diff 删除了 uint32_t block_idx = AscendC::GetBlockIdx();(C++ 风格接口),但紧接的第 111 行(新行号)仍然使用 block_idx 计算 block_offset:uint32_t block_offset = block_idx * THREAD_COUNT;。删除后 block_idx 在整个函数及文件中无任何声明或定义,会产生未定义标识符的编译错误。
该 PR 的目标是去掉 C++ 风格接口并替换为 C 风格接口。同类文件 matrix_transpose.asc 中已使用 get_block_idx()(底层内建函数),官方 C API 为 asc_get_block_idx()(定义于 include/c_api/sys_var/sys_var.h,返回 int64_t)。应补充 C 风格替代写法,而非仅删除该行。
建议:将删除的行替换为 C 风格 API 调用。可参考同仓库 matrix_transpose.asc 使用 get_block_idx() 或使用官方 C API asc_get_block_idx()。注意 asc_get_block_idx() 返回 int64_t,赋值给 uint32_t 时建议加上显式类型转换。


/check-pr


The following labels are not ready.
lgtm: Please wait for reviewers to review the code.
approved: Please wait for committers to review the code.


改为下划线风格


/compile


流水线任务触发成功
任务链接 [2361273b4e5e45b4ae248e835e8f2655][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| SCA | ✅ SUCCESS | >>>>> | |
| antipoison | ✅ SUCCESS | >>>>> | |
| codecheck | ✅ SUCCESS | >>>>> | |
| codecheck_Pr | ✅ SUCCESS | ||
| pre_comment | ✅ SUCCESS | >>>>> | |
| StaticCheck_codespell | ✅ SUCCESS | ||
| StaticCheck_link_validity | ✅ SUCCESS | ||
| StaticCheck_resource_existence | ✅ SUCCESS | ||
| StaticCheck_tag_closed | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ⚠️ WARNING | >>>>> | |
| codecheck_codestyle | ✅ SUCCESS | >>>>> | |
| codecheck_precommit | ✅ SUCCESS | >>>>> |
[2026-07-17 17:18:36] CI执行结束


流水线任务触发成功
任务链接 [69677070dac84fbca4bfc3e091547163][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| Compile_Ascend_X86 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM | ✅ SUCCESS | >>>>> | >>>>> |
| pre_comment | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| PreSmoke_A900_npupool | ✅ SUCCESS | >>>>> |
[2026-07-17 17:25:24] CI执行结束


流水线任务触发成功
任务链接 [cbeaac31e3cf448cb60cfcd382e1b291][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| Compile_Ascend_X86_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| pre_comment | ✅ SUCCESS | >>>>> | |
| UT_Test_adv_test_one | ✅ SUCCESS | ||
| UT_Test_adv_test_two | ✅ SUCCESS | ||
| UT_Test_basic_test_one | ✅ SUCCESS | ||
| UT_Test_basic_test_two | ✅ SUCCESS | ||
| UT_Test_basic_test_three | ✅ SUCCESS | ||
| UT_Test_basic_test_four | ✅ SUCCESS | ||
| UT_Test_basic_test_five | ✅ SUCCESS | ||
| UT_Test_arm | ✅ SUCCESS | ||
| API_Check | ✅ SUCCESS | >>>>> | |
| UT_Test_report | ✅ SUCCESS | >>>>> |
[2026-07-17 17:26:41] CI执行结束


描述
混合编程interger fast div样例去掉c++风格接口
SIMT编程样例支持版本修改为9.1.0
关联的Issue
关联Issue #1256
关联Issue #1242
测试
文档更新
类型标签