Introduced cmake flag to control ONNX Editor build (#5081)

This commit is contained in:
Mateusz Bencer 2021-04-07 12:25:35 +02:00 committed by GitHub
parent 519d9dc050
commit f60c45b788
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 25 additions and 5 deletions

View File

@ -93,6 +93,7 @@ jobs:
-DENABLE_SPEECH_DEMO=OFF
-DENABLE_PYTHON=ON
-DNGRAPH_ONNX_IMPORT_ENABLE=ON
-DNGRAPH_ONNX_EDITOR_ENABLE=ON
-DNGRAPH_INTERPRETER_ENABLE=ON
-DNGRAPH_DEBUG_ENABLE=OFF
-DNGRAPH_DYNAMIC_COMPONENTS_ENABLE=ON

View File

@ -69,6 +69,7 @@ RUN cmake .. \
-DENABLE_PYTHON=ON \
-DPYTHON_EXECUTABLE=/usr/bin/python3 \
-DNGRAPH_ONNX_IMPORT_ENABLE=ON \
-DNGRAPH_ONNX_EDITOR_ENABLE=ON \
-DNGRAPH_INTERPRETER_ENABLE=ON \
-DNGRAPH_DEBUG_ENABLE=OFF \
-DNGRAPH_DYNAMIC_COMPONENTS_ENABLE=ON \

View File

@ -22,3 +22,4 @@ _set_if_not_defined(ENABLE_VPU OFF)
# fix conversion from uint64_t / int64_t to size_t
_set_if_not_defined(NGRAPH_ONNX_IMPORT_ENABLE OFF)
_set_if_not_defined(NGRAPH_ONNX_EDITOR_ENABLE OFF)

View File

@ -78,6 +78,7 @@ option(NGRAPH_UNIT_TEST_ENABLE "Control the building of unit tests" ON)
option(NGRAPH_INTERPRETER_ENABLE "Control the building of the INTERPRETER backend" ON)
option(NGRAPH_DEBUG_ENABLE "Enable output for NGRAPH_DEBUG statements" OFF)
option(NGRAPH_ONNX_IMPORT_ENABLE "Enable ONNX importer" OFF)
option(NGRAPH_ONNX_EDITOR_ENABLE "Enable ONNX Editor" OFF)
option(NGRAPH_LIB_VERSIONING_ENABLE "Enable shared library versioning" OFF)
option(NGRAPH_PYTHON_BUILD_ENABLE "Enable build nGraph python package wheel" OFF)
option(NGRAPH_DYNAMIC_COMPONENTS_ENABLE "Enable dynamic loading of components" ON)
@ -91,6 +92,9 @@ option(NGRAPH_USE_PROTOBUF_LITE "Compiles and links with protobuf-lite" OFF)
if (NGRAPH_ONNX_IMPORT_ENABLE)
option(NGRAPH_USE_SYSTEM_PROTOBUF "Use system provided Protobuf shared object" OFF)
endif()
if(NGRAPH_ONNX_EDITOR_ENABLE AND NOT NGRAPH_ONNX_IMPORT_ENABLE)
message(FATAL_ERROR "ONNX Editor compotent requires ONNX Importer. Set NGRAPH_ONNX_IMPORT_ENABLE=ON.")
endif()
message(STATUS "NGRAPH_ADDRESS_SANITIZER_ENABLE: ${NGRAPH_ADDRESS_SANITIZER_ENABLE}")
message(STATUS "NGRAPH_DEBUG_ENABLE: ${NGRAPH_DEBUG_ENABLE}")
@ -99,6 +103,7 @@ message(STATUS "NGRAPH_EXPORT_TARGETS_ENABLE: ${NGRAPH_EXPORT_TARGETS_EN
message(STATUS "NGRAPH_INTERPRETER_ENABLE: ${NGRAPH_INTERPRETER_ENABLE}")
message(STATUS "NGRAPH_LIB_VERSIONING_ENABLE: ${NGRAPH_LIB_VERSIONING_ENABLE}")
message(STATUS "NGRAPH_ONNX_IMPORT_ENABLE: ${NGRAPH_ONNX_IMPORT_ENABLE}")
message(STATUS "NGRAPH_ONNX_EDITOR_ENABLE: ${NGRAPH_ONNX_EDITOR_ENABLE}")
message(STATUS "NGRAPH_PYTHON_BUILD_ENABLE: ${NGRAPH_PYTHON_BUILD_ENABLE}")
message(STATUS "NGRAPH_THREAD_SANITIZER_ENABLE: ${NGRAPH_THREAD_SANITIZER_ENABLE}")
message(STATUS "NGRAPH_TOOLS_ENABLE: ${NGRAPH_TOOLS_ENABLE}")

View File

@ -21,7 +21,8 @@ if (NGRAPH_ONNX_IMPORT_ENABLE)
"${NGRAPH_COVERAGE_BASE_DIRECTORY}/ngraph/frontend/onnx_import*")
ie_coverage_genhtml(INFO_FILE "onnx_importer"
PREFIX "${NGRAPH_COVERAGE_BASE_DIRECTORY}")
endif()
if (NGRAPH_ONNX_EDITOR_ENABLE)
ie_coverage_extract(INPUT "nGraph" OUTPUT "onnx_editor"
PATTERNS
"${NGRAPH_COVERAGE_BASE_DIRECTORY}/ngraph/frontend/onnx_editor*")

View File

@ -5,5 +5,8 @@
if (NGRAPH_ONNX_IMPORT_ENABLE)
add_subdirectory(onnx_common)
add_subdirectory(onnx_import)
endif()
if (NGRAPH_ONNX_EDITOR_ENABLE)
add_subdirectory(onnx_editor)
endif()

View File

@ -417,15 +417,18 @@ if (NGRAPH_ONNX_IMPORT_ENABLE AND NOT NGRAPH_USE_PROTOBUF_LITE)
onnx/onnx_import_provenance.in.cpp
onnx/onnx_import_reshape.in.cpp
onnx/onnx_import_rnn.in.cpp
onnx/onnx_import_quant.in.cpp
onnx/onnx_test_utils.in.cpp)
onnx/onnx_import_quant.in.cpp)
list(APPEND SRC
onnx/onnx_import_exceptions.cpp
onnx/onnx_import_library.cpp
onnx/onnx_editor.cpp
onnx/onnx_tensor_names.cpp)
endif()
if (NGRAPH_ONNX_EDITOR_ENABLE)
list(APPEND SRC onnx/onnx_editor.cpp)
list(APPEND MULTI_TEST_SRC onnx/onnx_test_utils.in.cpp)
endif()
add_clang_format_target(unit-test_clang FOR_SOURCES ${SRC} ${MULTI_TEST_SRC})
foreach(BACKEND_NAME ${ACTIVE_BACKEND_LIST})
@ -499,7 +502,11 @@ endif()
target_link_libraries(unit-test PRIVATE ie_backend)
if (NGRAPH_ONNX_IMPORT_ENABLE)
target_link_libraries(unit-test PRIVATE onnx_importer onnx_editor)
target_link_libraries(unit-test PRIVATE onnx_importer)
endif()
if (NGRAPH_ONNX_EDITOR_ENABLE)
target_link_libraries(unit-test PRIVATE onnx_editor)
endif()
if (NGRAPH_INTERPRETER_ENABLE)

View File

@ -75,6 +75,7 @@ REGISTER_TYPED_TEST_CASE_P(ElemTypesTests,
typedef ::testing::Types<int8_t, int16_t, int32_t, uint8_t, float> ElemTypes;
INSTANTIATE_TYPED_TEST_CASE_P(${BACKEND_NAME}, ElemTypesTests, ElemTypes);
NGRAPH_TEST(${BACKEND_NAME}, add_abc_from_ir) {
const auto ir_xml = file_util::path_join(SERIALIZED_ZOO, "ir/add_abc.xml");
const auto function = test::function_from_ir(ir_xml);