---
title: 查看调优结果
description: "本节介绍调优完成后，如何查看调优结果，包括屏幕打印信息和生成的自定义知识库、om模型、算子调优结果文件和子图调优结果文件。"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/devaids/aoe/aoeep_16_066.html
sourcePath: /source/zh/canncommercial/900/devaids/aoe/aoeep_16_066.html
indexId: f90102a736bce52eb9d660f367c013aca5d38f47e366eef22d93eb1a0bbf365859
---
# 查看调优结果

本节介绍调优完成后，如何查看调优结果，包括屏幕打印信息和生成的自定义知识库、om模型、算子调优结果文件和子图调优结果文件。


执行调优结果如下所示，代表调优完成并且性能有提升。

```
<xxxx> process finished. Performance improved by xx%    //xxxx：调优任务名称，xx%：性能提升的比例。
```

调优后的自定义知识库和om模型请参见自定义知识库和om模型，调优结果文件请参见算子调优结果文件和子图调优结果文件。

#### 自定义知识库和om模型

调优完成后，若满足自定义知识库生成条件（请参见图2和图3），则会生成自定义知识库。生成自定义知识库存放路径如下。

自定义知识库存放路径的优先级为：TUNE_BANK_PATH>ASCEND_CACHE_PATH>默认，TUNE_BANK_PATH和ASCEND_CACHE_PATH详细信息请参考《环境变量参考(https://www.hiascend.com/document/detail/zh/canncommercial/900/maintenref/envvar/envref_07_0001.html)》。- 子图自定义知识库
  若未配置TUNE_BANK_PATH和ASCEND_CACHE_PATH（可以使用env命令查询是否配置），自定义知识库默认存储在：${HOME}/Ascend/latest/data/aoe/custom/graph/${soc_version}。

- 算子自定义知识库
  若未配置TUNE_BANK_PATH和ASCEND_CACHE_PATH（可以使用env命令查询是否配置），自定义知识库默认存储在：${HOME}/Ascend/latest/data/aoe/custom/op/${soc_version}。


调优后的om模型存放路径优先级为：ASCEND_WORK_PATH > 默认。若未配置ASCEND_WORK_PATH（可以使用env命令查询是否配置，ASCEND_WORK_PATH详细信息请参考《环境变量参考(https://www.hiascend.com/document/detail/zh/canncommercial/900/maintenref/envvar/envref_07_0001.html)》），调优后的om模型默认存放路径：${WORK_PATH}/aoe_workspace/${model_name}_${timestamp}/tunespace/result/${model_name}_${timestamp}_tune.om（或者${model_name}_${timestamp}_tune_${os}_${arch}.om）。各字段含义如下。- ${WORK_PATH}：调优工作目录，默认为执行aoe命令的目录。
- ${model_name}：模型名字
- ${timestamp}：时间戳
- ${os}_${arch}：操作系统及架构。动态shape场景或者“--virtual_type=1”且包括  3
中算子的场景下，会出现该字段。若om文件名中包含操作系统及架构，则该om文件只能在该操作系统及架构的运行环境中使用。如果想要在其他操作系统及架构的运行环境使用，请使用ATC重新转换模型（需要带"--host_env_os"和"--host_env_cpu"参数），详见《ATC离线模型编译工具(https://www.hiascend.com/document/detail/zh/canncommercial/900/devaids/atctool/atlasatc_16_0001.html)》。


#### 算子调优结果文件

算子调优结果文件的存放路径优先级为：ASCEND_WORK_PATH > 默认（执行调优的工作目录），若未配置ASCEND_WORK_PATH（可以使用env命令查询是否配置，ASCEND_WORK_PATH详细信息请参考《环境变量参考(https://www.hiascend.com/document/detail/zh/canncommercial/900/maintenref/envvar/envref_07_0001.html)》），算子调优结果文件存放在默认路径（执行调优的工作目录）。

调优过程中，实时生成的结果文件命名为“aoe_result_opat_${timestamp}_${pidxxx}.json”，记录了调优过程中被调优的算子信息。其中${timestamp}为时间戳，格式为：年月日时分秒毫秒，“${pidxxx}”中的“xxx”为进程ID。

内容格式如下所示，各字段含义请参见表1。
```
[
{
"basic": {
"tuning_name": "调优任务名",
"tuning_time(s)": 1494
}
},
{
"OPAT": {
"model_baseline_performance(ms)": 113.588725,
"model_performance_improvement": "0.31%",
"model_result_performance(ms)": 113.236731,
"opat_tuning_result": "tuning successful",
"repo_modified_operators": [
{
"op_name": "softmax",
"op_type": "SoftmaxV2",
"tune_performance": {
"Format": {
"performance_after_tune(us)": 99,
"performance_before_tune(us)": 134,
"performance_improvement": "35.35%",
"update_mode": "add"
}
}
},
.......
{
"op_name": "Conv_125",
"op_type": "Conv2D",
"tune_performance": {
"Schedule": {
"performance_after_tune(us)": 72.046,
"performance_before_tune(us)": 72.055,
"performance_improvement": "0.01%",
"update_mode": "add"
}
}
}
],
"repo_summary": {
"repo_add_num": 19,
"repo_hit_num": 0,
"repo_reserved_num": 0,
"repo_unsatisfied_num": 2,
"repo_update_num": 0,
"total_num": 21
}
}
}
]
```


调优失败时（即opat_tuning_result显示为"tuning failed"时），还会显示调优失败的算子的op_name列表。

```
"tuning_failed_operators": [
"res4a_branch1"
]
```


**表1 字段含义**

| 字段名称 | 字段名称 | 字段名称 | 字段名称 | 含义 |
| --- | --- | --- | --- | --- |
| basic | \- | \- | \- | \- |
| \- | tuning\_name | \- | \- | 调优任务名称。 |
| \- | tuning\_time(s) | \- | \- | 调优耗费的时长，单位：s。 调优中断场景下（比如coredump、oom）不记录该字段。 |
| OPAT（没有可调优的算子时，该段信息不存在。） | \- | \- | \- | \- |
| \- | model\_baseline\_performance(ms) | \- | \- | 调优前模型执行时间，单位：ms。 |
| \- | model\_performance\_improvement | \- | \- | 调优后模型执行时间减少百分比。 调优中断场景下（比如coredump、oom）不记录该字段。 |
| \- | model\_result\_performance(ms) | \- | \- | 调优后模型执行时间，单位：ms。 调优中断场景下（比如coredump、oom）不记录该字段。 |
| \- | opat\_tuning\_result | \- | \- | 调优结果，成功时显示为"tuning successful",失败时显示为"tuning failed"，调优未完成、异常中断退出时显示为"tuning incomplete"。 |
| \- | repo\_modified\_operators | \- | \- | 调优后，调优策略有增加和更新的算子详细信息。 |
| \- | \- | op\_name | \- | 算子名称。 |
| \- | \- | op\_type | \- | 算子类型。可以有一个，也可以有多个。当有多个的时候，需要使用[]将多个算子类型括起来。 |
| \- | \- | tune\_performance | \- | 算子性能提升具体信息。 |
| \- | \- | Format或者Schedule或者Impl | \- | 算子的调优模式，包括如下取值： Format：当算子调优过程中使能了Format调优功能，且有Format调优的性能提升时，会出现该字段。 Schedule：当算子调优过程中有Schedule调优的性能提升时，会出现该字段。 Impl：当算子调优过程中有Impl调优的性能提升时，会出现该字段。 |
| \- | \- | \- | performance\_after\_tune(us) | 调优后算子执行时间，单位：us。 |
| \- | \- | \- | performance\_before\_tune(us) | 调优前算子执行时间，单位：us。 |
| \- | \- | \- | performance\_improvement | 调优后算子执行时间减少百分比。 |
| \- | \- | \- | update\_mode | 算子调优策略更新模式，取值如下。 add：增加算子调优策略。 update：更新算子调优策略。 |
| \- | repo\_summary | \- | \- | 记录调优任务中不同状态算子的信息。 |
| \- | \- | repo\_add\_num | \- | 调优前调优策略不在知识库中，调优后调优策略追加到知识库中的调优策略个数。 |
| \- | \- | repo\_hit\_num | \- | 调优过程中调优策略在知识库中的调优策略个数。 |
| \- | \- | repo\_reserved\_num | \- | 调优前调优策略在知识库中，调优后知识库中的调优策略无变化的调优策略个数。 |
| \- | \- | repo\_unsatisfied\_num | \- | 调优前调优策略不在知识库，调优后也未写入知识库的调优策略个数。 |
| \- | \- | repo\_update\_num | \- | 调优前调优策略在知识库中，调优后知识库中的调优策略有更新的调优策略个数。 |
| \- | \- | total\_num | \- | 调优任务中被调优的调优策略总数。 repo\_hit\_num=repo\_update\_num+repo\_reserved\_num total\_num=repo\_add\_num+repo\_hit\_num+repo\_unsatisfied\_num |
| \- | tuning\_failed\_operators | \- | \- | 调优失败的算子的op\_name列表。 说明：可选，当opat\_tuning\_result显示"tuning failed"时才记录该字段。 |


针对每个调优策略有新增或者更新的算子，都会包括如上op_name~update_mode的信息。


#### 子图调优结果文件

子图调优结果文件的存放路径优先级为：ASCEND_WORK_PATH > 默认（执行调优的工作目录），若未配置ASCEND_WORK_PATH（可以使用env命令查询是否配置，ASCEND_WORK_PATH详细信息请参考《环境变量参考(https://www.hiascend.com/document/detail/zh/canncommercial/900/maintenref/envvar/envref_07_0001.html)》），子图调优结果文件存放在默认路径（执行调优的工作目录）。

调优过程中，实时生成的结果文件命名为“aoe_result_sgat_${timestamp}_${pidxxx}.json”，记录了调优过程中被调优的子图信息。其中${timestamp}为时间戳，格式为：年月日时分秒毫秒，“${pidxxx}”中的“xxx”为进程ID。

内容格式如下所示，各字段含义请参见表2。

```
[
{
"basic": {
"tuning_name": "调优任务名",
"tuning_time(s)": 78
}
},
{
"SGAT": {
"model_baseline_performance(ms)": 5.600486,
"model_performance_improvement": "55.11%",
"model_result_performance(ms)": 3.610442,
"repo_modified_subgraphs": {
"add_repo_subgraphs": [
{
"performance_after_tune(ms)": 3.573203,
"performance_before_tune(ms)": 5.58434,
"performance_improvement": "56.28%",
"repo_key": "1024942313106047484"
}
]
"update_repo_subgraphs": [
{
"performance_after_tune(ms)": 2.573203,
"performance_before_tune(ms)": 4.58434,
"performance_improvement": "78.15%",
"repo_key": "1024942313106057586"
}
]
},
"repo_summary": {
"repo_add_num": 1,
"repo_hit_num": 1,
"repo_reserved_num": 0,
"repo_unsatisfied_num": 0,
"repo_update_num": 1,
"total_num": 2
}
}
}
]
```


**表2 字段含义**

| 字段名称 | 字段名称 | 字段名称 | 字段名称 | 含义 |
| --- | --- | --- | --- | --- |
| basic | \- | \- | \- | \- |
| \- | tuning\_name | \- | \- | 调优任务名称。 |
| \- | tuning\_time(s) | \- | \- | 调优耗费的时长，单位：s。 |
| SGAT（子图调优失败时，该段信息不存在。） | \- | \- | \- | \- |
| \- | model\_baseline\_performance(ms) | \- | \- | 调优前模型执行时间，单位: ms。 |
| \- | model\_performance\_improvement | \- | \- | 调优后模型执行时间减少百分比。 |
| \- | model\_result\_performance(ms) | \- | \- | 调优后模型执行时间，单位: ms。 |
| \- | repo\_modified\_subgraphs | \- | \- | 调优后，调优策略有增加和更新的子图详细信息。 |
| \- | \- | add\_repo\_subgraphs | \- | 调优后调优策略有增加的子图，可以没有，也可以有多个。 |
| \- | \- | \- | performance\_before\_tune(ms) | 调优前子图执行时间，单位: ms。 |
| \- | \- | \- | performance\_after\_tune(ms) | 调优后子图执行时间，单位:ms。 |
| \- | \- | \- | performance\_improvement | 调优后子图执行时间减少百分比。 |
| \- | \- | \- | repo\_key | 调优后子图的key值，用于调优知识库查询。 |
| \- | \- | update\_repo\_subgraphs | \- | 调优后调优策略有更新的子图，可以没有，也可以有多个。 |
| \- | \- | \- | performance\_before\_tune(ms) | 调优前子图执行时间，单位: ms。 |
| \- | \- | \- | performance\_after\_tune(ms) | 调优后子图执行时间，单位:ms。 |
| \- | \- | \- | performance\_improvement | 调优后子图执行时间减少百分比。 |
| \- | \- | \- | repo\_key | 调优后子图的key值，用于调优知识库查询。 |
| \- | repo\_summary | \- | \- | 记录调优过程中不同状态子图的个数。 |
| \- | \- | repo\_add\_num | \- | 调优前调优策略不在知识库中，调优后调优策略追加到知识库中的子图的个数。 |
| \- | \- | repo\_hit\_num | \- | 调优过程中调优策略在知识库中的子图的个数。 |
| \- | \- | repo\_reserved\_num | \- | 调优前调优策略在知识库中，调优后知识库中的调优策略无变化的子图的个数。 |
| \- | \- | repo\_unsatisfied\_num | \- | 调优前调优策略不在知识库，调优后也未写入知识库的子图个数。 |
| \- | \- | repo\_update\_num | \- | 调优前调优策略在知识库中，调优后知识库中的调优策略有更新的子图个数。 |
| \- | \- | total\_num | \- | 调优任务中调优的子图总数。 repo\_hit\_num=repo\_update\_num+repo\_reserved\_num total\_num=repo\_add\_num+repo\_hit\_num+repo\_unsatisfied\_num |
