Skip to content

Commit 4421e5a

Browse files
saurabhkale17sfatimar
authored andcommitted
incorporate requested changes for PR:24394 (#661)
Co-authored-by: sfatimar <[email protected]>
1 parent 5778333 commit 4421e5a

File tree

4 files changed

+11
-14
lines changed

4 files changed

+11
-14
lines changed

cmake/onnxruntime_providers_openvino.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
set_target_properties(onnxruntime_providers_openvino PROPERTIES FOLDER "ONNXRuntime")
4747

4848
target_compile_options(onnxruntime_providers_openvino PRIVATE
49-
$<$<NOT:$<CONFIG:Release>>:-DNOT_RELEASE>
49+
$<$<CONFIG:Release>:-DRELEASE>
5050
)
5151

5252
if(NOT MSVC)

onnxruntime/core/providers/openvino/backend_manager.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include "core/providers/openvino/ov_interface.h"
2121
#include "core/providers/openvino/ov_versions/capability.h"
2222
#include "core/providers/openvino/qdq_transformations/qdq_stripping.h"
23-
#include "core/providers/openvino/ov_interface.h"
2423

2524
namespace onnxruntime {
2625
namespace openvino_ep {
@@ -325,7 +324,7 @@ static bool IsQDQGraph(const onnxruntime::GraphViewer& graph_viewer) {
325324
static void DumpOpenVINOEPModel([[maybe_unused]] const std::filesystem::path& onnx_model_path_name,
326325
[[maybe_unused]] ONNX_NAMESPACE::ModelProto* model_proto,
327326
[[maybe_unused]] const onnxruntime::Node& fused_node) {
328-
#ifdef NOT_RELEASE
327+
#ifndef RELEASE
329328
if (openvino_ep::backend_utils::IsDebugEnabled()) {
330329
auto model_name = onnx_model_path_name.empty() ? "unknown.onnx" : onnx_model_path_name.filename();
331330

@@ -385,7 +384,7 @@ BackendManager::GetModelProtoFromFusedNode(const onnxruntime::Node& fused_node,
385384
if (session_context_.device_type.find("NPU") != std::string::npos &&
386385
(enable_ovep_qdq_optimizer || session_context_.so_share_ep_contexts)) {
387386
std::unique_ptr<onnxruntime::Model> model;
388-
Status status = CreateModelWithStrippedQDQNodes(subgraph, logger, session_context_.so_share_ep_contexts, model, shared_context_.shared_weights, enable_ovep_qdq_optimizer);
387+
Status status = CreateModelWithStrippedQDQNodes(subgraph, logger, session_context_.so_share_ep_contexts, enable_ovep_qdq_optimizer, model, shared_context_.shared_weights);
389388
auto model_proto = model->ToProto();
390389
model_proto->set_ir_version(ONNX_NAMESPACE::Version::IR_VERSION);
391390
print_model_proto_duration();

onnxruntime/core/providers/openvino/qdq_transformations/qdq_stripping.cc

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -449,8 +449,8 @@ static bool HandleDoubleQDQ(onnxruntime::Graph& dst_graph, const onnxruntime::Gr
449449
static void AddStandaloneNodeUnit(onnxruntime::Graph& dst_graph, const onnxruntime::GraphViewer& src_graph,
450450
const NodeUnit& node_unit,
451451
std::set<std::string>& initializers_to_keep,
452-
const logging::Logger& /* logger */,
453-
bool IsWeightSharingWithoutOVEPQDQStripping) {
452+
bool IsWeightSharingWithoutOVEPQDQStripping,
453+
const logging::Logger& /* logger */) {
454454
assert(node_unit.UnitType() == NodeUnit::Type::SingleNode);
455455

456456
// this is the scenario where WAI is enabled and ovep stripping is disabled
@@ -521,8 +521,8 @@ static void AddQDQNodeUnit(onnxruntime::Graph& dst_graph,
521521
const onnxruntime::GraphViewer& src_graph,
522522
const NodeUnit& node_unit,
523523
std::set<std::string>& initializers_to_keep,
524-
const logging::Logger& /* logger */,
525-
bool IsWeightSharingWithoutOVEPQDQStripping) {
524+
bool IsWeightSharingWithoutOVEPQDQStripping,
525+
const logging::Logger& /* logger */) {
526526
assert(node_unit.UnitType() == NodeUnit::Type::QDQGroup);
527527

528528
// Collect inputs coming into the node unit.
@@ -683,8 +683,7 @@ Status CreateModelWithStrippedQDQNodes(const GraphViewer& src_graph,
683683
bool enable_ovep_weight_sharing,
684684
bool enable_ovep_qdq_optimizer,
685685
/*out*/ std::unique_ptr<onnxruntime::Model>& model,
686-
/*out*/ sw& shared_weights,
687-
bool enable_ovep_qdq_optimizer) {
686+
/*out*/ sw& shared_weights) {
688687
// NOTE: This function is a re-implementation of GraphViewerToProto() in core/graph/graph_proto_serializer.cc
689688
// with the following differences:
690689
// - Uses onnxruntime::Graph APIs instead of onnx::GraphProto APIs.
@@ -778,9 +777,9 @@ Status CreateModelWithStrippedQDQNodes(const GraphViewer& src_graph,
778777
bool IsWeightSharingWithoutOVEPQDQStripping = enable_ovep_weight_sharing && !enable_ovep_qdq_optimizer;
779778

780779
if (node_unit->UnitType() == NodeUnit::Type::SingleNode) {
781-
AddStandaloneNodeUnit(dst_graph, src_graph, *node_unit, initializers_to_keep, logger, IsWeightSharingWithoutOVEPQDQStripping);
780+
AddStandaloneNodeUnit(dst_graph, src_graph, *node_unit, initializers_to_keep, IsWeightSharingWithoutOVEPQDQStripping, logger);
782781
} else {
783-
AddQDQNodeUnit(dst_graph, src_graph, *node_unit, initializers_to_keep, logger, IsWeightSharingWithoutOVEPQDQStripping);
782+
AddQDQNodeUnit(dst_graph, src_graph, *node_unit, initializers_to_keep, IsWeightSharingWithoutOVEPQDQStripping, logger);
784783
}
785784

786785
seen_node_units.insert(node_unit);

onnxruntime/core/providers/openvino/qdq_transformations/qdq_stripping.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ Status CreateModelWithStrippedQDQNodes(const GraphViewer& src_graph,
1818
bool enable_ovep_weight_sharing,
1919
bool enable_ovep_qdq_optimizer,
2020
/*out*/ std::unique_ptr<onnxruntime::Model>& model,
21-
/*out*/ sw& shared_weights,
22-
bool enable_ovep_qdq_optimizer);
21+
/*out*/ sw& shared_weights);
2322

2423
bool dumpMetaDataMapToBinary(const sw::Metadata::Map& shared_weights, const std::string& filename);
2524
} // namespace openvino_ep

0 commit comments

Comments
 (0)