[MSLITE] Fix bug of nnie compilation

This commit is contained in:
wang_shaocong 2021-07-08 17:54:01 +08:00
parent 17c6e3a155
commit e0d443e5ea
4 changed files with 18 additions and 10 deletions

View File

@ -274,7 +274,7 @@ elseif(PLATFORM_ARM32)
install(FILES ${TOP_DIR}/mindspore/lite/tools/providers/NNIE/Hi3516D/libnnie_proposal.so
DESTINATION ${RUNTIME_PKG_NAME}/providers/Hi3516D COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${TOP_DIR}/mindspore/lite/tools/providers/NNIE/Hi3516D/benchmark
DESTINATION ${RUNTIME_PKG_NAME}/providers/Hi3516D COMPONENT ${RUNTIME_COMPONENT_NAME})
DESTINATION ${BENCHMARK_ROOT_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
else()
if(MSLITE_ENABLE_TOOLS)
install(TARGETS ${BENCHMARK_NAME} RUNTIME DESTINATION ${BENCHMARK_ROOT_DIR}
@ -489,7 +489,7 @@ else()
endif()
if(NOT SUPPORT_TRAIN AND MSLITE_ENABLE_NNIE)
install(FILES ${TOP_DIR}/mindspore/lite/tools/providers/NNIE/converter.cfg
DESTINATION ${CONVERTER_ROOT_DIR}/ COMPONENT ${RUNTIME_COMPONENT_NAME})
DESTINATION ${CONVERTER_ROOT_DIR}/converter COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${TOP_DIR}/mindspore/lite/tools/providers/NNIE/Hi3516D/libmslite_nnie_converter.so
DESTINATION ${CONVERTER_ROOT_DIR}/providers/Hi3516D/ COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${TOP_DIR}/mindspore/lite/tools/providers/NNIE/Hi3516D/libmslite_nnie_data_process.so

View File

@ -28,10 +28,7 @@ if(PLATFORM_ARM32 OR PLATFORM_ARM64)
endif()
endif()
if(TARGET_HIMIX200)
set(API_SRC)
else()
set(API_SRC
set(API_SRC
${CORE_DIR}/utils/status.cc
${CMAKE_CURRENT_SOURCE_DIR}/cxx_api/cell.cc
${CMAKE_CURRENT_SOURCE_DIR}/cxx_api/serialization.cc
@ -43,7 +40,6 @@ else()
${CMAKE_CURRENT_SOURCE_DIR}/cxx_api/graph/graph.cc
${CMAKE_CURRENT_SOURCE_DIR}/cxx_api/tensor/tensor_impl.cc
)
endif()
if(SUPPORT_NPU)
include_directories(${DDK_PATH})

View File

@ -17,7 +17,11 @@
#include "include/api/context.h"
#include <string>
#include <memory>
#ifndef SUPPORT_NNIE
#include <any>
#else
#include <experimental/any>
#endif
#include "include/api/types.h"
#include "include/api/data_type.h"
#include "src/runtime/inner_allocator.h"
@ -39,7 +43,11 @@ struct Context::Data {
};
struct DeviceInfoContext::Data {
#ifndef SUPPORT_NNIE
std::map<std::string, std::any> params;
#else
std::map<std::string, std::experimental::any> params;
#endif
std::shared_ptr<Allocator> allocator = nullptr;
};
@ -55,9 +63,13 @@ static const U &GetValue(const std::shared_ptr<DeviceInfoContext::Data> &data, c
if (iter == data->params.end()) {
return empty_result;
}
#ifndef SUPPORT_NNIE
const std::any &value = iter->second;
return std::any_cast<const U &>(value);
#else
const std::experimental::any &value = iter->second;
return std::experimental::any_cast<const U &>(value);
#endif
}
void Context::SetThreadNum(int32_t thread_num) {

View File

@ -54,11 +54,11 @@ function Run_Hi3516() {
tar -zxf mindspore-lite-${version}-linux-aarch32.tar.gz || exit 1
cd ${arm32_path}/mindspore-lite-${version}-linux-aarch32 || return 1
chmod +x ./providers/Hi3516D/benchmark
chmod +x ./tools/benchmark/benchmark
# copy related files to benchmark_test
cp -a ./providers/Hi3516D/libmslite_nnie.so ${benchmark_test_path}/libmslite_nnie.so || exit 1
cp -a ./providers/Hi3516D/libnnie_proposal.so ${benchmark_test_path}/libnnie_proposal.so || exit 1
cp -a ./providers/Hi3516D/benchmark ${benchmark_test_path}/benchmark || exit 1
cp -a ./tools/benchmark/benchmark ${benchmark_test_path}/benchmark || exit 1
cp -a ./runtime/lib/libmindspore-lite.so ${benchmark_test_path}/libmindspore-lite.so || exit 1
# cp files to nfs shared folder