add siteai options

This commit is contained in:
albert-yan 2024-03-04 12:23:26 +08:00
parent 40225bc51f
commit b5c259eff5
20 changed files with 255 additions and 131 deletions

View File

@ -396,8 +396,10 @@ if(PLATFORM_ARM64)
DESTINATION ${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${EXTENDRT_BUILD_DIR}/delegate/graph_executor/litert/${MINDSPORE_GE_LITERT_LIB_NAME}.so
DESTINATION ${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${EXECUTOR_BUILD_DIR}/${MINDSPORE_LITE_EXECUTOR_LIB_NAME}.so
DESTINATION ${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
if(NOT MSLITE_SIMPLEST_CLOUD_INFERENCE)
install(FILES ${EXECUTOR_BUILD_DIR}/${MINDSPORE_LITE_EXECUTOR_LIB_NAME}.so
DESTINATION ${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
endif()
install(FILES ${glog_LIBPATH}/${glog_name} DESTINATION ${RUNTIME_LIB_DIR}
RENAME libmindspore_glog.so.0 COMPONENT ${RUNTIME_COMPONENT_NAME})
install(TARGETS mindspore_core DESTINATION ${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
@ -406,8 +408,10 @@ if(PLATFORM_ARM64)
if(MSLITE_ENABLE_ACL)
install(FILES ${TOP_DIR}/mindspore/lite/build/src/extendrt/kernel/ascend/libascend_kernel_plugin.so
DESTINATION ${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${TOP_DIR}/mindspore/lite/build/src/extendrt/delegate/ascend_ge/libascend_ge_plugin.so
DESTINATION ${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
if(NOT MSLITE_SIMPLEST_CLOUD_INFERENCE)
install(FILES ${TOP_DIR}/mindspore/lite/build/src/extendrt/delegate/ascend_ge/libascend_ge_plugin.so
DESTINATION ${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
endif()
install(FILES ${TOP_DIR}/mindspore/lite/build/src/extendrt/cxx_api/llm_engine/libllm_engine_plugin.so
DESTINATION ${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
__install_ascend_tbe_and_aicpu()
@ -647,8 +651,10 @@ elseif(PLATFORM_ARM32)
DESTINATION ${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${EXTENDRT_BUILD_DIR}/delegate/graph_executor/litert/${MINDSPORE_GE_LITERT_LIB_NAME}.so
DESTINATION ${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${EXECUTOR_BUILD_DIR}/${MINDSPORE_LITE_EXECUTOR_LIB_NAME}.so
DESTINATION ${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
if(NOT MSLITE_SIMPLEST_CLOUD_INFERENCE)
install(FILES ${EXECUTOR_BUILD_DIR}/${MINDSPORE_LITE_EXECUTOR_LIB_NAME}.so
DESTINATION ${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
endif()
install(FILES ${glog_LIBPATH}/${glog_name} DESTINATION ${RUNTIME_LIB_DIR}
RENAME libmindspore_glog.so.0 COMPONENT ${RUNTIME_COMPONENT_NAME})
install(TARGETS mindspore_core DESTINATION ${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
@ -657,8 +663,10 @@ elseif(PLATFORM_ARM32)
if(MSLITE_ENABLE_ACL)
install(FILES ${TOP_DIR}/mindspore/lite/build/src/extendrt/kernel/ascend/libascend_kernel_plugin.so
DESTINATION ${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${TOP_DIR}/mindspore/lite/build/src/extendrt/delegate/ascend_ge/libascend_ge_plugin.so
DESTINATION ${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
if(NOT MSLITE_SIMPLEST_CLOUD_INFERENCE)
install(FILES ${TOP_DIR}/mindspore/lite/build/src/extendrt/delegate/ascend_ge/libascend_ge_plugin.so
DESTINATION ${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
endif()
install(FILES ${TOP_DIR}/mindspore/lite/build/src/extendrt/cxx_api/llm_engine/libllm_engine_plugin.so
DESTINATION ${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
__install_ascend_tbe_and_aicpu()
@ -847,20 +855,26 @@ else()
DESTINATION ${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${EXTENDRT_BUILD_DIR}/delegate/graph_executor/litert/${MINDSPORE_GE_LITERT_LIB_NAME}.so
DESTINATION ${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${EXECUTOR_BUILD_DIR}/${MINDSPORE_LITE_EXECUTOR_LIB_NAME}.so
DESTINATION ${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
if(NOT MSLITE_SIMPLEST_CLOUD_INFERENCE)
install(FILES ${EXECUTOR_BUILD_DIR}/${MINDSPORE_LITE_EXECUTOR_LIB_NAME}.so
DESTINATION ${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
endif()
install(FILES ${glog_LIBPATH}/${glog_name} DESTINATION ${RUNTIME_LIB_DIR}
RENAME libmindspore_glog.so.0 COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${onednn_LIBPATH}/libdnnl.so.2.2 DESTINATION ${DNNL_DIR}
RENAME libdnnl.so.2 COMPONENT ${RUNTIME_COMPONENT_NAME})
if(MSLITE_DEPS_MKLDNN)
install(FILES ${onednn_LIBPATH}/libdnnl.so.2.2 DESTINATION ${DNNL_DIR}
RENAME libdnnl.so.2 COMPONENT ${RUNTIME_COMPONENT_NAME})
endif()
install(TARGETS mindspore_core DESTINATION ${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${TOP_DIR}/mindspore/lite/build/src/extendrt/convert/libruntime_convert_plugin.so
DESTINATION ${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
if(MSLITE_ENABLE_ACL)
install(FILES ${TOP_DIR}/mindspore/lite/build/src/extendrt/kernel/ascend/libascend_kernel_plugin.so
DESTINATION ${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${TOP_DIR}/mindspore/lite/build/src/extendrt/delegate/ascend_ge/libascend_ge_plugin.so
DESTINATION ${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
if(NOT MSLITE_SIMPLEST_CLOUD_INFERENCE)
install(FILES ${TOP_DIR}/mindspore/lite/build/src/extendrt/delegate/ascend_ge/libascend_ge_plugin.so
DESTINATION ${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
endif()
install(FILES ${TOP_DIR}/mindspore/lite/build/src/extendrt/cxx_api/llm_engine/libllm_engine_plugin.so
DESTINATION ${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
__install_ascend_tbe_and_aicpu()

View File

@ -38,6 +38,8 @@ function(__install_micro_codegen)
COMPONENT ${RUNTIME_COMPONENT_NAME} FILES_MATCHING PATTERN "*.h")
install(DIRECTORY ${MICRO_CMSIS_DIR}/NN/Include DESTINATION ${CODEGEN_ROOT_DIR}/third_party/include/CMSIS/NN
COMPONENT ${RUNTIME_COMPONENT_NAME} FILES_MATCHING PATTERN "*.h")
install(TARGETS cmsis_nn ARCHIVE DESTINATION ${CODEGEN_ROOT_DIR}/third_party/lib
if(MSLITE_DEPS_CMSIS)
install(TARGETS cmsis_nn ARCHIVE DESTINATION ${CODEGEN_ROOT_DIR}/third_party/lib
COMPONENT ${RUNTIME_COMPONENT_NAME})
endif()
endfunction()

View File

@ -64,6 +64,15 @@ if(ANDROID_NDK)
set(TARGET_AOS_ARM ON)
endif()
if(NOT MSLITE_TARGET_SITEAI)
set(MSLITE_DEPS_OPENSSL on)
set(MSLITE_SIMPLEST_CLOUD_INFERENCE off)
endif()
if(MSLITE_DEPS_OPENSSL)
add_compile_definitions(ENABLE_OPENSSL)
endif()
if(NOT ONLY_BUILD_DEVICE_PLUGINS)
set(CORE_SRC_LIST ${CORE_SRC_LIST} ${CORE_OPS_LIST})
endif()
@ -125,6 +134,7 @@ if(ENABLE_NATIVE_PROTOBUF)
elseif(NOT TARGET_AOS_ARM AND NOT ANDROID_NDK)
target_link_libraries(mindspore_core PRIVATE mindspore::protobuf)
endif()
target_link_libraries(mindspore_core PRIVATE securec)
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
@ -144,7 +154,8 @@ if(USE_GLOG)
target_link_libraries(mindspore_core PRIVATE mindspore::glog)
endif()
if((${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR APPLE) AND (NOT TARGET_AOS_ARM) AND (NOT ANDROID_NDK))
if((${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR APPLE) AND (NOT TARGET_AOS_ARM) AND (NOT ANDROID_NDK) AND
(NOT MSLITE_SIMPLEST_CLOUD_INFERENCE))
target_link_libraries(mindspore_core PRIVATE mindspore::crypto -pthread)
endif()

View File

@ -23,7 +23,7 @@
#include "utils/log_adapter.h"
#include "utils/convert_utils_base.h"
#if !defined(_MSC_VER) && !defined(_WIN32)
#if !defined(_MSC_VER) && !defined(_WIN32) && defined(ENABLE_OPENSSL)
#include <openssl/aes.h>
#include <openssl/evp.h>
#include <openssl/rand.h>
@ -67,7 +67,7 @@ bool IsCipherFile(const Byte *model_data) {
auto flag = ByteToInt(int_buf.data(), int_buf.size());
return static_cast<unsigned int>(flag) == GCM_MAGIC_NUM || static_cast<unsigned int>(flag) == CBC_MAGIC_NUM;
}
#if defined(_MSC_VER) || defined(_WIN32)
#if defined(_MSC_VER) || defined(_WIN32) || !defined(ENABLE_OPENSSL)
std::unique_ptr<Byte[]> Encrypt(size_t *, const Byte *, size_t, const Byte *, size_t, const std::string &) {
MS_LOG(ERROR) << "Unsupported feature in Windows platform.";
return nullptr;

View File

@ -15,6 +15,8 @@ set(MSLITE_REGISTRY_DEVICE "off" CACHE STRING "Compile Mindspore Lite that suppo
currently supported devices: Hi3516D/Hi3519A/Hi3559A/SD3403")
set(MSLITE_MICRO_PLATFORM "auto" CACHE STRING "Platform of micro static library micro static, \
currently supported : cortex-m7/cortex-m4/cortex-m33/auto")
set(MSLITE_MINDDATA_IMPLEMENT "full" CACHE STRING "minddata mode, \
currently supported : off/full/wrapper/lite/lite_cv")
option(MSLITE_ENABLE_NPU "enable npu, only arm64 or arm32 support" off)
option(MSLITE_ENABLE_COREML "enable coreML, only apple ios devices support" off)
option(MSLITE_ENABLE_NNAPI "enable nnapi, only android with arm64 or arm32" off)
@ -59,6 +61,7 @@ option(MSLITE_ENABLE_MODEL_PRE_INFERENCE "enable model do pre-inference when Bui
option(MSLITE_EXPORT_COMPUTE_IR "export graph structure dotfile when debug mode" off)
option(MSLITE_ENABLE_PACKAGE_WHEEL "enable package python wheel" off)
option(MSLITE_ENABLE_OPENCV "enable opencv" on)
option(MSLITE_TARGET_SITEAI "target siteai" off)
#Option that can be configured through manually
option(ENABLE_VERBOSE "" off)
@ -208,6 +211,24 @@ endif()
if(DEFINED ENV{MSLITE_ENABLE_OPENCV})
set(MSLITE_ENABLE_OPENCV $ENV{MSLITE_ENABLE_OPENCV})
endif()
if(DEFINED ENV{MSLITE_MINDDATA_IMPLEMENT})
set(MSLITE_MINDDATA_IMPLEMENT $ENV{MSLITE_MINDDATA_IMPLEMENT})
endif()
if(DEFINED ENV{MSLITE_TARGET_SITEAI})
set(MSLITE_TARGET_SITEAI $ENV{MSLITE_TARGET_SITEAI})
endif()
if(MSLITE_TARGET_SITEAI)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/providers/siteai)
else()
set(MSLITE_DEPS_EIGEN on)
set(MSLITE_DEPS_CMSIS on)
endif()
if(MSLITE_DEPS_EIGEN)
add_compile_definitions(ENABLE_EIGEN)
endif()
if(DEFINED ENV{MSLITE_ENABLE_MODEL_ENCRYPTION})
if((${CMAKE_SYSTEM_NAME} MATCHES "Linux" AND PLATFORM_X86_64) OR (
(PLATFORM_ARM64 OR PLATFORM_ARM32) AND (ANDROID_NDK_TOOLCHAIN_INCLUDED OR TARGET_AOS_ARM)))
@ -259,7 +280,9 @@ endif()
if(DEFINED ENV{ENABLE_FAST_HASH_TABLE})
add_compile_definitions(ENABLE_FAST_HASH_TABLE)
set(MSLITE_DEPS_ROBIN_HOOD_HASHING on)
if(NOT MSLITE_TARGET_SITEAI)
set(MSLITE_DEPS_ROBIN_HOOD_HASHING on)
endif()
endif()
if(DEFINED ENV{MSLITE_ENABLE_MODEL_OBF})
@ -418,7 +441,9 @@ endif()
if(MSLITE_ENABLE_CLOUD_FUSION_INFERENCE OR MSLITE_ENABLE_CLOUD_INFERENCE)
set(MSLITE_ENABLE_RUNTIME_GLOG on)
set(MSLITE_ENABLE_TRAIN off)
add_compile_definitions(ENABLE_MINDDATA_PYTHON)
if(NOT MSLITE_MINDDATA_IMPLEMENT STREQUAL "off")
add_compile_definitions(ENABLE_MINDDATA_PYTHON)
endif()
endif()
if(MSLITE_ENABLE_TRAIN AND NOT MSLITE_ENABLE_WEIGHT_DECODE)
@ -554,6 +579,7 @@ message(STATUS "\tMSLITE_ENABLE_MODEL_PRE_INFERENCE = \t${MSLITE_ENABLE
message(STATUS "\tMSLITE_EXPORT_COMPUTE_IR = \t${MSLITE_EXPORT_COMPUTE_IR}")
message(STATUS "\tMSLITE_ENABLE_PACKAGE_WHEEL = \t${MSLITE_ENABLE_PACKAGE_WHEEL}")
message(STATUS "\tMSLITE_ENABLE_OPENCV = \t${MSLITE_ENABLE_OPENCV}")
message(STATUS "\tMSLITE_TARGET_SITEAI = \t${MSLITE_TARGET_SITEAI}")
if((MSLITE_ENABLE_CONVERTER OR MSLITE_ENABLE_TESTCASES) AND (
NOT MSLITE_ENABLE_MINDRT
@ -677,6 +703,7 @@ set(NNACL_DIR ${CCSRC_DIR}/plugin/device/cpu/kernel/nnacl)
if(PLATFORM_MCU)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-incompatible-pointer-types")
# set(MSLITE_DEPS_CMSIS on)
add_subdirectory(${NNACL_DIR} build/nnacl)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tools/converter/micro/cmake/cortex-m/ build)
include(${TOP_DIR}/cmake/package_lite.cmake)
@ -852,7 +879,9 @@ endif()
if(NOT APPLE)
if(PLATFORM_X86_64 OR MACHINE_LINUX_ARM64)
set(MSLITE_DEPS_PYBIND11 on)
if(NOT MSLITE_TARGET_SITEAI)
set(MSLITE_DEPS_PYBIND11 on)
endif()
endif()
endif()
@ -861,13 +890,18 @@ if(MSLITE_ENABLE_CONVERTER OR MSLITE_ENABLE_CLOUD_FUSION_INFERENCE OR MSLITE_ENA
set(MSLITE_DEPS_OPENCV on)
add_definitions(-DMSLITE_DEPS_OPENCV)
endif()
set(MSLITE_DEPS_EIGEN on)
endif()
if(NOT MSLITE_TARGET_SITEAI)
set(MSLITE_DEPS_CMSIS on)
endif()
if(MSLITE_ENABLE_CLOUD_FUSION_INFERENCE OR MSLITE_ENABLE_CLOUD_INFERENCE)
set(MSLITE_DEPS_MKLDNN on)
set(MSLITE_DEPS_LIBEVENT on)
set(MSLITE_DEPS_PYBIND11 on)
if(NOT MSLITE_TARGET_SITEAI)
set(MSLITE_DEPS_MKLDNN on)
set(MSLITE_DEPS_LIBEVENT on)
set(MSLITE_DEPS_PYBIND11 on)
endif()
if(SUPPORT_TENSORRT)
set(MSLITE_DEPS_FAST_TRANSFORMERS on)
if(MSLITE_ENABLE_GRAPH_KERNEL)
@ -881,12 +915,18 @@ endif()
# Such as when MSLITE_ENABLE_CONVERTER is on or MSLITE_ENABLE_KERNEL_EXECUTOR is on.
if((${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR APPLE) AND (
MSLITE_ENABLE_CONVERTER OR (MSLITE_ENABLE_KERNEL_EXECUTOR AND NOT TARGET_AOS_ARM)))
set(MSLITE_DEPS_OPENSSL on)
if(NOT MSLITE_TARGET_SITEAI)
set(MSLITE_DEPS_OPENSSL on)
endif()
endif()
if(MSLITE_ENABLE_MODEL_ENCRYPTION AND NOT TARGET_AOS_ARM)
set(MSLITE_DEPS_OPENSSL on)
add_compile_definitions(ENABLE_OPENSSL)
if(NOT MSLITE_TARGET_SITEAI)
set(MSLITE_DEPS_OPENSSL on)
endif()
if(MSLITE_DEPS_OPENSSL)
add_compile_definitions(ENABLE_OPENSSL)
endif()
endif()
include(${LITE_DIR}/cmake/lite_dependences.cmake)

View File

@ -530,7 +530,6 @@ build_lite() {
if [[ "${machine}" == "aarch64" ]]; then
# CPU : Linux-aarch64
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DMACHINE_LINUX_ARM64=on"
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DMSLITE_MINDDATA_IMPLEMENT=full"
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DMSLITE_ENABLE_TRAIN=off"
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DMSLITE_GPU_BACKEND=off"
else
@ -567,7 +566,6 @@ build_lite() {
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DMSLITE_MINDDATA_IMPLEMENT=off -DMSLITE_ENABLE_TRAIN=off -DMSLITE_GPU_BACKEND=off -DMSLITE_ENABLE_TOOLS=off"
else
# CPU : Linux-x86_64
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DMSLITE_MINDDATA_IMPLEMENT=full"
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DPLATFORM_X86_64=on"
fi
fi

View File

@ -3,7 +3,7 @@ if(MSLITE_ENABLE_CONVERTER)
add_definitions(-DPRIMITIVE_WRITEABLE)
add_definitions(-DUSE_GLOG)
set(USE_GLOG on)
if(MSLITE_ENABLE_MODEL_ENCRYPTION)
if(MSLITE_ENABLE_MODEL_ENCRYPTION AND MSLITE_DEPS_OPENSSL)
add_compile_definitions(ENABLE_OPENSSL)
endif()

View File

@ -46,7 +46,7 @@ if(MSLITE_DEPS_MKLDNN)
if(USE_MS_THREADPOOL_FOR_DNNL)
add_compile_definitions(USE_MS_THREADPOOL_FOR_DNNL)
endif()
include(${TOP_DIR}/cmake/external_libs/mkl_dnn.cmake)
include(${TOP_DIR}/cmake/external_libs/mkl_dnn.cmake)
endif()
if(MSLITE_DEPS_LIBEVENT)

View File

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.12)
project(SiteAi)
##disable external libs
set(MSLITE_DEPS_PYBIND11 on CACHE INTERNAL "setting MSLITE_DEPS_PYBIND11 value")
set(MSLITE_DEPS_ROBIN_HOOD_HASHING off CACHE INTERNAL "setting MSLITE_DEPS_ROBIN_HOOD_HASHING value")
set(MSLITE_DEPS_EIGEN off CACHE INTERNAL "setting MSLITE_DEPS_EIGEN value")
set(MSLITE_DEPS_MKLDNN off CACHE INTERNAL "setting MSLITE_DEPS_MKLDNN value")
set(MSLITE_DEPS_LIBEVENT off CACHE INTERNAL "setting MSLITE_DEPS_LIBEVENT value")
set(MSLITE_DEPS_OPENSSL off CACHE INTERNAL "setting MSLITE_DEPS_OPENSSL value")
set(MSLITE_DEPS_CMSIS off CACHE INTERNAL "setting MSLITE_DEPS_CMSIS value")
##enable prune simplest cloud inferenc
set(MSLITE_SIMPLEST_CLOUD_INFERENCE on CACHE INTERNAL "setting MSLITE_SIMPLEST_CLOUD_INFERENCE value")
set(MSLITE_MINDDATA_IMPLEMENT "off" CACHE INTERNAL "setting MSLITE_MINDDATA_IMPLEMENT value")
set(MSLITE_ENABLE_OPENCV on CACHE INTERNAL "setting MSLITE_ENABLE_OPENCV value")

View File

@ -293,6 +293,8 @@ endif()
set(TRAIN_SRC
${API_TRAIN_SRC}
${TRAIN_SRC_WITH_MD}
${CMAKE_CURRENT_SOURCE_DIR}/common/utils.cc
${CMAKE_CURRENT_SOURCE_DIR}/tensor.cc
${CMAKE_CURRENT_SOURCE_DIR}/executor/kernel_exec.cc
${CMAKE_CURRENT_SOURCE_DIR}/litert/cxx_api/metrics/accuracy.cc
${CMAKE_CURRENT_SOURCE_DIR}/litert/cxx_api/train/model_build.cc

View File

@ -225,71 +225,73 @@ set(MSLITE_GE_LITERT_SRC
#set(LITE_SRC ${LITE_SRC} ${MSLITE_GE_LITERT_SRC})
add_library(unified_runtime_lite_src_mid OBJECT ${LITE_SRC})
add_dependencies(unified_runtime_lite_src_mid fbs_src fbs_inner_src)
add_dependencies(unified_runtime_lite_src_mid lite_src_common_mid)
if(NOT MSLITE_SIMPLEST_CLOUD_INFERENCE)
add_library(unified_runtime_lite_src_mid OBJECT ${LITE_SRC})
add_dependencies(unified_runtime_lite_src_mid fbs_src fbs_inner_src)
add_dependencies(unified_runtime_lite_src_mid lite_src_common_mid)
add_library(lite-unified-executor SHARED $<TARGET_OBJECTS:unified_runtime_lite_src_mid>)
add_library(lite-unified-executor SHARED $<TARGET_OBJECTS:unified_runtime_lite_src_mid>)
target_link_libraries(lite-unified-executor lite_src_common_mid)
add_dependencies(lite-unified-executor mindspore_converter)
target_link_libraries(lite-unified-executor mindspore_converter)
target_link_libraries(lite-unified-executor lite_src_common_mid)
add_dependencies(lite-unified-executor mindspore_converter)
target_link_libraries(lite-unified-executor mindspore_converter)
if(MSVC)
set_target_properties(lite-unified-executor PROPERTIES PREFIX lib)
set_target_properties(lite-unified-executor PROPERTIES IMPORT_PREFIX lib)
set_target_properties(lite-unified-executor PROPERTIES IMPORT_SUFFIX .dll.lib)
endif()
target_link_libraries(lite-unified-executor cpu_kernel_mid nnacl_mid cpu_ops_mid)
if(SUPPORT_TRAIN)
target_link_libraries(lite-unified-executor train_cpu_kernel_mid)
endif()
if(MSLITE_ENABLE_MINDRT)
target_link_libraries(lite-unified-executor mindrt_mid)
endif()
if(PLATFORM_ARM32 OR PLATFORM_ARM64 AND NOT TARGET_HIMIX
AND NOT TARGET_MIX210 AND NOT TARGET_OHOS_LITE AND NOT MACHINE_LINUX_ARM64)
target_link_libraries(lite-unified-executor log)
endif()
if(MSLITE_MINDDATA_IMPLEMENT STREQUAL "lite")
target_link_libraries(lite-unified-executor minddata_eager_mid minddata-lite)
endif()
########################## build optimize and float16 library #################################
if(PLATFORM_ARM)
if(PLATFORM_ARM64 AND NOT TARGET_HIMIX AND NOT TARGET_MIX210 AND NOT MACHINE_LINUX_ARM64)
target_link_libraries(lite-unified-executor cpu_opt_kernel_mid nnacl_optimize_mid)
if(MSVC)
set_target_properties(lite-unified-executor PROPERTIES PREFIX lib)
set_target_properties(lite-unified-executor PROPERTIES IMPORT_PREFIX lib)
set_target_properties(lite-unified-executor PROPERTIES IMPORT_SUFFIX .dll.lib)
endif()
if(MSLITE_ENABLE_FP16)
target_link_libraries(lite-unified-executor cpu_fp16_kernel_mid nnacl_fp16_mid)
target_link_libraries(lite-unified-executor cpu_kernel_mid nnacl_mid cpu_ops_mid)
if(SUPPORT_TRAIN)
target_link_libraries(lite-unified-executor train_cpu_kernel_mid)
endif()
if(MSLITE_ENABLE_MINDRT)
target_link_libraries(lite-unified-executor mindrt_mid)
endif()
if(PLATFORM_ARM32 OR PLATFORM_ARM64 AND NOT TARGET_HIMIX
AND NOT TARGET_MIX210 AND NOT TARGET_OHOS_LITE AND NOT MACHINE_LINUX_ARM64)
target_link_libraries(lite-unified-executor log)
endif()
if(MSLITE_MINDDATA_IMPLEMENT STREQUAL "lite")
target_link_libraries(lite-unified-executor minddata_eager_mid minddata-lite)
endif()
########################## build optimize and float16 library #################################
if(PLATFORM_ARM)
if(PLATFORM_ARM64 AND NOT TARGET_HIMIX AND NOT TARGET_MIX210 AND NOT MACHINE_LINUX_ARM64)
target_link_libraries(lite-unified-executor cpu_opt_kernel_mid nnacl_optimize_mid)
endif()
if(MSLITE_ENABLE_FP16)
target_link_libraries(lite-unified-executor cpu_fp16_kernel_mid nnacl_fp16_mid)
endif()
endif()
if(MSLITE_ENABLE_RUNTIME_CONVERT)
target_link_libraries(lite-unified-executor
quantizer_mid fusion_mid proto_mid graph_pass_mid preprocess_mid
cpu_kernel_mid ccsrc_src_mid converter_src_mid lite_exporter_mid
config_parser_mid mslite_converter_plugin mindspore_core coder_mid
mindir_serializer_mid mindspore::protobuf ${SECUREC_LIBRARY})
target_link_libraries(lite-unified-executor
ccsrc_debug_common_mid_ mindir_proto_mid _mindspore_transform_express_ir_obj)
endif()
target_link_libraries(lite-unified-executor mindspore::protobuf)
if(MSLITE_ENABLE_RUNTIME_GLOG)
target_link_libraries(lite-unified-executor mindspore::glog)
endif()
if(NOT WIN32)
target_link_libraries(lite-unified-executor dl)
endif()
if(ENABLE_MODEL_OBF)
target_link_libraries(lite-unified-executor ${OBF_LIB_DIR}/libmsdeobfuscator-lite.so)
endif()
endif()
if(MSLITE_ENABLE_RUNTIME_CONVERT)
target_link_libraries(lite-unified-executor
quantizer_mid fusion_mid proto_mid graph_pass_mid preprocess_mid
cpu_kernel_mid ccsrc_src_mid converter_src_mid lite_exporter_mid
config_parser_mid mslite_converter_plugin mindspore_core coder_mid
mindir_serializer_mid mindspore::protobuf ${SECUREC_LIBRARY})
target_link_libraries(lite-unified-executor
ccsrc_debug_common_mid_ mindir_proto_mid _mindspore_transform_express_ir_obj)
endif()
target_link_libraries(lite-unified-executor mindspore::protobuf)
if(MSLITE_ENABLE_RUNTIME_GLOG)
target_link_libraries(lite-unified-executor mindspore::glog)
endif()
if(NOT WIN32)
target_link_libraries(lite-unified-executor dl)
endif()
if(ENABLE_MODEL_OBF)
target_link_libraries(lite-unified-executor ${OBF_LIB_DIR}/libmsdeobfuscator-lite.so)
endif()

View File

@ -161,20 +161,29 @@ if(MSLITE_ENABLE_CLOUD_FUSION_INFERENCE OR MSLITE_ENABLE_CLOUD_INFERENCE)
if(NOT PLATFORM_ARM)
add_dependencies(mindspore-extendrt _mindspore_cpu_kernel_mod_depend_obj
mindspore-lite-proto mindspore::dnnl)
mindspore-lite-proto)
target_link_libraries(mindspore-extendrt _mindspore_cpu_kernel_mod_depend_obj
mindspore-lite-proto mindspore::dnnl)
mindspore-lite-proto)
add_dependencies(mindspore-extendrt_static _mindspore_cpu_kernel_mod_depend_obj
mindspore-lite-proto mindspore::dnnl)
mindspore-lite-proto)
target_link_libraries(mindspore-extendrt_static _mindspore_cpu_kernel_mod_depend_obj
mindspore-lite-proto mindspore::dnnl)
mindspore-lite-proto)
if(MSLITE_DEPS_MKLDNN)
add_dependencies(mindspore-extendrt mindspore::dnnl)
target_link_libraries(mindspore-extendrt mindspore::dnnl)
add_dependencies(mindspore-extendrt_static mindspore::dnnl)
target_link_libraries(mindspore-extendrt_static mindspore::dnnl)
endif()
if(MSLITE_DEPS_MKLDNN)
set(CPU_KERNEL_OBJECT_COUNT 0)
add_subdirectory(${CCSRC_DIR}/plugin/device/cpu/kernel lite_kernel_mod)
foreach(number RANGE 1 ${CPU_KERNEL_OBJECT_COUNT})
target_link_libraries(mindspore-extendrt _mindspore_plugin_device_cpu_kernel_obj_${number})
target_link_libraries(mindspore-extendrt_static _mindspore_plugin_device_cpu_kernel_obj_${number})
endforeach()
endif()
set(CPU_KERNEL_OBJECT_COUNT 0)
add_subdirectory(${CCSRC_DIR}/plugin/device/cpu/kernel lite_kernel_mod)
foreach(number RANGE 1 ${CPU_KERNEL_OBJECT_COUNT})
target_link_libraries(mindspore-extendrt _mindspore_plugin_device_cpu_kernel_obj_${number})
target_link_libraries(mindspore-extendrt_static _mindspore_plugin_device_cpu_kernel_obj_${number})
endforeach()
endif()
if(NOT WIN32)

View File

@ -69,7 +69,7 @@ enum CompressType {
kFSEInfer = 6
};
class Tensor {
class MS_API Tensor {
public:
Tensor() { tensor_c_ = {false, kTypeUnknown, NHWC, VarTensor, nullptr, 0}; }

View File

@ -56,7 +56,7 @@ namespace mindspore::lite {
*
* See the code for other constructors.
*/
class TensorList : public Tensor {
class MS_API TensorList : public Tensor {
public:
TensorList() { tensor_list_c_ = {false, kObjectTypeTensorType, DEFAULT_FORMAT, 0, kTypeUnknown, -1, nullptr, 0, 0}; }

View File

@ -1,7 +1,7 @@
add_definitions(-DPRIMITIVE_WRITEABLE)
add_definitions(-DUSE_GLOG)
set(USE_GLOG on)
if(MSLITE_ENABLE_MODEL_ENCRYPTION)
if(MSLITE_ENABLE_MODEL_ENCRYPTION AND MSLITE_DEPS_OPENSSL)
add_compile_definitions(ENABLE_OPENSSL)
endif()
@ -374,7 +374,6 @@ target_link_libraries(mindspore_converter
graph_pass_mid
fusion_mid
quantizer_mid
decomposer_mid
proto_mid
${SECUREC_LIBRARY}
mindspore::json
@ -388,6 +387,10 @@ target_link_libraries(mindspore_converter
mindir_serializer_mid
)
if(NOT MSLITE_SIMPLEST_CLOUD_INFERENCE)
target_link_libraries(mindspore_converter decomposer_mid)
endif()
if(MSLITE_EXPORT_COMPUTE_IR)
target_link_libraries(mindspore_converter mindspore_lite_drawer)
endif()

View File

@ -2,7 +2,10 @@ file(GLOB DECOMPOSER
${CMAKE_CURRENT_SOURCE_DIR}/*.cc
)
set_property(SOURCE ${DECOMPOSER} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_LITE)
add_library(decomposer_mid OBJECT ${DECOMPOSER})
add_dependencies(decomposer_mid fbs_src)
add_dependencies(decomposer_mid fbs_inner_src)
if(NOT MSLITE_SIMPLEST_CLOUD_INFERENCE)
add_library(decomposer_mid OBJECT ${DECOMPOSER})
add_dependencies(decomposer_mid fbs_src)
add_dependencies(decomposer_mid fbs_inner_src)
endif()

View File

@ -20,7 +20,10 @@ include_directories(${LITE_DIR})
#include coder
if(NOT MSVC OR NOT WIN32 OR NOT APPLE)
include(${TOP_DIR}/cmake/external_libs/cmsis.cmake)
if(MSLITE_DEPS_CMSIS)
message("MSLITE_DEPS_CMSIS enabled")
include(${TOP_DIR}/cmake/external_libs/cmsis.cmake)
endif()
include(${MICRO_DIR}/cmake/package_wrapper.cmake)
add_subdirectory(wrapper)
endif()

View File

@ -17,25 +17,28 @@ if(PLATFORM_ARM64)
elseif(PLATFORM_ARM32)
add_compile_definitions(ENABLE_ARM32)
else()
set(CMSIS_DIR ${CMAKE_BINARY_DIR}/cmsis)
message("build cmsis kernels")
include_directories(${CMSIS_DIR}/CMSIS/Core/Include)
include_directories(${CMSIS_DIR}/CMSIS/DSP/Include)
include_directories(${CMSIS_DIR}/CMSIS/NN/Include)
if(MSLITE_DEPS_CMSIS)
message("MSLITE_DEPS_CMSIS enabled")
set(CMSIS_DIR ${CMAKE_BINARY_DIR}/cmsis)
message("build cmsis kernels")
include_directories(${CMSIS_DIR}/CMSIS/Core/Include)
include_directories(${CMSIS_DIR}/CMSIS/DSP/Include)
include_directories(${CMSIS_DIR}/CMSIS/NN/Include)
file(REMOVE ${CMSIS_DIR}/CMSIS/NN/Source/NNSupportFunctions/arm_q7_to_q15_reordered_no_shift.c)
file(GLOB CMSIS_OPS
${CMSIS_DIR}/CMSIS/NN/Source/BasicMathFunctions/*.c
${CMSIS_DIR}/CMSIS/NN/Source/ActivationFunctions/*.c
${CMSIS_DIR}/CMSIS/NN/Source/ConcatenationFunctions/*.c
${CMSIS_DIR}/CMSIS/NN/Source/ConvolutionFunctions/*.c
${CMSIS_DIR}/CMSIS/NN/Source/FullyConnectedFunctions/*.c
${CMSIS_DIR}/CMSIS/NN/Source/NNSupportFunctions/*.c
${CMSIS_DIR}/CMSIS/NN/Source/PoolingFunctions/*.c
${CMSIS_DIR}/CMSIS/NN/Source/ReshapeFunctions/*.c
${CMSIS_DIR}/CMSIS/NN/Source/SoftmaxFunctions/*.c
)
add_library(cmsis_nn STATIC ${CMSIS_OPS})
file(REMOVE ${CMSIS_DIR}/CMSIS/NN/Source/NNSupportFunctions/arm_q7_to_q15_reordered_no_shift.c)
file(GLOB CMSIS_OPS
${CMSIS_DIR}/CMSIS/NN/Source/BasicMathFunctions/*.c
${CMSIS_DIR}/CMSIS/NN/Source/ActivationFunctions/*.c
${CMSIS_DIR}/CMSIS/NN/Source/ConcatenationFunctions/*.c
${CMSIS_DIR}/CMSIS/NN/Source/ConvolutionFunctions/*.c
${CMSIS_DIR}/CMSIS/NN/Source/FullyConnectedFunctions/*.c
${CMSIS_DIR}/CMSIS/NN/Source/NNSupportFunctions/*.c
${CMSIS_DIR}/CMSIS/NN/Source/PoolingFunctions/*.c
${CMSIS_DIR}/CMSIS/NN/Source/ReshapeFunctions/*.c
${CMSIS_DIR}/CMSIS/NN/Source/SoftmaxFunctions/*.c
)
add_library(cmsis_nn STATIC ${CMSIS_OPS})
endif()
endif()
include(${MICRO_DIR}/cmake/package_wrapper.cmake)

View File

@ -24,6 +24,7 @@
#include "src/tensor.h"
namespace mindspore::lite::quant {
#ifdef ENABLE_EIGEN
template <typename T>
int CalculateHessianMatrix(void *x, void *y, int64_t m, int64_t n, bool transpose = false) {
CHECK_NULL_RETURN(x);
@ -117,6 +118,24 @@ int CalculateCholeskyInverse(void *x, void *y, int64_t n, bool upper = false) {
}
return RET_OK;
}
#else
template <typename T>
int CalculateHessianMatrix(void *x, void *y, int64_t m, int64_t n, bool transpose = false) {
MS_LOG(ERROR) << "Unsupported feature when eigen not imported.";
return RET_ERROR;
}
int CalculateCholesky(const void *x, void *y, std::vector<int64_t> dims, bool upper = false) {
MS_LOG(ERROR) << "Unsupported feature when eigen not imported.";
return RET_ERROR;
}
template <typename T>
int CalculateCholeskyInverse(void *x, void *y, int64_t n, bool upper = false) {
MS_LOG(ERROR) << "Unsupported feature when eigen not imported.";
return RET_ERROR;
}
#endif
} // namespace mindspore::lite::quant
#endif // MINDSPORE_LITE_TOOLS_CONVERTER_QUANTIZER_EIGEN_UTIL_H_

View File

@ -314,7 +314,6 @@ getCommonFile() {
mindspore/lite/src/litert/kernel/cpu/fp32/shape_fusion_fp32.cc
mindspore/core/utils/status.cc
mindspore/core/utils/log_adapter.cc
mindspore/lite/src/expression/ops_utils.cc
mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/kernel.c
mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/tensor_c_utils.c
mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/tensorlist_c_utils.c