已合并
cannsim改名为npusim #9686
liangbinglong创建于 8月6日
cannsim改名为npusim #9686
已合并
共 4 个文件变更+35-30
| @@ -14,7 +14,7 @@ | |||
| 14 | - [2025/12] 优化指南类文档,聚焦[算子开发指南](docs/zh/develop/aicore_develop_guide.md),明确最小交付件和关键示例代码,针对[Ascend/samples](https://gitee.com/ascend/samples/tree/master)仓算子提供迁移本项目的指导。 | 14 | - [2025/12] 优化指南类文档,聚焦[算子开发指南](docs/zh/develop/aicore_develop_guide.md),明确最小交付件和关键示例代码,针对[Ascend/samples](https://gitee.com/ascend/samples/tree/master)仓算子提供迁移本项目的指导。 |
| 15 | - [2025/12] 支持transformer类onnx算子插件,包括[NPUFlashAttention](attention/flash_attention_score/framework)、[NPUMultiHeadAttention](common/src/framework)、[NPUMoeComputeExpertTokens](moe/moe_compute_expert_tokens/framework)等。 | 15 | - [2025/12] 支持transformer类onnx算子插件,包括[NPUFlashAttention](attention/flash_attention_score/framework)、[NPUMultiHeadAttention](common/src/framework)、[NPUMoeComputeExpertTokens](moe/moe_compute_expert_tokens/framework)等。 |
| 16 | - [2025/12] 新支持算子[kv_rms_norm_rope_cache](posembedding/kv_rms_norm_rope_cache)、[attention_update](attention/attention_update)、[attention_worker_scheduler](attention/attention_worker_scheduler)、[gather_pa_kv_cache](attention/gather_pa_kv_cache)、[kv_quant_sparse_flash_attention](attention/kv_quant_sparse_flash_attention)、[lightning_indexer_grad](attention/lightning_indexer_grad)、[mla_preprocess](attention/mla_preprocess)、[mla_preprocess_v2](attention/mla_preprocess_v2)、[grouped_matmul_swiglu_quant_v2](gmm/grouped_matmul_swiglu_quant_v2)、[attention_to_ffn](mc2/attention_to_ffn)、[ffn_to_attention](mc2/ffn_to_attention)。 | 16 | - [2025/12] 新支持算子[kv_rms_norm_rope_cache](posembedding/kv_rms_norm_rope_cache)、[attention_update](attention/attention_update)、[attention_worker_scheduler](attention/attention_worker_scheduler)、[gather_pa_kv_cache](attention/gather_pa_kv_cache)、[kv_quant_sparse_flash_attention](attention/kv_quant_sparse_flash_attention)、[lightning_indexer_grad](attention/lightning_indexer_grad)、[mla_preprocess](attention/mla_preprocess)、[mla_preprocess_v2](attention/mla_preprocess_v2)、[grouped_matmul_swiglu_quant_v2](gmm/grouped_matmul_swiglu_quant_v2)、[attention_to_ffn](mc2/attention_to_ffn)、[ffn_to_attention](mc2/ffn_to_attention)。 |
| 17 | -- [2025/12] 开源算子支持[CANN Simulator](docs/zh/debug/cann_sim.md)仿真工具开发调试。 | 17 | +- [2025/12] 开源算子支持[NPU Simulator](docs/zh/debug/npu_sim.md)仿真工具开发调试。 |
| 18 | - [2025/12] 开源算子支持[Ascend 950PR/Ascend 950DT](docs/zh/ascend950_op_list.md)/KirinX90系列产品。 | 18 | - [2025/12] 开源算子支持[Ascend 950PR/Ascend 950DT](docs/zh/ascend950_op_list.md)/KirinX90系列产品。 |
| 19 | - [2025/11] 新支持算子[kv_quant_sparse_flash_attention](attention/kv_quant_sparse_flash_attention)、[lightning_indexer](attention/lightning_indexer)、[quant_lightning_indexer](attention/quant_lightning_indexer)、[sparse_flash_attention](attention/sparse_flash_attention)。 | 19 | - [2025/11] 新支持算子[kv_quant_sparse_flash_attention](attention/kv_quant_sparse_flash_attention)、[lightning_indexer](attention/lightning_indexer)、[quant_lightning_indexer](attention/quant_lightning_indexer)、[sparse_flash_attention](attention/sparse_flash_attention)。 |
| 20 | - [2025/11] 新支持示例算子[rope_matrix](experimental/posembedding/rope_matrix)和[all_gather_add](examples/mc2/all_gather_add)。 | 20 | - [2025/11] 新支持示例算子[rope_matrix](experimental/posembedding/rope_matrix)和[all_gather_add](examples/mc2/all_gather_add)。 |
| @@ -58,7 +58,7 @@ Docs目录结构说明如下: | |||
| 58 | 58 | ||
| 59 | | 文档 | 说明 | | 59 | | 文档 | 说明 | |
| 60 | | ----------------------- | ---------------------- | | 60 | | ----------------------- | ---------------------- | |
| 61 | -| [Simulator仿真工具](zh/debug/cann_sim.md) | 面向算子开发场景的SoC级仿真工具,用于分析运行在AI仿真器上AI任务在各阶段精度和性能数据。 | | 61 | +| [Simulator仿真工具](zh/debug/npu_sim.md) | 面向算子开发场景的SoC级仿真工具,用于分析运行在AI仿真器上AI任务在各阶段精度和性能数据。 | |
| 62 | 62 | ||
| 63 | ### 样例实践 | 63 | ### 样例实践 |
| 64 | 64 | ||
| @@ -1,6 +1,6 @@ | |||
| 1 | # 简介 | 1 | # 简介 |
| 2 | 2 | ||
| 3 | -CANN Simulator是一款面向算子开发场景的SoC级芯片仿真工具,用于分析运行在AI仿真器上的AI任务在各阶段的精度和性能数据(如指令执行情况等)。该工具有助于用户进行深度性能调优,使研发人员在无法获取或芯片资源紧缺的情况下,也能获得与真实芯片几乎一致的验证效果和性能反馈。 | 3 | +NPU Simulator是一款面向算子开发场景的SoC级芯片仿真工具,用于分析运行在AI仿真器上的AI任务在各阶段的精度和性能数据(如指令执行情况等)。该工具有助于用户进行深度性能调优,使研发人员在无法获取或芯片资源紧缺的情况下,也能获得与真实芯片几乎一致的验证效果和性能反馈。 |
| 4 | 4 | ||
| 5 | # 主要功能 | 5 | # 主要功能 |
| 6 | 6 | ||
| @@ -21,12 +21,17 @@ CANN Simulator是一款面向算子开发场景的SoC级芯片仿真工具,用 | |||
| 21 | * 本工具为开发工具,不建议在生产环境使用。 | 21 | * 本工具为开发工具,不建议在生产环境使用。 |
| 22 | * 工具的仿真功能仅支持单卡场景,无法仿真多卡环境,代码中只能设置为0卡。若修改可见卡号,将导致仿真失败。 | 22 | * 工具的仿真功能仅支持单卡场景,无法仿真多卡环境,代码中只能设置为0卡。若修改可见卡号,将导致仿真失败。 |
| 23 | * 仿真环境仅支持AI Core计算类算子(不支持MC2和HCCL类型的算子)。 | 23 | * 仿真环境仅支持AI Core计算类算子(不支持MC2和HCCL类型的算子)。 |
| 24 | -* CANN Simulator工具目前处于尝鲜版本阶段,仅支持Ascend950PR芯片,建议仿真器运行环境配置为16核CPU和32GB以上内存。 | 24 | +* NPU Simulator工具仅支持Ascend950PR和Ascend950DT芯片,建议仿真器运行环境配置为16核CPU和32GB以上内存。 |
| 25 | * 目前不支持arm环境仿真。 | 25 | * 目前不支持arm环境仿真。 |
| 26 | 26 | ||
| 27 | +``` | ||
| 28 | +名称变更通知: | ||
| 29 | +自2026年7月30号版本起,仿真器名称cannsim正式更名为npusim,所有命令行工具名称同步变更。旧命令cannsim作为别名保留一段时间,建议尽快迁移到npusim | ||
| 30 | +``` | ||
| 31 | + | ||
| 27 | ## 环境准备 | 32 | ## 环境准备 |
| 28 | 33 | ||
| 29 | -CANN Simulator集成在CANN toolkit包里,参考[环境部署](../install/quick_install.md)完成软件包的安装 | 34 | +NPU Simulator集成在CANN toolkit包里,参考[环境部署](../install/quick_install.md)完成软件包的安装 |
| 30 | 35 | ||
| 31 | # 快速开始 | 36 | # 快速开始 |
| 32 | 37 | ||
| @@ -48,10 +53,10 @@ bash build.sh --pkg --soc=ascend950 --vendor_name=custom --ops=add_example | |||
| 48 | ## 执行仿真命令 | 53 | ## 执行仿真命令 |
| 49 | 54 | ||
| 50 | ```bash | 55 | ```bash |
| 51 | -cannsim record ./test_aclnn_add_example -s Ascend950 --gen-report | 56 | +npusim record ./test_aclnn_add_example -s Ascend950 --gen-report |
| 52 | ``` | 57 | ``` |
| 53 | 58 | ||
| 54 | -仿真工具执行日志文件在examples/add_example/examples/build/bin/cannsim_*目录,执行日志文件为cannsim.log。 | 59 | +仿真工具执行日志文件在examples/add_example/examples/build/bin/npusim_*目录,执行日志文件为npusim.log。 |
| 55 | 60 | ||
| 56 | 从仿真工具日志文件可以看到示例中的打印信息: | 61 | 从仿真工具日志文件可以看到示例中的打印信息: |
| 57 | 62 | ||
| @@ -67,7 +72,7 @@ add_example first input[6] is: 1.000000, second input[6] is: 1.000000, result[6] | |||
| 67 | 72 | ||
| 68 | ## 查看性能流水 | 73 | ## 查看性能流水 |
| 69 | 74 | ||
| 70 | -仿真性能流水文件在本项目`examples/add_example/examples/build/bin/cannsim_*/report/results/kernel_*/core_*`目录,流水相关文件为: | 75 | +仿真性能流水文件在本项目`examples/add_example/examples/build/bin/npusim_*/report/results/kernel_*/core_*`目录,流水相关文件为: |
| 71 | 76 | ||
| 72 | ```bash | 77 | ```bash |
| 73 | trace_core0.json | 78 | trace_core0.json |
| @@ -83,7 +88,7 @@ trace_core0.json | |||
| 83 | 88 | ||
| 84 | ## 命令格式 | 89 | ## 命令格式 |
| 85 | 90 | ||
| 86 | -cannsim record [options] user_app | 91 | +npusim record [options] user_app |
| 87 | 92 | ||
| 88 | ## 参数说明 | 93 | ## 参数说明 |
| 89 | 94 | ||
| @@ -105,20 +110,20 @@ cannsim record [options] user_app | |||
| 105 | 110 | ||
| 106 | ```bash | 111 | ```bash |
| 107 | # 方式一:启用仿真,并将输出保存至 ./output目录,/path/to/app为算子程序 | 112 | # 方式一:启用仿真,并将输出保存至 ./output目录,/path/to/app为算子程序 |
| 108 | - $ cannsim record /path/to/app -o ./output -s Ascend950 | 113 | + $ npusim record /path/to/app -o ./output -s Ascend950 |
| 109 | 114 | ||
| 110 | # 方式二:启用仿真并生成报告,用于后续性能分析 | 115 | # 方式二:启用仿真并生成报告,用于后续性能分析 |
| 111 | - $ cannsim record /path/to/app -o ./output -s Ascend950 --gen-report | 116 | + $ npusim record /path/to/app -o ./output -s Ascend950 --gen-report |
| 112 | ``` | 117 | ``` |
| 113 | 118 | ||
| 114 | -3. 命令完成后,会在默认路径或指定的“output”目录下生成以“cannsim_{timestamp}_${user_app}”命名的文件夹,结构示例如下: | 119 | +3. 命令完成后,会在默认路径或指定的“output”目录下生成以“npusim_{timestamp}_${user_app}”命名的文件夹,结构示例如下: |
| 115 | 120 | ||
| 116 | ```bash | 121 | ```bash |
| 117 | - ├─cannsim_{timestamp}_${user_app} | 122 | + ├─npusim_{timestamp}_${user_app} |
| 118 | - ├── cannsim.log | 123 | + ├── npusim.log |
| 119 | ``` | 124 | ``` |
| 120 | 125 | ||
| 121 | -4. 用户可以获取算子执行结果,并进行精度的对比,结果展示在cannsim.log,示例如下 | 126 | +4. 用户可以获取算子执行结果,并进行精度的对比,结果展示在npusim.log,示例如下 |
| 122 | 127 | ||
| 123 | 以下输出仅为Ascend C单算子直调精度比较结果举例,因版本不同略有差异,请以实际输出为准。 | 128 | 以下输出仅为Ascend C单算子直调精度比较结果举例,因版本不同略有差异,请以实际输出为准。 |
| 124 | 129 | ||
| @@ -139,7 +144,7 @@ cannsim record [options] user_app | |||
| 139 | 144 | ||
| 140 | ## 命令格式 | 145 | ## 命令格式 |
| 141 | 146 | ||
| 142 | -cannsim report [options] | 147 | +npusim report [options] |
| 143 | 148 | ||
| 144 | ## 参数说明 | 149 | ## 参数说明 |
| 145 | 150 | ||
| @@ -147,7 +152,7 @@ cannsim report [options] | |||
| 147 | 152 | ||
| 148 | |参数 | 可选/必选 | 说明| | 153 | |参数 | 可选/必选 | 说明| |
| 149 | | --- | --- | --- | | 154 | | --- | --- | --- | |
| 150 | -|-e或 --export | 必选 | 仿真执行结果目录,指定到cannsim_{timestamp}_${user_app}层,可配置为绝对路径或者相对路径,且执行用户需具有读写权限。| | 155 | +|-e或 --export | 必选 | 仿真执行结果目录,指定到npusim_{timestamp}_${user_app}层,可配置为绝对路径或者相对路径,且执行用户需具有读写权限。| |
| 151 | |-o或 --output | 可选 | 指令流水图输出目录,可配置为绝对路径或者相对路径,且执行用户需具有读写权限。若未指定路径,默认与export目录相同。| | 156 | |-o或 --output | 可选 | 指令流水图输出目录,可配置为绝对路径或者相对路径,且执行用户需具有读写权限。若未指定路径,默认与export目录相同。| |
| 152 | |-n或 --core-id | 可选 | 指定生成指令流水的核ID,支持格式:'all'、'0-2,12-14'、'5'。不指定默认生成0核的指令流水。| | 157 | |-n或 --core-id | 可选 | 指定生成指令流水的核ID,支持格式:'all'、'0-2,12-14'、'5'。不指定默认生成0核的指令流水。| |
| 153 | |-f或 --object-file | 可选 | 设备对象文件路径,用于辅助生成报告。| | 158 | |-f或 --object-file | 可选 | 设备对象文件路径,用于辅助生成报告。| |
| @@ -159,10 +164,10 @@ cannsim report [options] | |||
| 159 | 164 | ||
| 160 | ```bash | 165 | ```bash |
| 161 | # 在当前目录下生成性能分析报告(默认仅分析核0) | 166 | # 在当前目录下生成性能分析报告(默认仅分析核0) |
| 162 | - cannsim report -e /path/to/cannsim_{timestamp}_${user_app} | 167 | + npusim report -e /path/to/npusim_{timestamp}_${user_app} |
| 163 | 168 | ||
| 164 | # 在指定目录下生成核0、核1、核11、核12的性能分析报告 | 169 | # 在指定目录下生成核0、核1、核11、核12的性能分析报告 |
| 165 | - cannsim report -e /path/to/cannsim_{timestamp}_${user_app} -o /path/to/report -n '0-1, 11-12' | 170 | + npusim report -e /path/to/npusim_{timestamp}_${user_app} -o /path/to/report -n '0-1, 11-12' |
| 166 | ``` | 171 | ``` |
| 167 | 172 | ||
| 168 | 3. 命令执行完后,会在output配置的目录下生成对应的流水文件,文件格式为json格式,输出结果示例如下: | 173 | 3. 命令执行完后,会在output配置的目录下生成对应的流水文件,文件格式为json格式,输出结果示例如下: |
| @@ -202,20 +207,20 @@ cannsim report [options] | |||
| 202 | 查询工具帮助信息: | 207 | 查询工具帮助信息: |
| 203 | 208 | ||
| 204 | ```bash | 209 | ```bash |
| 205 | -cannsim --help | 210 | +npusim --help |
| 206 | ``` | 211 | ``` |
| 207 | 212 | ||
| 208 | 查询工具record子命令的帮助信息: | 213 | 查询工具record子命令的帮助信息: |
| 209 | 214 | ||
| 210 | ```bash | 215 | ```bash |
| 211 | -cannsim record --help | 216 | +npusim record --help |
| 212 | ``` | 217 | ``` |
| 213 | 218 | ||
| 214 | 查询工具report子命令的帮助信息: | 219 | 查询工具report子命令的帮助信息: |
| 215 | 220 | ||
| 216 | - ```bash | 221 | +```bash |
| 217 | - cannsim report --help | 222 | +npusim report --help |
| 218 | - ``` | 223 | +``` |
| 219 | 224 | ||
| 220 | ## 参数说明 | 225 | ## 参数说明 |
| 221 | 226 | ||
| @@ -227,13 +232,13 @@ cannsim record --help | |||
| 227 | 2. 执行以下命令。 | 232 | 2. 执行以下命令。 |
| 228 | 233 | ||
| 229 | ```bash | 234 | ```bash |
| 230 | - cannsim --help | 235 | + npusim --help |
| 231 | ``` | 236 | ``` |
| 232 | 237 | ||
| 233 | ## 输出说明 | 238 | ## 输出说明 |
| 234 | 239 | ||
| 235 | ```bash | 240 | ```bash |
| 236 | -usage: cannsim [-h] {record,report} ... | 241 | +usage: npusim [-h] {record,report} ... |
| 237 | 242 | ||
| 238 | Command-line tool for performance simulation analysis on Ascend hardware. | 243 | Command-line tool for performance simulation analysis on Ascend hardware. |
| 239 | 244 | ||
| @@ -199,21 +199,21 @@ | |||
| 199 | 199 | ||
| 200 | 完成算子开发和编译后,假设采用aclnn接口方式调用,生成的算子可执行文件(test_aclnn_add_example)所在目录为本项目`examples/add_example/examples/build/bin/`。 | 200 | 完成算子开发和编译后,假设采用aclnn接口方式调用,生成的算子可执行文件(test_aclnn_add_example)所在目录为本项目`examples/add_example/examples/build/bin/`。 |
| 201 | 201 | ||
| 202 | -* **针对Ascend 950PR,可使用[CANN Simulator](./cann_sim.md)仿真工具,执行仿真命令,生成仿真数据** | 202 | +* **针对Ascend 950PR,可使用[NPU Simulator](./npu_sim.md)仿真工具,执行仿真命令,生成仿真数据** |
| 203 | 203 | ||
| 204 | 执行仿真命令,生成仿真数据 | 204 | 执行仿真命令,生成仿真数据 |
| 205 | 205 | ||
| 206 | ```bash | 206 | ```bash |
| 207 | - cannsim record ./test_aclnn_add_example -s Ascend950 --gen-report | 207 | + npusim record ./test_aclnn_add_example -s Ascend950 --gen-report |
| 208 | ``` | 208 | ``` |
| 209 | 209 | ||
| 210 | - 仿真结果在本项目`examples/add_example/examples/build/bin/cannsim_*/report/results/kernel_*/core_*`目录,流水相关文件为: | 210 | + 仿真结果在本项目`examples/add_example/examples/build/bin/npusim_*/report/results/kernel_*/core_*`目录,流水相关文件为: |
| 211 | 211 | ||
| 212 | ```bash | 212 | ```bash |
| 213 | trace_core0.json | 213 | trace_core0.json |
| 214 | ``` | 214 | ``` |
| 215 | 215 | ||
| 216 | - 在Chrome浏览器中输入“chrome://tracing”地址,并将生成的指令流水图文件(trace_core0.json)拖到空白处打开,具体参数介绍参考CANN Simulator中[“仿真结果解析”](./cann_sim.md#仿真结果解析说明)章节。 | 216 | + 在Chrome浏览器中输入“chrome://tracing”地址,并将生成的指令流水图文件(trace_core0.json)拖到空白处打开,具体参数介绍参考NPU Simulator中[“仿真结果解析”](./npu_sim.md#仿真结果解析说明)章节。 |
| 217 | 217 | ||
| 218 | * **针对Atlas A2/A3系列产品,可使用[msProf](https://www.hiascend.com/document/redirect/CannCommunityToolMsprof)工具,执行仿真命令,生成仿真数据** | 218 | * **针对Atlas A2/A3系列产品,可使用[msProf](https://www.hiascend.com/document/redirect/CannCommunityToolMsprof)工具,执行仿真命令,生成仿真数据** |
| 219 | 219 | ||