Skip to content

Commit fa47aff

Browse files
committed
Removing the prints
1 parent a9ef66a commit fa47aff

File tree

8 files changed

+30
-21
lines changed

8 files changed

+30
-21
lines changed

onnxruntime/core/providers/openvino/backend_utils.cc

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@ bool IsCILogEnabled() {
3838
return false;
3939
}
4040

41+
std::string get_shapes_string(const reshape_t& shapes) {
42+
std::stringstream ss;
43+
for (auto& shape : shapes) {
44+
if (!ss.str().empty())
45+
ss << ", ";
46+
ss << "\'" << shape.first << "': " << shape.second;
47+
}
48+
return ss.str();
49+
}
50+
4151
std::shared_ptr<const OVNetwork>
4252
CreateOVModel(std::string&& model,
4353
const SessionContext& session_context,
@@ -46,25 +56,29 @@ CreateOVModel(std::string&& model,
4656
std::cout << "CreateNgraphFunc" << std::endl;
4757
}
4858
try {
49-
auto ov_model = OVCore::Get()->ReadModel(std::move(model), session_context.onnx_model_path_name.string());
59+
auto ov_model = OVCore::Get()->ReadModel(std::move(model), session_context.onnx_model_path_name.string());
60+
61+
if (!session_context.affinity.empty()) {
62+
LOGS_DEFAULT(INFO) << log_tag << "Setting the ov nodes to specified affinity";
63+
Set_Affinity(ov_model, session_context);
64+
}
5065

5166
if (!session_context.reshape.empty()) {
5267
LOGS_DEFAULT(INFO) << log_tag << "Reshaping the ov tensor to specified shape";
5368
ov_model->reshape(session_context.reshape);
5469
}
5570

71+
ov::preprocess::PrePostProcessor preproc(ov_model);
72+
ov_model = preproc.build();
73+
74+
5675
if (!session_context.layout.empty()) {
5776
LOGS_DEFAULT(INFO) << log_tag << "Setting the ov tensor layout to specified layout";
5877
ov_model = Set_Layout(ov_model, session_context.layout);
5978
}
6079

61-
if (!session_context.affinity.empty()) {
62-
LOGS_DEFAULT(INFO) << log_tag << "Setting the ov nodes to specified affinity";
63-
Set_Affinity(ov_model, session_context);
64-
}
65-
6680
// Check for Constant Folding
67-
/* if ((session_context.device_type != "NPU") && !session_context.is_wholly_supported_graph) {
81+
if ((session_context.device_type != "NPU") && !session_context.is_wholly_supported_graph) {
6882
ov::pass::ConstantFolding pass_const_obj;
6983
pass_const_obj.run_on_model(ov_model);
7084
auto& results = const_cast<ov::ResultVector&>(ov_model.get()->get_results());
@@ -78,7 +92,7 @@ CreateOVModel(std::string&& model,
7892
}
7993
--index;
8094
}
81-
}*/
95+
}
8296
#ifndef NDEBUG
8397
if (IsDebugEnabled()) {
8498
std::string name = ov_model->get_friendly_name();
@@ -168,10 +182,8 @@ void Set_Affinity(std::shared_ptr<OVNetwork> ov_model, const SessionContext& ses
168182
auto it = session_context.affinity.find(name);
169183
if (it != session_context.affinity.end()) {
170184
ov_node->get_rt_info()["affinity"] = it->second;
171-
//std::cout << "node name " << name << " on " << it->second << "\t";
172185
} else {
173186
ov_node->get_rt_info()["affinity"] = selected_device;
174-
//std::cout << "node name " << name << " on " << selected_device << "\t";
175187
}
176188
}
177189
}

onnxruntime/core/providers/openvino/backend_utils.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ bool IsModelStreamXML(std::istream& model_stream);
108108

109109
void Set_Affinity(std::shared_ptr<OVNetwork> ov_model, const SessionContext& session_context);
110110

111+
std::string get_shapes_string(const reshape_t& shapes);
112+
111113
} // namespace backend_utils
112114
} // namespace openvino_ep
113115
} // namespace onnxruntime

