* Hetero 2.0: Implement `hetero::Plugin` * Fix CMakeLists.txt * Remove duplicated "itt.hpp" * Remove extra API method * Delete `HeteroPlugin::Engine` * Intregrate `ov::hetero::Plugin` into `HeteroExeNet` * Use `is_new_api()` * Add `override` modificator * Rename `GetDevicePlugins` to `get_device_properties` * Small fixes * Fix precommit * Fix Import/Export * Fix `import_model()` * Remove extra lines * TEMPORARY disable one test * ClangFormat+Refactoring * Build fix * Update `hetero::Configuration` logic * Update `hetero::Plugin::get_property()` * Fix * Changes after code review * Remove extra comments * Revert "TEMPORARY disable one test" This reverts commit 13fa48d8102ec5146e79987835e6f7444e469f7a. * Small fix * Refactoring + Fixes * Add `hetero::Plugin::device_supports_model_caching` * Replace `device_supports_model_caching` with ICore impl * Code review changes * Rework `Configuration` * Implement `hetero::CompiledModel` * Fix caching_test * ClangFormat * Fix inputs/outputs mapping After some fix in ICompiledModel, m_inputs != model->inputs, so mapping was updated to be independent from m_inputs (same for m_outputs) * Fix types * Update `get_runtime_model()` * Remove `ngraph` and `IE_THROW` * Implement Hetero Sync/Async Infer Requests * A lot of changes * Add `submodels_output_to_input` to import/export * Implement `get_tensors()`/`set_tensors()` * Fix `Configuration` ctor * Skip `SetPreProcessTo` legacy tests for hetero * Change `Output->Input` logic to `Input->PrevOutput` because for one output may be several inputs (map key collision) * Update `CompiledModel` to use shared_ptr vs * * Update `CompiledModel` public/private members * Names refactoring * Optimize imports * Fix properties for `query_model()` call * Use static objects in `Configuration` methods * `Configuration` refactoring * Get `ov::supported_properties` from subdevices * InferRequest +1 import and fwd declaration * Update `InferRequest` prof_info, remove extra methods * Remove `InferRequestDesc` * Remove `InferRequest::cancel()` * Update CMakeLists.txt * Remove extra `catch` in `CompiledModel` * Replace `InferenceEngine::details::contains()` * ClangFormat * Use `const auto&` * Try to fix types * Remove `friendly_name` for subgraphs connection * Remove TODO comment * Remove `CompiledModel::m_model` as unused * Polish .hpp files * Fix size_t serialization in `CompiledModel::export_model()` * Minor changes * Move `intersect*` IE utils to anonym namespace * Use `const auto&` * Update Hetero `get_profiling_info()` * Minor changes * Rename `deviceName` to `device_name` * Add `hetero::VariableState` in order to hold HW so * Port internal properties to `ov::internal` * Add `CompiledModel::set_inputs_and_outputs()` * Add `OPENVINO_SUPPRESS_DEPRECATED_*` * Fix CompiledModel `ov::device::properties` issue * Use `get_device_name()` instead of hardcoded name * Make `get_profiling_info()` names bwd compatible * Remove `include` folder * Remove try/catch from CompiledModel * Update error message * `CompiledModel::set_property` throw not implemented
OpenVINO Hetero Plugin Design Overview
Subgraphs selection
Algorithm:
For each plugin
- Select root node
- A node not in a previously constructed subgraph
- Affinity is equal to the plugin name
- Select an adjacent node to any node in a present subgraph which is not on the rejected list
- If there are no such nodes end
- Verify that the selected node has the same affinity
- Add a node to a subgraph if the check has been successful or add to the rejected list otherwise
- Check a global condition
- Nodes in the rejected list can never be added to a subgraph
- Nodes not in a subgraph and not in the rejected list can possibly be added later
- Check the subgraph topology (the only check now is whether there are no indirect subgraph self-references)
- If a global condition has failed, remove the last node from a subgraph. Add it to the rejected list and go to step 5.
- we can rollback multiple times here because rejected list is changed every time
- Go to step 2
Example:
graph TD;
1-->2;
2-->3;
2-->4;
3-->5;
4-->5;
5-->6;
6-->7;
Nodes [1,2,3,5,6,7] are supported in the plugin, [4] is not
Possible roots: [1,2,3,5,6,7]
- Select root [1]
- Subgraph: [1]
- Rejected: []
- Global condition: ok
- Merge [2]
- Subgraph: [1,2]
- Rejected: []
- Global condition: ok
- Merge [3]
- Subgraph: [1,2,3]
- Rejected: []
- Global condition: ok
- Merge [5]
- Subgraph: [1,2,3,5]
- Rejected: []
- Global condition: There are possible self-references throughout a node [4] but they are not known yet, ok
- Merge [6]
- Subgraph: [1,2,3,5,6]
- Rejected: []
- Global condition: There are possible self-references throughout a node [4] but they are not known yet, ok
- Merge [7]
- Subgraph: [1,2,3,5,6,7]
- Rejected: []
- Global condition: There are possible self-references throughout a node [4] but they are not known yet, ok
- Failed to merge [4]
- Subgraph: [1,2,3,5,6,7]
- Rejected: [4]
- Global condition: There are self-references throughout a node [4], reject
- Rollback [7]
- Subgraph: [1,2,3,5,6]
- Rejected: [4,7]
- Global condition: There are self-references throughout a node [4], reject
- Rollback [6]
- Subgraph: [1,2,3,5]
- Rejected: [4,6,7]
- Global condition: There are self-references throughout a node [4], reject
- Rollback [5]
- Subgraph: [1,2,3]
- Rejected: [4,5,6,7]
- Global condition: ok
- There are nodes to merge end
Possible roots: [5,6,7]
- Select root [5]
- Subgraph: [5]
- Rejected: []
- Global condition: ok
- Merge [6]
- Subgraph: [5,6]
- Rejected: []
- Global condition: ok
- Merge [7]
- Subgraph: [5,6,7]
- Rejected: []
- Global condition: ok
- Merge [3]
- Subgraph: [3,5,6,7]
- Rejected: []
- Global condition: ok
- Merge [2]
- Subgraph: [2,3,5,6,7]
- Rejected: []
- Global condition: There are possible self-references throughout a node [4] but they are not known yet, ok
- Failed to merge [4]
- Subgraph: [2,3,5,6,7]
- Rejected: [4]
- Global condition: There are self-references throughout a node [4], reject
- Rollback [2]
- Subgraph: [3,5,6,7]
- Rejected: [2,4]
- Global condition: ok
- There are nodes to merge end
Possible roots: [] no roots, END
Subgraphs: [1,2,3], [3,5,6,7]
Select best subgraph:
- When there are multiple subgraphs, a larger one ([3,5,6,7]) is always selected.
Repeat previous steps with remaining nodes [1,2]
The final result is:
- First plugin: [3,5,6,7], [1,2]
- Second plugin: [4]
Subgraphs self reference detection
- For each node in a network build a list of reachable nodes (transitive closure).
- For each pair of nodes in a subgraph find
pathnodes (nodes through one node in pair reachable to other).- assume
src- one node in a pair,dst- other node in a pair - get all reachable nodes from
src - in the nodes find nodes through which you can reach
dst. These will be thepathnodes.
- assume
- Results for pairs are cached.
- Check whether there is an intersection between
pathnodes set and rejected nodes set for each pair of nodes in a subgraph. - If an intersection happens, a self-reference occurs, and a subgraph is invalid.