Remove NGRAPH_USE_PROTOBUF_LITE option, always use Lite (#8286)
This commit is contained in:
@@ -4,11 +4,9 @@ jobs:
|
||||
matrix:
|
||||
Release:
|
||||
BUILD_TYPE: 'Release'
|
||||
PROTOBUF_LITE: 'ON'
|
||||
TOX_COMMAND: 'tox && tox -e zoo_models'
|
||||
Debug:
|
||||
BUILD_TYPE: 'Debug'
|
||||
PROTOBUF_LITE: 'ON'
|
||||
TOX_COMMAND: 'tox'
|
||||
maxParallel: 2
|
||||
|
||||
@@ -77,10 +75,10 @@ jobs:
|
||||
condition: ne(variables['BUILD_TYPE'], 'Debug')
|
||||
|
||||
- script: sudo docker build --tag=openvino-onnx-ci-image --file=.ci/openvino-onnx/Dockerfile --build-arg BUILD_TYPE=$(BUILD_TYPE) --build-arg PROTOBUF_LITE=$(PROTOBUF_LITE) .
|
||||
displayName: 'Docker build $(BUILD_TYPE) protobuf-lite: $(PROTOBUF_LITE)'
|
||||
displayName: 'Docker build $(BUILD_TYPE)'
|
||||
|
||||
- script: sudo fallocate -l 64G /swapfile ; sudo mkswap /swapfile ; sudo swapon /swapfile ; df ; free -h
|
||||
displayName: 'Create swap'
|
||||
|
||||
- script: sudo docker run --name openvino-onnx-ci-container --volume $(MODELS_DIR)/models_data/model_zoo/onnx_model_zoo_$(ONNX_MODEL_ZOO_SHA):/root/.onnx/model_zoo/onnx_model_zoo --volume $(MODELS_DIR)/msft:/root/.onnx/model_zoo/MSFT openvino-onnx-ci-image /bin/bash -c "$(TOX_COMMAND)"
|
||||
displayName: 'Docker run $(BUILD_TYPE) protobuf-lite: $(PROTOBUF_LITE)'
|
||||
displayName: 'Docker run $(BUILD_TYPE)'
|
||||
|
||||
@@ -4,7 +4,6 @@ LABEL version=2021.03.30.1
|
||||
|
||||
# Build configuration arguments
|
||||
ARG BUILD_TYPE=Release
|
||||
ARG PROTOBUF_LITE=ON
|
||||
|
||||
ARG http_proxy
|
||||
ARG https_proxy
|
||||
@@ -69,8 +68,7 @@ RUN cmake .. \
|
||||
-DPYTHON_EXECUTABLE=/usr/bin/python3 \
|
||||
-DNGRAPH_ONNX_FRONTEND_ENABLE=ON \
|
||||
-DOPENVINO_DEBUG_ENABLE=OFF \
|
||||
-DCMAKE_INSTALL_PREFIX=/openvino/dist \
|
||||
-DNGRAPH_USE_PROTOBUF_LITE=${PROTOBUF_LITE}
|
||||
-DCMAKE_INSTALL_PREFIX=/openvino/dist
|
||||
RUN make -j $(nproc) install
|
||||
|
||||
# Run tests via tox
|
||||
|
||||
6
.ci/openvino-onnx/Jenkinsfile
vendored
6
.ci/openvino-onnx/Jenkinsfile
vendored
@@ -6,9 +6,8 @@ DOCKER_IMAGE_TAG = "openvino-onnx-ci-image"
|
||||
ONNX_MODEL_ZOO_SHA = "d58213534f2a4d1c4b19ba62b3bb5f544353256e"
|
||||
|
||||
BACKEND_CONFIGURATIONS = [
|
||||
[ name: "Release", build_type: "Release", protobuf_lite : "OFF" ],
|
||||
[ name: "Debug", build_type: "Debug", protobuf_lite : "OFF" ],
|
||||
[ name: "Rel_Lite", build_type: "Release", protobuf_lite : "ON" ],
|
||||
[ name: "Release", build_type: "Release" ],
|
||||
[ name: "Debug", build_type: "Debug" ],
|
||||
]
|
||||
|
||||
// workaround for aborting previous builds on PR update
|
||||
@@ -111,7 +110,6 @@ def buildDockerImage(Map configuration, String workdir) {
|
||||
sh """
|
||||
docker build --tag=${docker_image_tag} \
|
||||
--build-arg BUILD_TYPE=${configuration.build_type} \
|
||||
--build-arg PROTOBUF_LITE=${configuration.protobuf_lite} \
|
||||
--file=.ci/openvino-onnx/Dockerfile \
|
||||
--build-arg http_proxy=${HTTP_PROXY} \
|
||||
--build-arg https_proxy=${HTTPS_PROXY} .
|
||||
|
||||
@@ -136,8 +136,6 @@ ie_dependent_option(NGRAPH_ONNX_FRONTEND_ENABLE "Enable ONNX FrontEnd" ON "proto
|
||||
ie_dependent_option(NGRAPH_PDPD_FRONTEND_ENABLE "Enable PaddlePaddle FrontEnd" ON "protoc_available" OFF)
|
||||
ie_option(NGRAPH_IR_FRONTEND_ENABLE "Enable IR FrontEnd" ON)
|
||||
ie_dependent_option(NGRAPH_TF_FRONTEND_ENABLE "Enable TensorFlow FrontEnd" ON "protoc_available" OFF)
|
||||
ie_dependent_option(NGRAPH_USE_PROTOBUF_LITE "Compiles and links with protobuf-lite" ON
|
||||
"NGRAPH_ONNX_FRONTEND_ENABLE" OFF)
|
||||
ie_dependent_option(NGRAPH_USE_SYSTEM_PROTOBUF "Use system protobuf" OFF
|
||||
"NGRAPH_ONNX_FRONTEND_ENABLE OR NGRAPH_PDPD_FRONTEND_ENABLE OR NGRAPH_TF_FRONTEND_ENABLE" OFF)
|
||||
ie_dependent_option(NGRAPH_UNIT_TEST_ENABLE "Enables ngraph unit tests" ON "ENABLE_TESTS;NOT ANDROID" OFF)
|
||||
|
||||
@@ -51,9 +51,6 @@ target_include_directories(${TARGET_NAME} PUBLIC $<BUILD_INTERFACE:${ONNX_FRONTE
|
||||
target_include_directories(${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||
|
||||
target_compile_definitions(${TARGET_NAME} PRIVATE ONNX_OPSET_VERSION=${ONNX_OPSET_VERSION})
|
||||
if(NGRAPH_USE_PROTOBUF_LITE)
|
||||
target_compile_definitions(${TARGET_NAME} PRIVATE NGRAPH_USE_PROTOBUF_LITE)
|
||||
endif()
|
||||
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES EXPORT_NAME frontend::onnx)
|
||||
install(TARGETS ${TARGET_NAME} EXPORT OpenVINOTargets
|
||||
|
||||
@@ -28,12 +28,7 @@ namespace error {
|
||||
namespace attribute {
|
||||
namespace detail {
|
||||
struct Attribute : ngraph_error {
|
||||
#ifdef NGRAPH_USE_PROTOBUF_LITE
|
||||
Attribute(const std::string& msg, AttributeProto_AttributeType type) : ngraph_error{msg} {}
|
||||
#else
|
||||
Attribute(const std::string& msg, AttributeProto_AttributeType type)
|
||||
: ngraph_error{msg + ": " + ONNX_NAMESPACE::AttributeProto_AttributeType_Name(type)} {}
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
@@ -29,23 +29,11 @@ using TensorProto_DataType = decltype(ONNX_NAMESPACE::TensorProto{}.data_type())
|
||||
namespace error {
|
||||
namespace tensor {
|
||||
struct invalid_data_type : ngraph_error {
|
||||
#ifdef NGRAPH_USE_PROTOBUF_LITE
|
||||
explicit invalid_data_type(TensorProto_DataType type) : ngraph_error{"invalid data type"} {}
|
||||
#else
|
||||
explicit invalid_data_type(TensorProto_DataType type)
|
||||
: ngraph_error{"invalid data type: " + ONNX_NAMESPACE::TensorProto_DataType_Name(
|
||||
static_cast<ONNX_NAMESPACE::TensorProto_DataType>(type))} {}
|
||||
#endif
|
||||
};
|
||||
|
||||
struct unsupported_data_type : ngraph_error {
|
||||
#ifdef NGRAPH_USE_PROTOBUF_LITE
|
||||
explicit unsupported_data_type(TensorProto_DataType type) : ngraph_error{"unsupported data type"} {}
|
||||
#else
|
||||
explicit unsupported_data_type(TensorProto_DataType type)
|
||||
: ngraph_error{"unsupported data type: " + ONNX_NAMESPACE::TensorProto_DataType_Name(
|
||||
static_cast<ONNX_NAMESPACE::TensorProto_DataType>(type))} {}
|
||||
#endif
|
||||
};
|
||||
|
||||
struct unspecified_name : ngraph_error {
|
||||
|
||||
@@ -43,13 +43,7 @@ const ngraph::element::Type& get_ngraph_element_type(int64_t onnx_type) {
|
||||
case ONNX_NAMESPACE::TensorProto_DataType_BFLOAT16:
|
||||
return element::bf16;
|
||||
}
|
||||
#ifdef NGRAPH_USE_PROTOBUF_LITE
|
||||
throw ngraph_error("unsupported element type");
|
||||
#else
|
||||
throw ngraph_error(
|
||||
"unsupported element type: " +
|
||||
ONNX_NAMESPACE::TensorProto_DataType_Name(static_cast<ONNX_NAMESPACE::TensorProto_DataType>(onnx_type)));
|
||||
#endif
|
||||
}
|
||||
|
||||
std::shared_ptr<ngraph::Node> get_monotonic_range_along_node_rank(const Output<ngraph::Node>& value,
|
||||
|
||||
@@ -29,9 +29,4 @@ target_link_libraries(${TARGET_NAME} PRIVATE ngraph)
|
||||
link_system_libraries(${TARGET_NAME} PUBLIC onnx_proto onnx ${Protobuf_LITE_LIBRARIES})
|
||||
|
||||
target_include_directories(${TARGET_NAME} PRIVATE ${ONNX_COMMON_SRC_DIR})
|
||||
|
||||
if(NGRAPH_USE_PROTOBUF_LITE)
|
||||
target_compile_definitions(${TARGET_NAME} PRIVATE NGRAPH_USE_PROTOBUF_LITE)
|
||||
endif()
|
||||
|
||||
add_clang_format_target(${TARGET_NAME}_clang FOR_TARGETS ${TARGET_NAME})
|
||||
|
||||
@@ -53,20 +53,8 @@ ONNX_NAMESPACE::ModelProto parse_from_istream(std::istream& model_stream) {
|
||||
|
||||
ONNX_NAMESPACE::ModelProto model_proto;
|
||||
if (!model_proto.ParseFromIstream(&model_stream)) {
|
||||
#ifdef NGRAPH_USE_PROTOBUF_LITE
|
||||
throw ngraph_error("Error during import of ONNX model provided as input stream "
|
||||
" with binary protobuf message.");
|
||||
#else
|
||||
// Rewind to the beginning and clear stream state.
|
||||
model_stream.clear();
|
||||
model_stream.seekg(0);
|
||||
google::protobuf::io::IstreamInputStream iistream(&model_stream);
|
||||
// Try parsing input as a prototxt message
|
||||
if (!google::protobuf::TextFormat::Parse(&iistream, &model_proto)) {
|
||||
throw ngraph_error("Error during import of ONNX model provided as input stream with prototxt "
|
||||
"protobuf message.");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return model_proto;
|
||||
|
||||
@@ -45,13 +45,7 @@ size_t get_onnx_data_size(int32_t onnx_type) {
|
||||
case ONNX_NAMESPACE::TensorProto_DataType_BFLOAT16:
|
||||
return sizeof(uint16_t);
|
||||
}
|
||||
#ifdef NGRAPH_USE_PROTOBUF_LITE
|
||||
throw ngraph_error("unsupported element type");
|
||||
#else
|
||||
throw ngraph_error(
|
||||
"unsupported element type: " +
|
||||
ONNX_NAMESPACE::TensorProto_DataType_Name(static_cast<ONNX_NAMESPACE::TensorProto_DataType>(onnx_type)));
|
||||
#endif
|
||||
}
|
||||
namespace {
|
||||
using namespace ONNX_NAMESPACE;
|
||||
|
||||
Reference in New Issue
Block a user