Enable intel-openvino ChromeOS build with intel-gnalib library (#4761)

We use the header files from /usr/include.
Enable necessary build changes for the same.
- Remove unused stb_lib libraries.
- Set SSE4.2 implementation as default
- Add div_by_n to the CMake builder rules
This commit is contained in:
anikulk
2021-03-12 09:01:22 -08:00
committed by GitHub
parent 83964338b0
commit a4a1bff1cc
14 changed files with 31 additions and 11357 deletions

View File

@@ -139,7 +139,7 @@ if(WIN32)
else()
# TODO: enable for C sources as well
# ie_add_compiler_flags(-Werror)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error")
ie_add_compiler_flags(-ffunction-sections -fdata-sections)
ie_add_compiler_flags(-fvisibility=hidden)
ie_add_compiler_flags(-fdiagnostics-show-option)

View File

@@ -2115,7 +2115,7 @@ public:
float negative_slope;
};
class DivByNLayer : public CNNLayer {
class INFERENCE_ENGINE_API_CLASS(DivByNLayer) : public CNNLayer {
public:
/**
* @brief A default constructor. Creates a new ReLULayer instance and initializes layer parameters with the given values.
@@ -2132,7 +2132,7 @@ public:
*/
float negative_slope;
};
class IdentityLayer : public CNNLayer {
class INFERENCE_ENGINE_API_CLASS(IdentityLayer) : public CNNLayer {
public:
/**
* @brief A default constructor. Creates a new ReLULayer instance and initializes layer parameters with the given values.
@@ -2149,7 +2149,7 @@ public:
*/
float negative_slope;
};
class ExpLayer : public CNNLayer {
class INFERENCE_ENGINE_API_CLASS(ExpLayer) : public CNNLayer {
public:
/**
* @brief A default constructor. Creates a new ReLULayer instance and initializes layer parameters with the given values.
@@ -2166,7 +2166,7 @@ public:
float negative_slope;
};
class NegHalfLogLayer : public CNNLayer {
class INFERENCE_ENGINE_API_CLASS(NegHalfLogLayer) : public CNNLayer {
public:
/**
* @brief A default constructor. Creates a new ReLULayer instance and initializes layer parameters with the given values.
@@ -2184,7 +2184,7 @@ public:
float negative_slope;
};
class LogLayer : public CNNLayer {
class INFERENCE_ENGINE_API_CLASS(LogLayer) : public CNNLayer {
public:
/**
* @brief A default constructor. Creates a new ReLULayer instance and initializes layer parameters with the given values.

View File

@@ -26,9 +26,13 @@ else()
endif()
#saving rpath to GNA shared library be used by CI
log_rpath_from_dir(GNA ${libGNA_LIBRARIES_BASE_PATH})
#log_rpath_from_dir(GNA ${libGNA_LIBRARIES_BASE_PATH})
target_link_libraries(${TARGET_NAME} PRIVATE inference_engine ${INTEL_ITT_LIBS} Threads::Threads libGNA)
if(TARGET_OS STREQUAL "CHROMEOS")
target_link_libraries(${TARGET_NAME} PRIVATE inference_engine ${INTEL_ITT_LIBS} Threads::Threads gna)
else()
target_link_libraries(${TARGET_NAME} PRIVATE inference_engine ${INTEL_ITT_LIBS} Threads::Threads libGNA)
endif()
target_include_directories(${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_compile_definitions(${TARGET_NAME}
PRIVATE
@@ -45,7 +49,11 @@ target_compile_definitions(${TARGET_NAME}_test_static
GNA_LIB_VER=${GNA_LIBRARY_VERSION_NUMBER}
INTEGER_LOW_P
USE_STATIC_IE)
target_link_libraries(${TARGET_NAME}_test_static PUBLIC inference_engine_preproc_s libGNA::API)
if(TARGET_OS STREQUAL "CHROMEOS")
target_link_libraries(${TARGET_NAME}_test_static PUBLIC inference_engine_preproc_s gna)
else()
target_link_libraries(${TARGET_NAME}_test_static PUBLIC inference_engine_preproc_s libGNA::API)
endif()
target_include_directories(${TARGET_NAME}_test_static PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
set_target_properties(${TARGET_NAME}_test_static PROPERTIES COMPILE_PDB_NAME ${TARGET_NAME}_test_static)

View File

@@ -106,7 +106,7 @@ void QuantizeAffine16(float *ptr_float_weights,
}
}
__attribute__ ((target ("arch=goldmont")))
__attribute__ ((target ("default")))
float ScaleFactorForQuantization(void *ptr_float_memory, float target_max, size_t num_elements)
{
float *ptr_float_feat = (float*)ptr_float_memory;
@@ -157,41 +157,6 @@ float ScaleFactorForQuantization(void *ptr_float_memory, float target_max, size_
return(single_min != 0 ? (single_min < 1.0 ? 1 / single_min : 1.0f) : 1.0f);
}
__attribute__ ((target ("default")))
float ScaleFactorForQuantization(void *ptr_float_memory, float target_max, size_t num_elements) {
float *ptr_float_feat = reinterpret_cast<float *>(ptr_float_memory);
float max = 0.0;
float scale_factor;
float min = 0.0;
size_t i;
for ( i = 0;i < num_elements;i++) {
min = fabs(ptr_float_feat[i]);
if (min != 0.0f) {
break;
}
}
for (; i < num_elements; i++) {
if (fabs(ptr_float_feat[i]) < min && ptr_float_feat[i] != 0) {
min = fabs(ptr_float_feat[i]);
}
}
if (min == 0.0) {
scale_factor = 1.0f;
} else {
if( min < 1) {
scale_factor = 1 / min;
}
else {
scale_factor = 1.0f;
}
}
return scale_factor;
}
float accessmember(__m128 v, int index)
{
union vec{ __m128 sse;

View File

@@ -59,8 +59,10 @@ void ExportLdForNoMmu(uint32_t modelId, std::ostream & outStream) {
status = Gna2ModelExportConfigSetSource(exportConfig, 0, modelId);
GNADeviceHelper::checkGna2Status(status);
#if GNA_LIB_VER != 2 && GNA_LIB_VER != 1
status = Gna2ModelExportConfigSetTarget(exportConfig, Gna2DeviceVersionEmbedded3_0);
GNADeviceHelper::checkGna2Status(status);
#endif
void * ldNoMmu;
uint32_t ldNoMmuSize;

View File

@@ -30,6 +30,8 @@
/**
* holds gna - style handle in RAII way
*/
typedef uint32_t gna_device_id; // TODO:3:API redesign: remove and use uint32_t instead.
class GNADeviceHelper {
static std::mutex acrossPluginsSync;
#if GNA_LIB_VER == 1

View File

@@ -18,8 +18,15 @@
#include "gna_lib_ver_selector.hpp"
typedef struct _nnet_type_t
{
uint32_t nLayers; // The number of layers in the network.
uint32_t nGroup; // Input vector grouping level.
intel_nnet_layer_t *pLayers; // Layer configurations.
} intel_nnet_type_t;
#ifndef WIN32
#include <profiler.h>
void clearTimeB(timeb & tb) {
tb.time = 0;

View File

@@ -14,19 +14,13 @@ set(builder_files_src ${CMAKE_CURRENT_SOURCE_DIR}/builders/ie_layer_decorator.cp
${CMAKE_CURRENT_SOURCE_DIR}/builders/ie_const_layer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/builders/ie_split_layer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/builders/ie_pooling_layer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/builders/ie_divbyn_layer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/builders/ie_network_builder.cpp)
file (GLOB LIBRARY_SRC
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/low_precision_transformations/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/low_precision_transformations/common/*.cpp
if (ENABLE_NGRAPH)
${CMAKE_CURRENT_SOURCE_DIR}/transform/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/transform/transformations/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/transform/transformations/fusion/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/transform/transformations/utils/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ngraph_ops/*.cpp
endif()
${CMAKE_CURRENT_SOURCE_DIR}/cpp_interfaces/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/shape_infer/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/shape_infer/built-in/*.cpp

View File

@@ -36,7 +36,6 @@ function(build_with_lto)
endif()
add_subdirectory(pugixml)
add_subdirectory(stb_lib)
add_subdirectory(ade)
add_subdirectory(fluid/modules/gapi)

View File

@@ -1,20 +0,0 @@
#===============================================================================
# Copyright (C) 2018-2019 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#===============================================================================
set(TARGET stb_image)
add_library(${TARGET} STATIC stb_image.cpp)
target_include_directories(${TARGET} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

View File

@@ -1,11 +0,0 @@
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
#define STB_IMAGE_RESIZE_IMPLEMENTATION
#define STBIR_DEFAULT_FILTER_UPSAMPLE STBIR_FILTER_BOX
#define STBIR_DEFAULT_FILTER_DOWNSAMPLE STBIR_FILTER_BOX
#include "stb_image_resize.h"
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include "stb_image_write.h"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff