// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. #pragma once #include #include #include #include #include #include #include "core/graph/constants.h" #include "core/framework/session_options.h" namespace onnxruntime { namespace perftest { enum class TestMode : std::uint8_t { kFixDurationMode = 0, KFixRepeatedTimesMode }; enum class Platform : std::uint8_t { kWindows = 0, kLinux }; struct ModelInfo { std::string model_name; std::basic_string model_file_path; std::basic_string input_file_path; std::basic_string result_file_path; bool load_via_path = false; }; struct MachineConfig { Platform platform{Platform::kWindows}; std::string provider_type_name{onnxruntime::kCpuExecutionProvider}; std::vector plugin_provider_type_list; }; struct RunConfig { std::basic_string profile_file; TestMode test_mode{TestMode::kFixDurationMode}; size_t repeated_times{1000}; size_t duration_in_seconds{600}; size_t concurrent_session_runs{1}; bool f_dump_statistics{false}; int random_seed_for_input_data{-1}; bool f_verbose{false}; bool enable_memory_pattern{true}; bool enable_cpu_mem_arena{true}; bool generate_model_input_binding{false}; ExecutionMode execution_mode{ExecutionMode::ORT_SEQUENTIAL}; int intra_op_num_threads{0}; int inter_op_num_threads{0}; GraphOptimizationLevel optimization_level{ORT_ENABLE_ALL}; PathString optimized_model_path; std::string optimized_model_data_path; // Always UTF-8 std::string optimized_model_weight_min_size; bool optimized_save_optimized_prepacks{false}; int cudnn_conv_algo{0}; bool do_cuda_copy_in_separate_stream{false}; bool set_denormal_as_zero{false}; std::basic_string ep_runtime_config_string; std::unordered_map session_config_entries; std::unordered_map run_config_entries; std::map free_dim_name_overrides; std::map free_dim_denotation_overrides; std::map>> data_shape_groups; std::string intra_op_thread_affinities; bool disable_spinning = false; bool disable_spinning_between_run = false; int spin_duration_us = -1; // -1 means use default (not set by user) // Keep this signed in the CLI layer so negative user input can be diagnosed // before clamping/conversion to the unsigned runtime option. int spin_backoff_max = 1; // 1 means no backoff (default) bool spin_backoff_max_set = false; bool exit_after_session_creation = false; uint32_t hold_ms_after_session_creation{0}; std::basic_string register_custom_op_path; bool enable_cuda_io_binding{false}; bool use_extensions = false; bool compile_ep_context{false}; std::basic_string compile_model_path; bool compile_binary_embed{false}; bool compile_only{false}; struct CudaMempoolArenaConfig { std::string release_threshold; std::string bytes_to_keep; }; std::optional cuda_mempool_arena_config; }; struct PerformanceTestConfig { ModelInfo model_info; MachineConfig machine_config; RunConfig run_config; std::basic_string plugin_ep_names_and_libs; std::vector registered_plugin_eps; std::string selected_ep_device_indices; std::vector> filter_ep_device_kv_pairs; bool list_available_ep_devices = false; bool plugin_ep_force_cpu_allocator = false; }; } // namespace perftest } // namespace onnxruntime