!32287 package lite so in cloud whl when build ascend 910 whl

Merge pull request !32287 from zhengyuanhua/br1
This commit is contained in:
i-robot 2022-04-13 10:11:47 +00:00 committed by Gitee
commit bafbba1a0b
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
8 changed files with 31 additions and 19 deletions

View File

@ -109,9 +109,11 @@ add_subdirectory(mindspore/ccsrc)
add_subdirectory(mindspore/core) add_subdirectory(mindspore/core)
if(DEFINED ENV{ENABLE_CLOUD_AND_LITE}) if(DEFINED ENV{ENABLE_CLOUD_AND_LITE})
set(ENABLE_CLOUD_AND_LITE $ENV{ENABLE_CLOUD_AND_LITE}) set(ENABLE_CLOUD_AND_LITE $ENV{ENABLE_CLOUD_AND_LITE})
endif() endif()
if(ENABLE_CLOUD_AND_LITE) if(ENABLE_CLOUD_AND_LITE)
set(ENV{MSLITE_ENABLE_RUNTIME_CONVERT} "on")
set(ENV{MSLITE_ENABLE_ACL} "on")
add_subdirectory(mindspore/lite) add_subdirectory(mindspore/lite)
endif() endif()

View File

@ -98,7 +98,10 @@ endif()
if(DEFINED ENV{MSLITE_ENABLE_CONVERTER}) if(DEFINED ENV{MSLITE_ENABLE_CONVERTER})
set(MSLITE_ENABLE_CONVERTER $ENV{MSLITE_ENABLE_CONVERTER}) set(MSLITE_ENABLE_CONVERTER $ENV{MSLITE_ENABLE_CONVERTER})
endif() endif()
if(DEFINED ENV{ENABLE_AKG}) if(DEFINED ENV{MSLITE_ENABLE_RUNTIME_CONVERT})
set(MSLITE_ENABLE_RUNTIME_CONVERT $ENV{MSLITE_ENABLE_RUNTIME_CONVERT})
endif()
if(DEFINED ENV{ENABLE_AKG} AND NOT MSLITE_ENABLE_RUNTIME_CONVERT)
set(MSLITE_ENABLE_GRAPH_KERNEL $ENV{ENABLE_AKG}) set(MSLITE_ENABLE_GRAPH_KERNEL $ENV{ENABLE_AKG})
endif() endif()
if(DEFINED ENV{MSLITE_ENABLE_TOOLS}) if(DEFINED ENV{MSLITE_ENABLE_TOOLS})
@ -161,10 +164,6 @@ if(DEFINED ENV{MSLITE_ENABLE_MODEL_ENCRYPTION})
endif() endif()
endif() endif()
if(DEFINED ENV{MSLITE_ENABLE_RUNTIME_CONVERT})
set(MSLITE_ENABLE_RUNTIME_CONVERT $ENV{MSLITE_ENABLE_RUNTIME_CONVERT})
endif()
if(DEFINED ENV{MSLITE_ENABLE_COVERAGE}) if(DEFINED ENV{MSLITE_ENABLE_COVERAGE})
set(MSLITE_ENABLE_COVERAGE $ENV{MSLITE_ENABLE_COVERAGE}) set(MSLITE_ENABLE_COVERAGE $ENV{MSLITE_ENABLE_COVERAGE})
endif() endif()

View File

@ -488,12 +488,14 @@ if(MSLITE_ENABLE_RUNTIME_CONVERT)
quantizer_mid fusion_mid proto_mid graph_pass_mid preprocess_mid quantizer_mid fusion_mid proto_mid graph_pass_mid preprocess_mid
cpu_kernel_mid ccsrc_src_mid converter_src_mid anf_exporter_mid cpu_kernel_mid ccsrc_src_mid converter_src_mid anf_exporter_mid
config_parser_mid mslite_converter_plugin mindspore_core coder_mid config_parser_mid mslite_converter_plugin mindspore_core coder_mid
mindspore::protobuf ${SECUREC_LIBRARY}) ccsrc_debug_common_mid_ mindir_proto_mid _mindspore_transform_express_ir_obj
mindir_serializer_mid mindspore::protobuf ${SECUREC_LIBRARY})
target_link_libraries(mindspore-lite_static target_link_libraries(mindspore-lite_static
quantizer_mid fusion_mid proto_mid graph_pass_mid preprocess_mid quantizer_mid fusion_mid proto_mid graph_pass_mid preprocess_mid
cpu_kernel_mid ccsrc_src_mid converter_src_mid anf_exporter_mid cpu_kernel_mid ccsrc_src_mid converter_src_mid anf_exporter_mid
config_parser_mid mslite_converter_plugin mindspore_core coder_mid config_parser_mid mslite_converter_plugin mindspore_core coder_mid
mindspore::protobuf ${SECUREC_LIBRARY}) ccsrc_debug_common_mid_ mindir_proto_mid _mindspore_transform_express_ir_obj
mindir_serializer_mid mindspore::protobuf ${SECUREC_LIBRARY})
if(MSLITE_ENABLE_ACL) if(MSLITE_ENABLE_ACL)
target_link_libraries(mindspore-lite lite_acl_mid target_link_libraries(mindspore-lite lite_acl_mid
mindspore_shared_lib) mindspore_shared_lib)

View File

