未验证 提交 875daa4d 编写于 作者: S Santa An 提交者: GitHub

* support download bm_sdk, test=develop (#3093)

上级 f6e09aaf
...@@ -25,7 +25,11 @@ void Graph::AddNode(const std::string& name) { ...@@ -25,7 +25,11 @@ void Graph::AddNode(const std::string& name) {
} }
void Graph::CreateCompilerHandle() { void Graph::CreateCompilerHandle() {
#ifdef BM1682
compiler_handle_ = create_bmcompiler("BM1682");
#else
compiler_handle_ = create_bmcompiler("BM1684"); compiler_handle_ = create_bmcompiler("BM1684");
#endif
CHECK(compiler_handle_ != nullptr); CHECK(compiler_handle_ != nullptr);
} }
......
...@@ -34,7 +34,6 @@ int SubgraphEngine::BuildDeviceProgram() { ...@@ -34,7 +34,6 @@ int SubgraphEngine::BuildDeviceProgram() {
const auto& bridges = subgraph::Registry::Instance(); const auto& bridges = subgraph::Registry::Instance();
graph.CreateCompilerHandle(); graph.CreateCompilerHandle();
auto& ctx = this->ctx_->template As<BMContext>(); auto& ctx = this->ctx_->template As<BMContext>();
int kk = 0;
for (auto& inst : origin_program_) { for (auto& inst : origin_program_) {
auto op = inst.op(); auto op = inst.op();
CHECK(op); CHECK(op);
......
...@@ -56,12 +56,11 @@ int Engine::BuildOriginProgram() { ...@@ -56,12 +56,11 @@ int Engine::BuildOriginProgram() {
} else { } else {
VLOG(3) << "The attr '" << kKernelTypeAttr VLOG(3) << "The attr '" << kKernelTypeAttr
<< "' not found, pick the first kernel for " << op_type; << "' not found, pick the first kernel for " << op_type;
std::vector<std::unique_ptr<KernelBase>> kernels;
#if defined(LITE_WITH_ARM) #if defined(LITE_WITH_ARM)
auto kernels = kernels = op->CreateKernels({Place{TARGET(kARM)}, Place{TARGET(kHost)}});
op->CreateKernels({Place{TARGET(kARM)}, Place{TARGET(kHost)}});
#elif defined(LITE_WITH_X86) #elif defined(LITE_WITH_X86)
auto kernels = kernels = op->CreateKernels({Place{TARGET(kX86)}, Place{TARGET(kHost)}});
op->CreateKernels({Place{TARGET(kX86)}, Place{TARGET(kHost)}});
#endif #endif
if (kernels.size() > 0) { if (kernels.size() > 0) {
picked_kernel = std::move(kernels.front()); picked_kernel = std::move(kernels.front());
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
set -ex set -ex
# global variables with default value # global variables with default value
BM_SDK_ROOT="$(pwd)/../BM_SDK" # BM SDK BM_SDK_ROOT="$(pwd)/third-party/bmlibs/bm_sc3_libs" # BM SDK
TARGET_NAME="BM1682" # default target TARGET_NAME="BM1682" # default target
BUILD_EXTRA=OFF # ON(with sequence ops)/OFF BUILD_EXTRA=OFF # ON(with sequence ops)/OFF
WITH_TESTING=ON # ON/OFF WITH_TESTING=ON # ON/OFF
...@@ -39,6 +39,11 @@ function prepare_thirdparty { ...@@ -39,6 +39,11 @@ function prepare_thirdparty {
else else
git submodule update --init --recursive git submodule update --init --recursive
fi fi
# clone bmlibs
if [ ! -d ${workspace}/third-party/bmlibs ]; then
git clone https://github.com/AnBaolei1984/bmlibs.git ${workspace}/third-party/bmlibs
fi
} }
# for code gen, a source file is generated after a test, but is dependended by some targets in cmake. # for code gen, a source file is generated after a test, but is dependended by some targets in cmake.
...@@ -70,8 +75,8 @@ function build_bm { ...@@ -70,8 +75,8 @@ function build_bm {
${CMAKE_COMMON_OPTIONS} \ ${CMAKE_COMMON_OPTIONS} \
-DWITH_GPU=OFF \ -DWITH_GPU=OFF \
-DWITH_MKLDNN=OFF \ -DWITH_MKLDNN=OFF \
-DLITE_WITH_X86=ON \ -DLITE_WITH_X86=OFF \
-DWITH_MKL=ON \ -DWITH_MKL=OFF \
-DLITE_BUILD_EXTRA=ON \ -DLITE_BUILD_EXTRA=ON \
-DLITE_WITH_XPU=OFF \ -DLITE_WITH_XPU=OFF \
-DLITE_WITH_BM=ON \ -DLITE_WITH_BM=ON \
...@@ -92,10 +97,10 @@ function main { ...@@ -92,10 +97,10 @@ function main {
TARGET_NAME="${i#*=}" TARGET_NAME="${i#*=}"
shift shift
;; ;;
--bm_sdk_root=*) #--bm_sdk_root=*)
BM_SDK_ROOT="${i#*=}" # BM_SDK_ROOT="${i#*=}"
shift # shift
;; # ;;
bm) bm)
build_bm build_bm
shift shift
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册