Skip to content

incorporate requested changes for PR:24394 #661

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmake/onnxruntime_providers_openvino.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
set_target_properties(onnxruntime_providers_openvino PROPERTIES FOLDER "ONNXRuntime")

target_compile_options(onnxruntime_providers_openvino PRIVATE
$<$<NOT:$<CONFIG:Release>>:-DNOT_RELEASE>
$<$<CONFIG:Release>:-DRELEASE>
)

if(NOT MSVC)
Expand Down
12 changes: 6 additions & 6 deletions onnxruntime/core/providers/openvino/backend_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
#include <istream>

#include "core/providers/shared_library/provider_api.h"
#include "core/providers/openvino/ov_versions/capability.h"
#include "core/providers/openvino/contexts.h"
#include "core/providers/openvino/backend_manager.h"
#include "core/providers/openvino/ibackend.h"
#include "core/providers/openvino/backend_utils.h"
#include "core/providers/openvino/qdq_transformations/qdq_stripping.h"
#include "core/providers/openvino/contexts.h"
#include "core/providers/openvino/ibackend.h"
#include "core/providers/openvino/ov_interface.h"
#include "core/providers/openvino/ov_versions/capability.h"
#include "core/providers/openvino/qdq_transformations/qdq_stripping.h"

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

Expand Down Expand Up @@ -384,7 +384,7 @@ BackendManager::GetModelProtoFromFusedNode(const onnxruntime::Node& fused_node,
if (session_context_.device_type.find("NPU") != std::string::npos &&
(enable_ovep_qdq_optimizer || session_context_.so_share_ep_contexts)) {
std::unique_ptr<onnxruntime::Model> model;
Status status = CreateModelWithStrippedQDQNodes(subgraph, logger, session_context_.so_share_ep_contexts, model, shared_context_.shared_weights, enable_ovep_qdq_optimizer);
Status status = CreateModelWithStrippedQDQNodes(subgraph, logger, session_context_.so_share_ep_contexts, enable_ovep_qdq_optimizer, model, shared_context_.shared_weights);
auto model_proto = model->ToProto();
model_proto->set_ir_version(ONNX_NAMESPACE::Version::IR_VERSION);
print_model_proto_duration();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,8 @@ static bool HandleDoubleQDQ(onnxruntime::Graph& dst_graph, const onnxruntime::Gr
static void AddStandaloneNodeUnit(onnxruntime::Graph& dst_graph, const onnxruntime::GraphViewer& src_graph,
const NodeUnit& node_unit,
std::set<std::string>& initializers_to_keep,
const logging::Logger& /* logger */,
bool IsWeightSharingWithoutOVEPQDQStripping) {
bool IsWeightSharingWithoutOVEPQDQStripping,
const logging::Logger& /* logger */) {
assert(node_unit.UnitType() == NodeUnit::Type::SingleNode);

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

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

if (node_unit->UnitType() == NodeUnit::Type::SingleNode) {
AddStandaloneNodeUnit(dst_graph, src_graph, *node_unit, initializers_to_keep, logger, IsWeightSharingWithoutOVEPQDQStripping);
AddStandaloneNodeUnit(dst_graph, src_graph, *node_unit, initializers_to_keep, IsWeightSharingWithoutOVEPQDQStripping, logger);
} else {
AddQDQNodeUnit(dst_graph, src_graph, *node_unit, initializers_to_keep, logger, IsWeightSharingWithoutOVEPQDQStripping);
AddQDQNodeUnit(dst_graph, src_graph, *node_unit, initializers_to_keep, IsWeightSharingWithoutOVEPQDQStripping, logger);
}

seen_node_units.insert(node_unit);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ using sw = SharedContext::SharedWeights;
Status CreateModelWithStrippedQDQNodes(const GraphViewer& src_graph,
const logging::Logger& logger,
bool enable_ovep_weight_sharing,
bool enable_ovep_qdq_optimizer,
/*out*/ std::unique_ptr<onnxruntime::Model>& model,
/*out*/ sw& shared_weights,
bool enable_ovep_qdq_optimizer);
/*out*/ sw& shared_weights);

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