@ -302,12 +302,14 @@ target_link_libraries(converter_lite PRIVATE
preprocess_mid preprocess_mid
config_parser_mid config_parser_mid
coder_mid coder_mid
ccsrc_debug_common_mid_
mindir_proto_mid
_mindspore_transform_express_ir_obj
mindir_serializer_mid mindir_serializer_mid
) )
if(NOT ENABLE_CLOUD_AND_LITE)
target_link_libraries(converter_lite PRIVATE
ccsrc_debug_common_mid_
mindir_proto_mid
_mindspore_transform_express_ir_obj)
endif()
if(MSLITE_ENABLE_ACL) if(MSLITE_ENABLE_ACL)
target_link_libraries(converter_lite PRIVATE target_link_libraries(converter_lite PRIVATE
lite_acl_mid lite_acl_mid

View File

@ -14,8 +14,10 @@ add_library(mindir_proto_mid OBJECT ${PROTO_SRCS})
add_compile_definitions(MINDIR_EXPORT_TENSOR_LAYOUT_CLIP) add_compile_definitions(MINDIR_EXPORT_TENSOR_LAYOUT_CLIP)
add_compile_definitions(COMMON_DLL) add_compile_definitions(COMMON_DLL)
set(MINDIR_EXPORT_DIR ${CCSRC_DIR}/transform/express_ir) if(NOT ENABLE_CLOUD_AND_LITE)
add_subdirectory(${MINDIR_EXPORT_DIR} mindir_exporter) set(MINDIR_EXPORT_DIR ${CCSRC_DIR}/transform/express_ir)
add_subdirectory(${MINDIR_EXPORT_DIR} mindir_exporter)
endif()
add_library(mindir_serializer_mid OBJECT add_library(mindir_serializer_mid OBJECT
${MINDIR_EXPORTER_SRC_LIST} ${MINDIR_EXPORTER_SRC_LIST}

View File

@ -30,6 +30,7 @@ namespace mindspore::lite {
constexpr const size_t TOTAL_SAVE = 1024 * 1024 * 1024; constexpr const size_t TOTAL_SAVE = 1024 * 1024 * 1024;
constexpr const int64_t OFFSET = 64; constexpr const int64_t OFFSET = 64;
#ifndef ENABLE_CLOUD_AND_LITE
namespace { namespace {
bool DeleteDirRecursively(const std::string &dir_name) { bool DeleteDirRecursively(const std::string &dir_name) {
DIR *dir = opendir(dir_name.c_str()); DIR *dir = opendir(dir_name.c_str());
@ -400,16 +401,18 @@ int MindIRSerializer::SaveProtoToFile(mind_ir::ModelProto *model_proto, const st
ChangeFileMode(realpath.value(), S_IRUSR); ChangeFileMode(realpath.value(), S_IRUSR);
return RET_OK; return RET_OK;
} }
#endif
int MindIRSerialize(const std::unique_ptr<converter::Flags> &flag, const FuncGraphPtr &func_graph) { int MindIRSerialize(const std::unique_ptr<converter::Flags> &flag, const FuncGraphPtr &func_graph) {
#ifndef ENABLE_CLOUD_AND_LITE
if (!flag->export_mindir) { if (!flag->export_mindir) {
return RET_OK; return RET_OK;
} }
#if defined(SYSTEM_ENV_WINDOWS)
MS_LOG(WARNING) << "mindir serialize not support windows now.";
return RET_NOT_SUPPORT;
#endif
mindspore::lite::MindIRSerializer serializer; mindspore::lite::MindIRSerializer serializer;
return serializer.Save(flag, func_graph); return serializer.Save(flag, func_graph);
#else
MS_LOG(INFO) << "No need to serialize mindir when load model online.";
return RET_OK;
#endif
} }
} // namespace mindspore::lite } // namespace mindspore::lite

View File

@ -29,6 +29,7 @@
#include "mindspore/core/utils/system/env.h" #include "mindspore/core/utils/system/env.h"
namespace mindspore::lite { namespace mindspore::lite {
#ifndef ENABLE_CLOUD_AND_LITE
class MindIRSerializer { class MindIRSerializer {
public: public:
MindIRSerializer() = default; MindIRSerializer() = default;
@ -71,7 +72,7 @@ class MindIRSerializer {
std::fstream *data_fs_ = nullptr; std::fstream *data_fs_ = nullptr;
std::shared_ptr<system::FileSystem> fs_{}; std::shared_ptr<system::FileSystem> fs_{};
}; };
#endif
// export func_graph // export func_graph
int MindIRSerialize(const std::unique_ptr<converter::Flags> &flag, const FuncGraphPtr &func_graph); int MindIRSerialize(const std::unique_ptr<converter::Flags> &flag, const FuncGraphPtr &func_graph);
} // namespace mindspore::lite } // namespace mindspore::lite

View File

@ -56,6 +56,7 @@ parse_device()
ENABLE_CPU="on" ENABLE_CPU="on"
export ENABLE_MPI="on" export ENABLE_MPI="on"
export ENABLE_AKG="on" export ENABLE_AKG="on"
export ENABLE_CLOUD_AND_LITE="on"
else else
echo "Invalid value ${DEVICE_VERSION} for option -V" echo "Invalid value ${DEVICE_VERSION} for option -V"
usage usage