forked from mindspore-Ecosystem/mindspore
!48105 [LITE] mslite support build kernel mod
Merge pull request !48105 from ling/pr
This commit is contained in:
commit
65f36d8def
|
@ -20,6 +20,7 @@ set(PROVIDERS_LIB_DIR ${RUNTIME_PKG_NAME}/providers)
|
|||
set(MIND_DATA_INC_DIR ${RUNTIME_PKG_NAME}/runtime/include/dataset)
|
||||
set(TURBO_DIR ${RUNTIME_PKG_NAME}/runtime/third_party/libjpeg-turbo)
|
||||
set(GLOG_DIR ${RUNTIME_PKG_NAME}/runtime/third_party/glog)
|
||||
set(DNNL_DIR ${RUNTIME_PKG_NAME}/runtime/third_party/dnnl)
|
||||
set(SECUREC_DIR ${RUNTIME_PKG_NAME}/runtime/third_party/securec)
|
||||
set(MINDSPORE_LITE_LIB_NAME libmindspore-lite)
|
||||
set(MINDSPORE_LITE_EXTENDRT_LIB_NAME libmindspore-lite)
|
||||
|
@ -844,6 +845,10 @@ else()
|
|||
DESTINATION ${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
|
||||
install(FILES ${glog_LIBPATH}/libmindspore_glog.so.0.4.0 DESTINATION ${RUNTIME_LIB_DIR}
|
||||
RENAME libmindspore_glog.so.0 COMPONENT ${RUNTIME_COMPONENT_NAME})
|
||||
install(FILES ${onednn_LIBPATH}/libdnnl.so.2.2 DESTINATION ${RUNTIME_LIB_DIR}
|
||||
RENAME libdnnl.so.2 COMPONENT ${RUNTIME_COMPONENT_NAME})
|
||||
install(FILES ${onednn_LIBPATH}/libdnnl.so.2.2 DESTINATION ${DNNL_DIR}
|
||||
RENAME libdnnl.so.2 COMPONENT ${RUNTIME_COMPONENT_NAME})
|
||||
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})
|
||||
|
|
|
@ -34,6 +34,17 @@ if(ENABLE_CPU)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
if(BUILD_LITE)
|
||||
# mslite do not support python op
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx ")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maxv ")
|
||||
string(REPLACE "-Wall" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
|
||||
string(REPLACE "-Wall" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
||||
list(REMOVE_ITEM CPU_SRC_LIST "pyexecute/py_execute_cpu_kernel.cc")
|
||||
list(REMOVE_ITEM CPU_SRC_LIST "pyfunc/py_func_cpu_kernel.cc")
|
||||
list(REMOVE_ITEM CPU_SRC_LIST "opaque_predicate_kernel.cc")
|
||||
endif()
|
||||
|
||||
if(NOT ENABLE_CPU OR WIN32)
|
||||
list(REMOVE_ITEM CPU_SRC_LIST "ps/apply_momentum_ps_kernel.cc")
|
||||
list(REMOVE_ITEM CPU_SRC_LIST "ps/embedding_look_up_proxy_kernel.cc")
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
*/
|
||||
|
||||
#include "plugin/device/cpu/kernel/bias_add_cpu_kernel.h"
|
||||
#ifdef ENABLE_AVX
|
||||
#include <immintrin.h>
|
||||
#endif
|
||||
#include "ops/bias_add.h"
|
||||
#include <map>
|
||||
#include <complex>
|
||||
|
|
|
@ -240,6 +240,9 @@ build_python_wheel_package() {
|
|||
if [ -d "${INSTALL_PREFIX}/${pkg_name}/runtime/third_party/glog" ]; then
|
||||
cp ${INSTALL_PREFIX}/${pkg_name}/runtime/third_party/glog/*.so* package/mindspore_lite/lib/
|
||||
fi
|
||||
if [ -d "${INSTALL_PREFIX}/${pkg_name}/runtime/third_party/dnnl" ]; then
|
||||
cp ${INSTALL_PREFIX}/${pkg_name}/runtime/third_party/dnnl/*.so* package/mindspore_lite/lib/
|
||||
fi
|
||||
if [ -d "${INSTALL_PREFIX}/${pkg_name}/tools/converter/lib" ]; then
|
||||
cp ${INSTALL_PREFIX}/${pkg_name}/tools/converter/lib/*.so* package/mindspore_lite/lib/
|
||||
fi
|
||||
|
|
|
@ -70,7 +70,13 @@ if(MSLITE_ENABLE_CLOUD_FUSION_INFERENCE OR MSLITE_ENABLE_CLOUD_INFERENCE)
|
|||
list(APPEND MSLITE_PROTO_SRC ${PROFILER_MEM_PROTO_SRC})
|
||||
endif()
|
||||
|
||||
add_library(mindspore-lite-proto OBJECT ${MSLITE_PROTO_SRC})
|
||||
include_directories("${CMAKE_BINARY_DIR}/runtime/graph_scheduler/actor/rpc")
|
||||
file(GLOB_RECURSE RPC_PROTO RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
"${CCSRC_DIR}/runtime/graph_scheduler/actor/rpc/protocol/rpc.proto")
|
||||
ms_protobuf_generate(RPC_PROTO_SRCS RPC_PROTO_HDRS ${RPC_PROTO})
|
||||
list(APPEND MSLITE_PROTO_SRC ${RPC_PROTO_SRCS})
|
||||
|
||||
add_library(mindspore-lite-proto STATIC ${MSLITE_PROTO_SRC})
|
||||
|
||||
set(ANF_ALG_SRC ${ANF_ALG_SRC}
|
||||
${CCSRC_DIR}/utils/anfalgo.cc
|
||||
|
@ -124,18 +130,15 @@ if(MSLITE_ENABLE_CLOUD_FUSION_INFERENCE OR MSLITE_ENABLE_CLOUD_INFERENCE)
|
|||
${CORE_DIR}/utils/status.cc
|
||||
)
|
||||
add_library(mindspore-kernel-graph OBJECT ${KERNEL_GRAPH_SRC})
|
||||
add_dependencies(mindspore-kernel-graph mindspore-lite-proto)
|
||||
|
||||
add_library(mindspore-extendrt SHARED ${MSLITE_EXTEND_RUNTIME_SRC})
|
||||
add_dependencies(mindspore-extendrt fbs_inner_src)
|
||||
add_dependencies(mindspore-extendrt mindspore-lite-proto)
|
||||
add_dependencies(mindspore-extendrt mindspore-infer-anfalgo)
|
||||
add_dependencies(mindspore-extendrt mindspore-kernel-graph)
|
||||
add_subdirectory(cxx_api)
|
||||
add_subdirectory(delegate/graph_executor/litert)
|
||||
add_library(mindspore-extendrt_static STATIC ${MSLITE_EXTEND_RUNTIME_SRC})
|
||||
add_dependencies(mindspore-extendrt_static fbs_inner_src)
|
||||
add_dependencies(mindspore-extendrt_static mindspore-lite-proto)
|
||||
add_dependencies(mindspore-extendrt_static mindspore-infer-anfalgo)
|
||||
add_dependencies(mindspore-extendrt_static mindspore-kernel-graph)
|
||||
|
||||
|
@ -155,6 +158,41 @@ if(MSLITE_ENABLE_CLOUD_FUSION_INFERENCE OR MSLITE_ENABLE_CLOUD_INFERENCE)
|
|||
add_dependencies(mindspore-extendrt_static msplugin-ge-litert)
|
||||
target_link_libraries(mindspore-extendrt_static msplugin-ge-litert)
|
||||
|
||||
if(NOT PLATFORM_ARM)
|
||||
set(KERNEL_MOD_DEPEND_SRC
|
||||
${CCSRC_DIR}/kernel/environ_manager.cc
|
||||
${CCSRC_DIR}/utils/python_fallback_running.cc
|
||||
${CCSRC_DIR}/runtime/device/tensors_queue.cc
|
||||
${CCSRC_DIR}/runtime/device/tensor_array.cc
|
||||
${CCSRC_DIR}/runtime/graph_scheduler/actor/actor_common.cc
|
||||
${CCSRC_DIR}/runtime/hardware/device_context_manager.cc
|
||||
${CCSRC_DIR}/plugin/device/cpu/hal/device/cpu_tensor_array.cc
|
||||
${CCSRC_DIR}/plugin/device/cpu/hal/hardware/cpu_memory_pool.cc
|
||||
${CCSRC_DIR}/distributed/embedding_cache/embedding_cache_utils.cc
|
||||
${CCSRC_DIR}/distributed/embedding_cache/embedding_hash_map.cc
|
||||
${CCSRC_DIR}/distributed/embedding_cache/embedding_storage/dense_embedding_storage.cc
|
||||
${CCSRC_DIR}/distributed/embedding_cache/embedding_storage/embedding_storage.cc
|
||||
${CCSRC_DIR}/distributed/persistent/storage/local_file.cc
|
||||
${CCSRC_DIR}/distributed/persistent/storage/block.cc
|
||||
${CCSRC_DIR}/distributed/persistent/storage/json_utils.cc
|
||||
${CCSRC_DIR}/distributed/persistent/storage/file_io_utils.cc
|
||||
${CCSRC_DIR}/distributed/cluster/dummy_cluster_context.cc
|
||||
${CCSRC_DIR}/ps/ps_context.cc
|
||||
)
|
||||
add_library(_mindspore_cpu_kernel_mod_depend_obj OBJECT ${KERNEL_MOD_DEPEND_SRC})
|
||||
target_link_libraries(mindspore-extendrt _mindspore_cpu_kernel_mod_depend_obj
|
||||
mindspore-lite-proto mindspore::dnnl)
|
||||
target_link_libraries(mindspore-extendrt_static _mindspore_cpu_kernel_mod_depend_obj
|
||||
mindspore-lite-proto mindspore::dnnl)
|
||||
|
||||
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)
|
||||
target_link_libraries(mindspore-extendrt dl)
|
||||
target_link_libraries(mindspore-extendrt_static dl)
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
|
||||
namespace {
|
||||
constexpr const int kMaxDepth = 2048;
|
||||
constexpr const int kInitBufferSize = 1024;
|
||||
constexpr int kOperatorMaxThreadNum = 16;
|
||||
} // namespace
|
||||
|
||||
|
@ -200,7 +201,7 @@ SearchSubGraph::CostModel SearchSubGraph::CalculateConv2DFusion(const LiteGraph:
|
|||
}
|
||||
|
||||
const schema::Primitive *SearchSubGraph::CreatePartialPrimitive(int64_t subgraph_index) {
|
||||
flatbuffers::FlatBufferBuilder fbb(1024);
|
||||
flatbuffers::FlatBufferBuilder fbb(kInitBufferSize);
|
||||
auto val_offset = schema::CreatePartialFusion(fbb, subgraph_index);
|
||||
auto prim_offset = schema::CreatePrimitive(fbb, schema::PrimitiveType_PartialFusion, val_offset.o);
|
||||
fbb.Finish(prim_offset);
|
||||
|
|
Loading…
Reference in New Issue