调优结果

介绍调优完成后知识库的变更、模型和调优结果文件。

自定义知识库和om模型

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

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

调优完成后,若满足自定义知识库生成条件,则会生成自定义知识库。生成自定义知识库存放如下。如何使用调优后的自定义知识库请参见如何使用调优后的自定义知识库

调优后的om模型默认存放路径:${WORK_PATH}/aoe_workspace/${model_name}_${timestamp}/tunespace/result/${model_name}_${timestamp}_tune.om(或者${model_name}_${timestamp}_tune_${os}_${arch}.om)。各字段含义如下。
  • ${WORK_PATH}:调优工作目录
  • ${model_name}:模型名字
  • ${timestamp}:时间戳
  • ${os}_${arch}:操作系统及架构。动态shape场景下,会出现该字段。若om文件名中包含操作系统及架构,则该om文件只能在该操作系统及架构的运行环境中使用。如果想要在其他操作系统及架构的运行环境使用,请使用ATC重新转换模型(需要带"--host_env_os"和"--host_env_cpu"参数),详见ATC工具使用指南

算子调优结果文件

调优过程中,会在执行调优的工作目录下实时生成命名为“aoe_result_opat_{timestamp}_{pidxxx}.json”的文件,记录调优过程中被调优的算子信息。

其中{timestamp}为时间戳,格式为:年月日时分秒毫秒,“{pidxxx}”中的“xxx”为进程ID。

内容格式如下所示,各字段含义请参见表1

[
  {
    "basic": {
      "tuning_name": "调优任务名",
      "tuning_time(s)": 1827
    }
  },
  {
    "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": {
        "add_repo_operators": [
          {
            "op_name": "strided_slice_10",
            "op_type": "stridedsliced",
            "performance_after_tune(us)": 99,
            "performance_before_tune(us)": 134,
            "performance_improvement": "35.35%"
          },
          {
            "op_name": "strided_slice_7",
            "op_type": "stridedsliced",
            "performance_after_tune(us)": 14,
            "performance_before_tune(us)": 124,
            "performance_improvement": "785.71%"
          }
         ],
        "update_repo_operators": [
          {
            "op_name": "test/conv3/conv3_1/Conv2Dtest/conv3/conv3_1/Relu",
            "op_type": "conv2d",
            "performance_after_tune(us)": 4891.762,
            "performance_before_tune(us)": 5008.928,
            "performance_improvement": "2.40%"
          },
          {
            "op_name": "test/conv1/conv1_2/Conv2Dtest/conv1/conv1_2/Relu",
            "op_type": "conv2d",
            "performance_after_tune(us)": 13114.24,
            "performance_before_tune(us)": 13446.145,
            "performance_improvement": "2.53%"
            }
           }
         ]
      },
      "repo_summary": {
        "repo_add_num": 2,
        "repo_hit_num": 17,
        "repo_reserved_num": 15,
        "repo_unsatisfied_num": 0,
        "repo_update_num": 2,
        "total_num": 19
      }
    }
  }
]

调优失败时(即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

-

-

调优后,调优策略有增加和更新的算子详细信息。

-

-

add_repo_operators

-

调优后增加调优策略的算子,可以没有,也可以有多个。

-

-

-

op_name

算子名称。

-

-

-

op_type

算子类型。可以有一个,也可以有多个。当有多个的时候,需要使用[]将多个算子类型括起来。

-

-

-

performance_after_tune(us)

调优后算子执行时间,单位:us。

-

-

-

performance_before_tune(us)

调优前算子执行时间,单位:us。

-

-

-

performance_improvement

调优后算子执行时间减少百分比。

-

-

update_repo_operators

-

调优后更新调优策略的算子,可以没有,也可以有多个。

-

-

-

op_name

算子名称。

-

-

-

op_type

算子类型。

-

-

-

performance_after_tune(us)

调优后算子执行时间,单位:us。

-

-

-

performance_before_tune(us)

调优前算子执行时间,单位:us。

-

-

-

performance_improvement

调优后算子执行时间减少百分比。

-

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"时才记录该字段。

子图调优结果文件

调优过程中,会在执行调优的工作目录下实时生成命名为“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