Skip to content

Commit 7401335

Browse files
incorporate requested changes for PR:24394 (#661)
Co-authored-by: sfatimar <[email protected]>
1 parent 4c0acd8 commit 7401335

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

cmake/onnxruntime_providers_openvino.cmake

+1-1
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

+6-6
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
#include <istream>
1414

1515
#include "core/providers/shared_library/provider_api.h"
16-
#include "core/providers/openvino/ov_versions/capability.h"
17-
#include "core/providers/openvino/contexts.h"
1816
#include "core/providers/openvino/backend_manager.h"
19-
#include "core/providers/openvino/ibackend.h"
2017
#include "core/providers/openvino/backend_utils.h"
21-
#include "core/providers/openvino/qdq_transformations/qdq_stripping.h"
18+
#include "core/providers/openvino/contexts.h"
19+
#include "core/providers/openvino/ibackend.h"
2220
#include "core/providers/openvino/ov_interface.h"
21+
#include "core/providers/openvino/ov_versions/capability.h"
22+
#include "core/providers/openvino/qdq_transformations/qdq_stripping.h"
2323

2424
namespace onnxruntime {
2525
namespace openvino_ep {
@@ -324,7 +324,7 @@ static bool IsQDQGraph(const onnxruntime::GraphViewer& graph_viewer) {
324324
static void DumpOpenVINOEPModel([[maybe_unused]] const std::filesystem::path& onnx_model_path_name,
325325
[[maybe_unused]] ONNX_NAMESPACE::ModelProto* model_proto,
326326
[[maybe_unused]] const onnxruntime::Node& fused_node) {
327-
#ifdef NOT_RELEASE
327+
#ifndef RELEASE
328328
if (openvino_ep::backend_utils::IsDebugEnabled()) {
329329
auto model_name = onnx_model_path_name.empty() ? "unknown.onnx" : onnx_model_path_name.filename();
330330

@@ -384,7 +384,7 @@ BackendManager::GetModelProtoFromFusedNode(const onnxruntime::Node& fused_node,
384384
if (session_context_.device_type.find("NPU") != std::string::npos &&
385385
(enable_ovep_qdq_optimizer || session_context_.so_share_ep_contexts)) {
386386
std::unique_ptr<onnxruntime::Model> model;
387-
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);
388388
auto model_proto = model->ToProto();
389389
model_proto->set_ir_version(ONNX_NAMESPACE::Version::IR_VERSION);
390390
print_model_proto_duration();

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

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

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

527527
// Collect inputs coming into the node unit.
@@ -684,9 +684,9 @@ static void AddInitializerAsInput(onnxruntime::Graph& dst_graph,
684684
Status CreateModelWithStrippedQDQNodes(const GraphViewer& src_graph,
685685
const logging::Logger& logger,
686686
bool enable_ovep_weight_sharing,
687+
bool enable_ovep_qdq_optimizer,
687688
/*out*/ std::unique_ptr<onnxruntime::Model>& model,
688-
/*out*/ sw& shared_weights,
689-
bool enable_ovep_qdq_optimizer) {
689+
/*out*/ sw& shared_weights) {
690690
// NOTE: This function is a re-implementation of GraphViewerToProto() in core/graph/graph_proto_serializer.cc
691691
// with the following differences:
692692
// - Uses onnxruntime::Graph APIs instead of onnx::GraphProto APIs.
@@ -780,9 +780,9 @@ Status CreateModelWithStrippedQDQNodes(const GraphViewer& src_graph,
780780
bool IsWeightSharingWithoutOVEPQDQStripping = enable_ovep_weight_sharing && !enable_ovep_qdq_optimizer;
781781

782782
if (node_unit->UnitType() == NodeUnit::Type::SingleNode) {
783-
AddStandaloneNodeUnit(dst_graph, src_graph, *node_unit, initializers_to_keep, logger, IsWeightSharingWithoutOVEPQDQStripping);
783+
AddStandaloneNodeUnit(dst_graph, src_graph, *node_unit, initializers_to_keep, IsWeightSharingWithoutOVEPQDQStripping, logger);
784784
} else {
785-
AddQDQNodeUnit(dst_graph, src_graph, *node_unit, initializers_to_keep, logger, IsWeightSharingWithoutOVEPQDQStripping);
785+
AddQDQNodeUnit(dst_graph, src_graph, *node_unit, initializers_to_keep, IsWeightSharingWithoutOVEPQDQStripping, logger);
786786
}
787787

788788
seen_node_units.insert(node_unit);

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ using sw = SharedContext::SharedWeights;
1616
Status CreateModelWithStrippedQDQNodes(const GraphViewer& src_graph,
1717
const logging::Logger& logger,
1818
bool enable_ovep_weight_sharing,
19+
bool enable_ovep_qdq_optimizer,
1920
/*out*/ std::unique_ptr<onnxruntime::Model>& model,
20-
/*out*/ sw& shared_weights,
21-
bool enable_ovep_qdq_optimizer);
21+
/*out*/ sw& shared_weights);
2222

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

0 commit comments

Comments
 (0)