onnxruntime/core/providers/openvino/backends/basic_backend.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ BasicBackend::BasicBackend(std::unique_ptr<ONNX_NAMESPACE::ModelProto>& model_pr
112112
subgraph_context_.subgraph_name);
113113
} else { // For all other types use ov::ov_core read_model() to generate OV IR
114114
// followed by ov::ov_core compile_model()
115-
std::cout << "CreateOVModel\n";
116115
ov_model = CreateOVModel(std::move(model), session_context_, const_outputs_map_);
117116
exe_network_ = OVCore::Get()->CompileModel(
118117
ov_model, hw_target, device_config, enable_causallm, subgraph_context_.subgraph_name);

onnxruntime/core/providers/openvino/backends/basic_backend.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,13 @@ struct OnnxToOvNetworkBindings {
9393
// "Input names mismatch between OpenVINO and ONNX. ", onnx_name,
9494
// " doesn't exist in the list of OpenVINO input tensor names");
9595

96+
if (!matched_names) {
97+
continue;
98+
}
9699
auto ov_param_index = std::distance(ov_parameters.begin(), it);
97-
98100
auto shape = ov_parameters[ov_param_index].get_partial_shape();
99101
auto type = ov_parameters[ov_param_index].get_element_type();
102+
100103
ParameterInfo info{onnx_name, ov_param_index, onnx_param_index, type, ParameterShape{shape}};
101104

102105
// Analyze shape dynamism and set flags
@@ -125,7 +128,7 @@ struct OnnxToOvNetworkBindings {
125128
has_dynamic_io_ = true;
126129
}
127130
}
128-
131+
129132
input_output_map.push_back(std::move(info));
130133
}
131134
};

onnxruntime/core/providers/openvino/openvino_execution_provider.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@ common::Status OpenVINOExecutionProvider::Compile(
185185

186186
for (const auto& fused_node_graph : fused_nodes) {
187187
const GraphViewer& graph_body_viewer = fused_node_graph.filtered_graph;
188-
189188
// Set include_embed_data to true only for the first backend manager
190189
backend_it->TryExportCompiledBlobAsEPCtxNode(graph_body_viewer, is_first);
191190

onnxruntime/core/providers/openvino/openvino_parser_utils.cc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,6 @@ affinity_t OpenVINOParserUtils::ParseAffinity(const std::string& affinity_defini
327327
std::smatch device_match = *device_it;
328328
std::string device_name = device_match[1].str();
329329
std::string nodes_list_str = device_match[2].str();
330-
//std::cout << "device_name " << device_name << "\n";
331-
//std::cout << "nodes_list_str " << nodes_list_str << "\n";
332330
std::stringstream nodes_list(nodes_list_str);
333331
std::string item;
334332

@@ -337,9 +335,6 @@ affinity_t OpenVINOParserUtils::ParseAffinity(const std::string& affinity_defini
337335
}
338336
}
339337

340-
//for (auto item : result_map){
341-
// std::cout << "\n" << item.first << " on " << item.second << "\n";
342-
//}
343338
return result_map;
344339
}
345340

onnxruntime/core/providers/openvino/openvino_provider_factory.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,6 @@ static void ParseProviderInfo(const ProviderOptions& provider_options,
267267
}
268268

269269
if (provider_options.contains("affinity")) {
270-
std::cout << "Provider options contain affinity\n";
271270
pi.affinity = OpenVINOParserUtils::ParseAffinity(provider_options.at("affinity"));
272271
}
273272

onnxruntime/core/providers/openvino/ov_interface.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ std::shared_ptr<OVNetwork> OVCore::ReadModel(std::string&& model, const std::str
8484
ov::frontend::InputModel::Ptr inputModel;
8585

8686
ov::AnyVector params{&modelStream, model_path};
87-
87+
8888
FE = manager.load_by_model(params);
8989
if (FE) {
9090
inputModel = FE->load(params);

0 commit comments

Comments
 (0)