- 
                Notifications
    You must be signed in to change notification settings 
- Fork 3.5k
ORT perf test support for plugin EP #25374
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
    
  
     Merged
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            49 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      43f261d
              
                add support for perf test to run plugin ep
              
              
                chilo-ms 8b982ab
              
                Unregister all registered plugin EP libraries before program exit
              
              
                chilo-ms 7fd4713
              
                remove unnecessary code
              
              
                chilo-ms de32583
              
                fix compile error
              
              
                chilo-ms 43ef004
              
                Merge branch 'main' into chi/add_plugin_ep_for_perf_test
              
              
                chilo-ms 4a9c5a3
              
                Replace getopt with cxxopts and include --list_devices and --select_d…
              
              
                chilo-ms 6cbc3ea
              
                fix build errors on Linux
              
              
                chilo-ms eb2220e
              
                address build erros/warnings
              
              
                chilo-ms 3d3dacb
              
                remove test code
              
              
                chilo-ms aa085cb
              
                continue the rest of converting getopt to cxxopts
              
              
                chilo-ms c5fd68c
              
                address compile warning
              
              
                chilo-ms 5fb5693
              
                update usage explanation
              
              
                chilo-ms f673e0e
              
                remove test code
              
              
                chilo-ms 3607d68
              
                add -DCXXOPTS_NO_RTTI for minimal build
              
              
                chilo-ms e03d00b
              
                address lintrunner issue
              
              
                chilo-ms 0736200
              
                fix type
              
              
                chilo-ms 0396a27
              
                fix typos
              
              
                chilo-ms fe9e1de
              
                add back getopts for the build which disables exceptions
              
              
                chilo-ms 8af32b3
              
                add define for DISABLE_EXCEPTIONS
              
              
                chilo-ms bd133cf
              
                Merge branch 'main' into chi/add_plugin_ep_for_perf_test
              
              
                chilo-ms 51b3412
              
                address reviewer's comments
              
              
                chilo-ms e281ca5
              
                revert code back
              
              
                chilo-ms bdfd3f5
              
                address reviewer's comments
              
              
                chilo-ms 22d3b80
              
                address reviewer's comments
              
              
                chilo-ms 2cd8a30
              
                address lint issue
              
              
                chilo-ms ad4d8a8
              
                add '\n' for fprintf
              
              
                chilo-ms 3e92522
              
                address reviewers' comments
              
              
                chilo-ms d2fb335
              
                fix some issues
              
              
                chilo-ms ad0ac64
              
                update option usage example
              
              
                chilo-ms ec5e973
              
                revert usage description
              
              
                chilo-ms 2396d2c
              
                Use abseil (ABSL Flags) instead of cxxopts
              
              
                chilo-ms fdd95ea
              
                update cmake file
              
              
                chilo-ms 3131024
              
                get correct positional options
              
              
                chilo-ms 17eaccf
              
                revert deps.txt
              
              
                chilo-ms 0550d6c
              
                use PathString typedef
              
              
                chilo-ms 6cbb20f
              
                address some of the reviewer's comments
              
              
                chilo-ms 706b1c8
              
                fix build issues
              
              
                chilo-ms 991bb41
              
                address reveiwer's comments
              
              
                chilo-ms 01da1a5
              
                Alias '-h' to '--help' and remove showUsage function
              
              
                chilo-ms 3bf3183
              
                supress mem leak info
              
              
                chilo-ms a00c352
              
                remove calling showUsage
              
              
                chilo-ms 7236e44
              
                fix build issue for Linux
              
              
                chilo-ms 02499f8
              
                fix build issue in Linux
              
              
                chilo-ms 461d57d
              
                clean up
              
              
                chilo-ms 1cfa077
              
                clean up
              
              
                chilo-ms 8e48b80
              
                Add flags_internal::FlagImpl::Init to the filter of the mem check
              
              
                chilo-ms 849c0ba
              
                Merge branch 'main' into chi/add_plugin_ep_for_perf_test
              
              
                chilo-ms 330d8ed
              
                address reviewer's comments
              
              
                chilo-ms a848340
              
                Remove the filtering of expected mem leak with ABSL flags, will handl…
              
              
                chilo-ms File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              Large diffs are not rendered by default.
      
      Oops, something went wrong.
      
    
  
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|  | ||
| #include "test/perftest/utils.h" | ||
| #include "test/perftest/strings_helper.h" | ||
| #include <core/platform/path_lib.h> | ||
|  | ||
| #include <cstdint> | ||
|  | ||
| #include <filesystem> | ||
|  | ||
| namespace onnxruntime { | ||
| namespace perftest { | ||
| namespace utils { | ||
|  | ||
| void ListEpDevices(const Ort::Env& env) { | ||
| std::vector<Ort::ConstEpDevice> ep_devices = env.GetEpDevices(); | ||
|  | ||
| for (size_t i = 0; i < ep_devices.size(); ++i) { | ||
| auto device = ep_devices[i]; | ||
| std::string device_info_msg = "===== device id " + std::to_string(i) + " ======\n"; | ||
| device_info_msg += "name: " + std::string(device.EpName()) + "\n"; | ||
| device_info_msg += "vendor: " + std::string(device.EpVendor()) + "\n"; | ||
|  | ||
| auto metadata = device.EpMetadata(); | ||
| std::unordered_map<std::string, std::string> metadata_entries = metadata.GetKeyValuePairs(); | ||
| if (!metadata_entries.empty()) { | ||
| device_info_msg += "metadata:\n"; | ||
| } | ||
|  | ||
| for (auto& entry : metadata_entries) { | ||
| device_info_msg += " " + entry.first + ": " + entry.second + "\n"; | ||
| } | ||
| device_info_msg += "\n"; | ||
| fprintf(stdout, "%s", device_info_msg.c_str()); | ||
| } | ||
| } | ||
|  | ||
| void RegisterExecutionProviderLibrary(Ort::Env& env, PerformanceTestConfig& test_config) { | ||
| if (!test_config.plugin_ep_names_and_libs.empty()) { | ||
| std::unordered_map<std::string, std::string> ep_names_to_libs; | ||
| ParseSessionConfigs(ToUTF8String(test_config.plugin_ep_names_and_libs), ep_names_to_libs); | ||
| if (ep_names_to_libs.size() > 0) { | ||
| for (auto& pair : ep_names_to_libs) { | ||
| const std::filesystem::path library_path = pair.second; | ||
| const std::string registration_name = pair.first; | ||
| Ort::Status status(Ort::GetApi().RegisterExecutionProviderLibrary(env, registration_name.c_str(), ToPathString(library_path.string()).c_str())); | ||
| if (status.IsOK()) { | ||
| test_config.registered_plugin_eps.push_back(registration_name); | ||
| } else { | ||
| fprintf(stderr, "Can't register %s plugin library: %s\n", registration_name.c_str(), status.GetErrorMessage().c_str()); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
|  | ||
| void UnregisterExecutionProviderLibrary(Ort::Env& env, PerformanceTestConfig& test_config) { | ||
| for (auto& registration_name : test_config.registered_plugin_eps) { | ||
| Ort::Status status(Ort::GetApi().UnregisterExecutionProviderLibrary(env, registration_name.c_str())); | ||
| if (!status.IsOK()) { | ||
| fprintf(stderr, "%s", status.GetErrorMessage().c_str()); | ||
| } | ||
| } | ||
| } | ||
|  | ||
| std::vector<std::string> ConvertArgvToUtf8Strings(int argc, ORTCHAR_T* argv[]) { | ||
| std::vector<std::string> utf8_args; | ||
| utf8_args.reserve(argc); | ||
| for (int i = 0; i < argc; ++i) { | ||
| std::string utf8_string = ToUTF8String(argv[i]); | ||
|  | ||
| // Abseil flags doens't natively alias "-h" to "--help". | ||
| // We make "-h" alias to "--help" here. | ||
| if (utf8_string == "-h" || utf8_string == "--h") { | ||
| utf8_args.push_back("--help"); | ||
| } else { | ||
| utf8_args.push_back(utf8_string); | ||
| } | ||
| } | ||
| return utf8_args; | ||
| } | ||
|  | ||
| std::vector<char*> CStringsFromStrings(std::vector<std::string>& utf8_args) { | ||
| std::vector<char*> utf8_argv; | ||
| utf8_argv.reserve(utf8_args.size()); | ||
| for (auto& str : utf8_args) { | ||
| utf8_argv.push_back(&str[0]); | ||
| } | ||
| return utf8_argv; | ||
| } | ||
|  | ||
| } // namespace utils | ||
| } // namespace perftest | ||
| } // namespace onnxruntime | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.