Skip to content
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

Add support for parsing AUTO, HETERO and MULTI from json config #605

Open
wants to merge 3 commits into
base: ovep-develop
Choose a base branch
from

Conversation

preetha-intel
Copy link

@preetha-intel preetha-intel commented Mar 6, 2025

Description

Add parsing for different mode execution via config file in OVEP

Motivation and Context

Support for the AUTO properties like ENABLE_RUNTIME_FALLBACK needs to be added in OVEP.

Sample .json file for this feature is :

auto_config.json

{
"AUTO":
{"ENABLE_STARTUP_FALLBACK":"NO",
"ENABLE_RUNTIME_FALLBACK" : "NO",
"EXECUTION_MODE_HINT" : "ACCURACY"}
}

The properties for a specified hardware is obtained from OV. Adding the syntax to print supported OV properties for a device using C++ API

auto device = "AUTO";
auto device_properties = ov::core.get_property(device, ov::supported_properties);
  //print device properties
  std::cout << " Properties for " << device << " : " << std::endl;
  for(auto& it : device_properties) {
    std::cout << it << std::endl;
  }

For checking whether the property is set correctly during OV model compilation, we can get and print the properties from OV compiled model using the below snippet in C++

    // output of the actual settings that the device selected
    auto compiledModel = ov::core.compile_model(onnx_model, ov::Tensor(), hw_target, device_config);
    auto supported_properties = compiledModel.get_property(ov::supported_properties);
    std::cout << "Model:" << std::endl;
    for (const auto& cfg : supported_properties) {
        if (cfg == ov::supported_properties)
            continue;
        auto prop = compiledModel.get_property(cfg);
        if (cfg == ov::device::properties) {
            auto devices_properties = prop.as<ov::AnyMap>();
            for (auto& item : devices_properties) {
                std::cout << "  " << item.first << ": " << std::endl;
                for (auto& item2 : item.second.as<ov::AnyMap>()) {
                    std::cout << "    " << item2.first << ": " << item2.second.as<std::string>() << std::endl;
                }
            }
        } else {
            std::cout << "  " << cfg << ": " << prop.as<std::string>() << std::endl;
        }
    }

HAFP-3004

@sfatimar
Copy link

sfatimar commented Mar 7, 2025

Please list what unit testing you have done for this code fix

@sfatimar
Copy link

Please resolve comments and close on this PR.

@preetha-intel preetha-intel force-pushed the preetha/load_config_support branch 2 times, most recently from ab94d32 to 32770ad Compare March 11, 2025 10:17
@MayureshV1
Copy link

@vthaniel , @jatinwadhwa921 - Can we create a test case for load_config feature and if it exists add AUTO, HETERO, MULTI into the tests.

@preetha-intel . Do we have a methodology to query whether a feature is set correctly in OpenVINO.
For e.g.: If "ENABLE_STARTUP_FALLBACK":"NO", can we query OV to check whether it was disabled?

@preetha-intel
Copy link
Author

@vthaniel , @jatinwadhwa921 - Can we create a test case for load_config feature and if it exists add AUTO, HETERO, MULTI into the tests.

@preetha-intel . Do we have a methodology to query whether a feature is set correctly in OpenVINO. For e.g.: If "ENABLE_STARTUP_FALLBACK":"NO", can we query OV to check whether it was disabled?

There is OPENVIINO_LOG_LEVEL=5 env variable that prints the properties of OV compiled model. But its working only for AUTO and MULTI. Looks like HETERO is broken

@preetha-intel preetha-intel force-pushed the preetha/load_config_support branch 2 times, most recently from f54b772 to 964c89e Compare March 16, 2025 20:33
@TejalKhade28
Copy link

@vthaniel , @jatinwadhwa921 - Can we create a test case for load_config feature and if it exists add AUTO, HETERO, MULTI into the tests.

@preetha-intel . Do we have a methodology to query whether a feature is set correctly in OpenVINO. For e.g.: If "ENABLE_STARTUP_FALLBACK":"NO", can we query OV to check whether it was disabled?

We can test load_config feature for AUTO, MULTI with the OPENVINO_LOG_LEVEL=5 env variable, but this does not work for HETERO. The logs for HETERO are not shown up.

@preetha-intel
Copy link
Author

preetha-intel commented Mar 18, 2025

@TejalKhade28 We can use the LOG_LEVEL config option to get the compiler level debug logs.
Update the json file with

auto_config.json

{
"AUTO":
{"ENABLE_STARTUP_FALLBACK":"NO",
"ENABLE_RUNTIME_FALLBACK" : "NO",
"EXECUTION_MODE_HINT" : "ACCURACY",
"LOG_LEVEL" : "LOG_DEBUG"}
}

@sfatimar
Copy link

@preetha-intel can you please rebase this branch

@preetha-intel preetha-intel force-pushed the preetha/load_config_support branch from 964c89e to 672e506 Compare March 19, 2025 13:41
@preetha-intel
Copy link
Author

@sfatimar Rebased and validated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants