[HETERO] Remove WA for Parameters, Results and Constants. (#15020)

* [HETERO] Remove WA for Parameters, Results and Constants.

* Update HeteroSyntheticTest
This commit is contained in:
Nadezhda Ageeva 2023-01-11 17:45:56 +04:00 committed by GitHub
parent 26934332cd
commit a8a59f3cb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 26 deletions

View File

@ -112,23 +112,6 @@ HeteroExecutableNetwork::HeteroExecutableNetwork(const InferenceEngine::CNNNetwo
return input.get_source_output().get_node();
};
// Set results, constants and parameters affinity
for (auto&& node : clonedFunction->get_ops()) {
if (ngraph::op::is_constant(node) || ngraph::op::is_output(node) || ngraph::op::is_parameter(node)) {
if (!contains(queryNetworkResult.supportedLayersMap, node->get_friendly_name())) {
auto& nodeWithAffinityName =
ngraph::op::is_output(node)
? node->input_value(0).get_node()->get_friendly_name()
: node->output(0).get_target_inputs().begin()->get_node()->get_friendly_name();
auto itAffinity = queryNetworkResult.supportedLayersMap.find(nodeWithAffinityName);
if (itAffinity == queryNetworkResult.supportedLayersMap.end()) {
IE_THROW() << "Node " << nodeWithAffinityName << " was not assigned on any pointed device.";
}
queryNetworkResult.supportedLayersMap.emplace(node->get_friendly_name(), itAffinity->second);
}
}
}
std::unordered_set<std::string> devices;
NodeMap<std::string> affinities;
// Check that all nodes has user or plugin defined affinities

View File

@ -165,20 +165,27 @@ std::string HeteroSyntheticTest::SetUpAffinity() {
auto& pluginParameters = std::get<Plugin>(param);
affinities += "\n{\n";
for (auto&& node : std::get<Function>(param)._function->get_ordered_ops()) {
if (!ngraph::op::is_constant(node) &&
!(ngraph::op::is_parameter(node)) &&
!(ngraph::op::is_output(node))) {
std::string affinity;
auto get_affinity = [&](const std::string& name) {
if (std::get<Function>(param)._majorPluginNodeIds.end() !=
std::get<Function>(param)._majorPluginNodeIds.find(node->get_friendly_name())) {
affinity = pluginParameters.at(0)._name;
std::get<Function>(param)._majorPluginNodeIds.find(name)) {
return pluginParameters.at(0)._name;
} else {
affinity = pluginParameters.at(1)._name;
return pluginParameters.at(1)._name;
}
};
if (ngraph::op::is_constant(node) || ngraph::op::is_output(node) || ngraph::op::is_parameter(node)) {
auto& node_with_affinity_name =
ngraph::op::is_output(node)
? node->input_value(0).get_node()->get_friendly_name()
: node->output(0).get_target_inputs().begin()->get_node()->get_friendly_name();
affinity = get_affinity(node_with_affinity_name);
} else {
affinity = get_affinity(node->get_friendly_name());
}
node->get_rt_info()["affinity"] = affinity;
affinities += "\t{\"" + node->get_friendly_name() + "\",\t\t\"" + affinity + "\"}\n";
}
}
affinities += "}";
affinities += "\nseed = " + std::to_string(std::get<Function>(param)._seed);
return affinities;