From 6f3a835d389ecdec7c0d1af09153156309e31d45 Mon Sep 17 00:00:00 2001 From: Pranav Sharma Date: Mon, 19 Aug 2019 14:27:33 -0700 Subject: [PATCH] Update perf tool documentation to reflect the new graph optimization enums. Relax constraint for enable_all. (#1650) --- docs/ONNX_Runtime_Perf_Tuning.md | 2 +- onnxruntime/test/perftest/command_args_parser.cc | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/docs/ONNX_Runtime_Perf_Tuning.md b/docs/ONNX_Runtime_Perf_Tuning.md index b0ac2e0b2c..3c7b238f1c 100644 --- a/docs/ONNX_Runtime_Perf_Tuning.md +++ b/docs/ONNX_Runtime_Perf_Tuning.md @@ -72,7 +72,7 @@ sess_options.set_graph_optimization_level(2) ``` * sess_options.session_thread_pool_size=2 controls how many thread do you want to use to run your model * sess_options.enable_sequential_execution=True controls whether you want to run operators in your graph sequentially or in parallel. Usually when your model has many branches, set this option to false will give you better performance. -* sess_options.set_graph_optimization_level(2). There are three levels, 0 means disable optimization, 1 means enable optimizations before graph partition, 2 means enable all optimization. +* sess_options.set_graph_optimization_level(2). Please see onnxruntime_c_api.h (enum GraphOptimizationLevel) for the full list of all optimization levels. ### MKL_DNN/nGraph/MKL_ML Execution Provider MKL_DNN, MKL_ML and nGraph all depends on openmp for parallization. For those execution providers, we need to use openmp enviroment variable to tune the performance. diff --git a/onnxruntime/test/perftest/command_args_parser.cc b/onnxruntime/test/perftest/command_args_parser.cc index de492fa87a..ee54ee4b55 100644 --- a/onnxruntime/test/perftest/command_args_parser.cc +++ b/onnxruntime/test/perftest/command_args_parser.cc @@ -42,7 +42,7 @@ namespace perftest { "\t-v: Show verbose information.\n" "\t-x [thread_size]: Session thread pool size.\n" "\t-P: Use parallel executor instead of sequential executor.\n" - "\t-o [optimization level]: 0: disable optimization, 1: basic optimization, 2: extended optimization, 3: extended+layout optimization. \n" + "\t-o [optimization level]: Please see onnxruntime_c_api.h (enum GraphOptimizationLevel) for the full list of all optimization levels. \n" "\t-h: help\n"); } @@ -143,8 +143,13 @@ namespace perftest { case ORT_ENABLE_ALL: test_config.run_config.optimization_level = ORT_ENABLE_ALL; break; - default: - return false; + default: { + if (tmp > ORT_ENABLE_ALL) { // relax constraint + test_config.run_config.optimization_level = ORT_ENABLE_ALL; + } else { + return false; + } + } } break; }