提交 b59e8ccf 编写于 作者: M Megvii Engine Team

fix(mgb): fix cambricon bangc copybara

GitOrigin-RevId: 22b57364e8ab4f2fadec41447a984b921742ab5e
上级 3116e128
...@@ -798,34 +798,6 @@ endif() ...@@ -798,34 +798,6 @@ endif()
if(MGE_WITH_CAMBRICON) if(MGE_WITH_CAMBRICON)
include_directories("$ENV{NEUWARE_HOME}/include") include_directories("$ENV{NEUWARE_HOME}/include")
link_directories("$ENV{NEUWARE_HOME}/lib64") link_directories("$ENV{NEUWARE_HOME}/lib64")
include(cmake/FindBANG/FindBANG.cmake)
if (${MGE_MLU_ARCH} STREQUAL "MLU100")
set(BANG_ARCH "100")
elseif (${MGE_MLU_ARCH} STREQUAL "MLU1h8")
set(BANG_ARCH "110")
elseif (${MGE_MLU_ARCH} STREQUAL "MLU220")
set(BANG_ARCH "220")
elseif (${MGE_MLU_ARCH} STREQUAL "MLU270")
set(BANG_ARCH "270")
elseif (${MGE_MLU_ARCH} STREQUAL "MLU290")
set(BANG_ARCH "290")
elseif (${MGE_MLU_ARCH} STREQUAL "MLU200")
set(BANG_ARCH "200")
else()
message (FATAL_ERROR "Unsupported MLU arch.")
endif()
set(BANG_CNCC_FLAGS "${BANG_CNCC_FLAGS} --bang-mlu-arch=${MGE_MLU_ARCH}")
set(BANG_CNCC_FLAGS "${BANG_CNCC_FLAGS} -std=c++11 -Werror")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__BANG_ARCH__=${BANG_ARCH}")
if (${CMAKE_BUILD_TYPE} STREQUAL "Debug")
set(BANG_CNCC_FLAGS "${BANG_CNCC_FLAGS} -g -O0")
elseif (${CMAKE_BUILD_TYPE} STREQUAL "Release")
set(BANG_CNCC_FLAGS "${BANG_CNCC_FLAGS} -O3")
elseif (${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo")
set(BANG_CNCC_FLAGS "${BANG_CNCC_FLAGS} -g -O3")
elseif (${CMAKE_BUILD_TYPE} STREQUAL "MinSizeRel")
set(BANG_CNCC_FLAGS "${BANG_CNCC_FLAGS} -Os")
endif()
include(cmake/cnrt.cmake) include(cmake/cnrt.cmake)
include(cmake/cndev.cmake) include(cmake/cndev.cmake)
include(cmake/cnml.cmake) include(cmake/cnml.cmake)
...@@ -957,7 +929,6 @@ set(MEGDNN_WITH_ROCM ${MGE_WITH_ROCM}) ...@@ -957,7 +929,6 @@ set(MEGDNN_WITH_ROCM ${MGE_WITH_ROCM})
# CAMBRICON # CAMBRICON
set(MGB_CAMBRICON ${MGE_WITH_CAMBRICON}) set(MGB_CAMBRICON ${MGE_WITH_CAMBRICON})
set(MEGDNN_WITH_CAMBRICON ${MGE_WITH_CAMBRICON})
# ENFLAME # ENFLAME
set(MGB_ENFLAME ${MGE_WITH_ENFLAME}) set(MGB_ENFLAME ${MGE_WITH_ENFLAME})
......
...@@ -163,19 +163,6 @@ if(MGE_WITH_CUDA) ...@@ -163,19 +163,6 @@ if(MGE_WITH_CUDA)
list(APPEND SOURCES ${CUSOURCES}) list(APPEND SOURCES ${CUSOURCES})
endif() endif()
if(MGE_WITH_CAMBRICON)
file(GLOB_RECURSE SOURCES_ cambricon/*.cpp)
list(APPEND SOURCES ${SOURCES_})
file(GLOB_RECURSE BANG_SOURCES cambricon/*.mlu)
list(APPEND MEGDNN_INCLUDES "${PROJECT_SOURCE_DIR}/dnn/include")
list(APPEND MEGDNN_INCLUDES "${PROJECT_SOURCE_DIR}/dnn")
list(APPEND MEGDNN_INCLUDES "${PROJECT_BINARY_DIR}/genfiles")
bang_compile(BANG_OBJS "${BANG_SOURCES}" "${MEGDNN_INCLUDES}")
list(APPEND SOURCES ${BANG_OBJS})
endif()
if(MGE_WITH_ATLAS) if(MGE_WITH_ATLAS)
file(GLOB_RECURSE SOURCES_ atlas/*.cpp) file(GLOB_RECURSE SOURCES_ atlas/*.cpp)
list(APPEND SOURCES ${SOURCES_}) list(APPEND SOURCES ${SOURCES_})
...@@ -264,8 +251,4 @@ if(CMAKE_THREAD_LIBS_INIT) ...@@ -264,8 +251,4 @@ if(CMAKE_THREAD_LIBS_INIT)
target_link_libraries(megdnn PRIVATE Threads::Threads) target_link_libraries(megdnn PRIVATE Threads::Threads)
endif() endif()
if(MGE_WITH_CAMBRICON)
target_link_libraries(megdnn PRIVATE ${BANG_OBJS} ${MGE_CAMBRICON_LIBS})
endif()
install(TARGETS megdnn EXPORT ${MGE_EXPORT_TARGETS}) install(TARGETS megdnn EXPORT ${MGE_EXPORT_TARGETS})
...@@ -29,11 +29,6 @@ if(MGE_WITH_MIDOUT_PROFILE) ...@@ -29,11 +29,6 @@ if(MGE_WITH_MIDOUT_PROFILE)
list(APPEND SOURCES ${PROJECT_SOURCE_DIR}/third_party/midout/src/midout.cpp) list(APPEND SOURCES ${PROJECT_SOURCE_DIR}/third_party/midout/src/midout.cpp)
endif() endif()
if(MGE_WITH_CAMBRICON)
file(GLOB_RECURSE SOURCES_ cambricon/*.cpp)
list(APPEND SOURCES ${SOURCES_})
endif()
if(MGE_WITH_ATLAS) if(MGE_WITH_ATLAS)
file(GLOB_RECURSE SOURCES_ atlas/*.cpp) file(GLOB_RECURSE SOURCES_ atlas/*.cpp)
list(APPEND SOURCES ${SOURCES_}) list(APPEND SOURCES ${SOURCES_})
......
...@@ -26,10 +26,6 @@ ...@@ -26,10 +26,6 @@
#include "megcore_rocm.h" #include "megcore_rocm.h"
#endif #endif
#if MGB_CAMBRICON
#include "megcore_cambricon.h"
#endif
#if MGB_ATLAS #if MGB_ATLAS
#include "acl/acl.h" #include "acl/acl.h"
#include "megcore_atlas.h" #include "megcore_atlas.h"
...@@ -81,10 +77,6 @@ MegDNNHandle::MegDNNHandle(const CompNodeEnv& env) { ...@@ -81,10 +77,6 @@ MegDNNHandle::MegDNNHandle(const CompNodeEnv& env) {
#if MGB_CAMBRICON #if MGB_CAMBRICON
if (env.property().type == CompNode::DeviceType::CAMBRICON) { if (env.property().type == CompNode::DeviceType::CAMBRICON) {
CompNodeEnv::CnrtEnv::init_status.init(); CompNodeEnv::CnrtEnv::init_status.init();
megcore::createDeviceHandleWithGlobalInitStatus(
&m_dev_hdl, env.cnrt_env().device, 0, true);
megcore::createComputingHandleWithCambriconContext(
&m_comp_hdl, m_dev_hdl, 0, {env.cnrt_env().queue});
init = true; init = true;
} }
#endif #endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册