From 14c691030f2f0a8de896463e29a8dd342256fc11 Mon Sep 17 00:00:00 2001 From: Scott McKay Date: Tue, 25 Aug 2020 18:10:42 +1000 Subject: [PATCH] Fix build break from removing custom ORT onnx protobuf (#4904) Exclude parsing of json config in model (also excludes json parsing library) --- include/onnxruntime/core/graph/onnx_protobuf.h | 2 ++ onnxruntime/core/framework/execution_provider.cc | 4 ++-- onnxruntime/core/session/inference_session_utils.cc | 6 +++++- onnxruntime/core/session/inference_session_utils.h | 10 ++++++++++ 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/include/onnxruntime/core/graph/onnx_protobuf.h b/include/onnxruntime/core/graph/onnx_protobuf.h index 755edf9784..4092ec19d9 100644 --- a/include/onnxruntime/core/graph/onnx_protobuf.h +++ b/include/onnxruntime/core/graph/onnx_protobuf.h @@ -46,6 +46,8 @@ class OpSchema {}; #endif #include "onnx/onnx_pb.h" +#include "onnx/onnx-operators_pb.h" + #ifdef __GNUC__ #pragma GCC diagnostic pop #else diff --git a/onnxruntime/core/framework/execution_provider.cc b/onnxruntime/core/framework/execution_provider.cc index 54c8e79be4..7964304bd0 100644 --- a/onnxruntime/core/framework/execution_provider.cc +++ b/onnxruntime/core/framework/execution_provider.cc @@ -40,13 +40,13 @@ IExecutionProvider::GetCapability(const onnxruntime::GraphViewer& graph, } } } + + return result; #else ORT_UNUSED_PARAMETER(graph); ORT_UNUSED_PARAMETER(kernel_registries); ORT_NOT_IMPLEMENTED("IExecutionProvider::GetCapability is not supported in this build."); #endif - - return result; } common::Status IExecutionProvider::Sync() const { return Status::OK(); }; diff --git a/onnxruntime/core/session/inference_session_utils.cc b/onnxruntime/core/session/inference_session_utils.cc index 86b108be12..34ca43cefe 100644 --- a/onnxruntime/core/session/inference_session_utils.cc +++ b/onnxruntime/core/session/inference_session_utils.cc @@ -1,6 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +#if !defined(ORT_MINIMAL_BUILD) + #include "core/session/inference_session_utils.h" namespace onnxruntime { @@ -36,7 +38,7 @@ static Status SetInterOpNumThreads(SessionOptions& session_options, } LOGS(logger, INFO) << "Setting inter_op_num_threads to " << value; - session_options.inter_op_param.thread_pool_size= value; + session_options.inter_op_param.thread_pool_size = value; return Status::OK(); } @@ -220,3 +222,5 @@ Status InferenceSessionUtils::ParseRunOptionsFromModelProto(RunOptions& /*run_op } } // namespace onnxruntime + +#endif // !defined(ORT_MINIMAL_BUILD) diff --git a/onnxruntime/core/session/inference_session_utils.h b/onnxruntime/core/session/inference_session_utils.h index 5dbcb4f254..8280dca8a0 100644 --- a/onnxruntime/core/session/inference_session_utils.h +++ b/onnxruntime/core/session/inference_session_utils.h @@ -2,10 +2,18 @@ // Licensed under the MIT License. #pragma once + +// Currently everything here is unused in a minimal build. +// Leaving the file included in case there are other InferenceSession utils needed in a minimal build, as this would +// be the best place to add them. + +#if !defined(ORT_MINIMAL_BUILD) + #include "core/graph/onnx_protobuf.h" #include "core/session/inference_session.h" #include "core/framework/session_options.h" #include "core/common/common.h" + #ifdef _WIN32 #pragma warning(push) #pragma warning(disable : 28020) @@ -53,3 +61,5 @@ class InferenceSessionUtils { }; } // namespace onnxruntime + +#endif // !defined(ORT_MINIMAL_BUILD)