Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Xiaomi
Mace
提交
a11195a7
Mace
项目概览
Xiaomi
/
Mace
通知
106
Star
40
Fork
27
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Mace
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a11195a7
编写于
10月 19, 2020
作者:
L
luxuhui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
opt: reduce the so size for bazel and fix error in cmake compile
N/A Signed-off-by:
N
Luxuhui
<
luxuhui@xiaomi.com
>
上级
701e86ca
变更
16
显示空白变更内容
内联
并排
Showing
16 changed file
with
107 addition
and
38 deletion
+107
-38
.gitlab-ci.yml
.gitlab-ci.yml
+8
-4
docs/user_guide/advanced_usage_cmake.rst
docs/user_guide/advanced_usage_cmake.rst
+1
-1
docs/user_guide/basic_usage.rst
docs/user_guide/basic_usage.rst
+1
-1
docs/user_guide/basic_usage_cmake.rst
docs/user_guide/basic_usage_cmake.rst
+1
-1
docs/zh/user_guide/basic_usage.rst
docs/zh/user_guide/basic_usage.rst
+1
-1
mace/core/runtime/opencl/cl2_header.h
mace/core/runtime/opencl/cl2_header.h
+1
-1
mace/ops/arm/base/common_neon.h
mace/ops/arm/base/common_neon.h
+12
-12
test/ccunit/mace/ops/depthwise_conv2d_test.cc
test/ccunit/mace/ops/depthwise_conv2d_test.cc
+3
-0
third_party/opencl-clhpp/opencl-clhpp.BUILD
third_party/opencl-clhpp/opencl-clhpp.BUILD
+5
-2
tools/bazel.rc
tools/bazel.rc
+11
-2
tools/bazel_build_standalone_lib.sh
tools/bazel_build_standalone_lib.sh
+8
-2
tools/cmake/cmake-build-aarch64-linux-gnu.sh
tools/cmake/cmake-build-aarch64-linux-gnu.sh
+12
-2
tools/cmake/cmake-build-arm-linux-gnueabihf.sh
tools/cmake/cmake-build-arm-linux-gnueabihf.sh
+14
-4
tools/cmake/cmake-build-arm64-v8a.sh
tools/cmake/cmake-build-arm64-v8a.sh
+12
-2
tools/cmake/cmake-build-armeabi-v7a.sh
tools/cmake/cmake-build-armeabi-v7a.sh
+12
-2
tools/cmake/cmake-build-host.sh
tools/cmake/cmake-build-host.sh
+5
-1
未找到文件。
.gitlab-ci.yml
浏览文件 @
a11195a7
...
@@ -42,16 +42,16 @@ build_docs:
...
@@ -42,16 +42,16 @@ build_docs:
cmake_build_android-armeabi-v7a
:
cmake_build_android-armeabi-v7a
:
stage
:
build
stage
:
build
script
:
script
:
-
RUNTIME=GPU bash tools/cmake/cmake-build-armeabi-v7a.sh
-
RUNTIME=GPU
QUANTIZE=OFF
bash tools/cmake/cmake-build-armeabi-v7a.sh
-
LIBMACE32_FULL_SIZE=`stat -c%s build/cmake-build/armeabi-v7a/install/lib/libmace.so`
-
LIBMACE32_FULL_SIZE=`stat -c%s build/cmake-build/armeabi-v7a/install/lib/libmace.so`
-
if (( LIBMACE32_FULL_SIZE >
22
00000 )) ; then echo "The libmace.so size too large"; exit 1; fi
-
if (( LIBMACE32_FULL_SIZE >
14
00000 )) ; then echo "The libmace.so size too large"; exit 1; fi
cmake_build_android-arm64-v8
:
cmake_build_android-arm64-v8
:
stage
:
build
stage
:
build
script
:
script
:
-
RUNTIME=GPU bash tools/cmake/cmake-build-arm64-v8a.sh
-
RUNTIME=GPU
QUANTIZE=OFF
bash tools/cmake/cmake-build-arm64-v8a.sh
-
LIBMACE64_FULL_SIZE=`stat -c%s build/cmake-build/arm64-v8a/install/lib/libmace.so`
-
LIBMACE64_FULL_SIZE=`stat -c%s build/cmake-build/arm64-v8a/install/lib/libmace.so`
-
if (( LIBMACE64_FULL_SIZE >
31
00000 )) ; then echo "The libmace.so size too large"; exit 1; fi
-
if (( LIBMACE64_FULL_SIZE >
23
00000 )) ; then echo "The libmace.so size too large"; exit 1; fi
bazel_build
:
bazel_build
:
stage
:
build
stage
:
build
...
@@ -59,10 +59,14 @@ bazel_build:
...
@@ -59,10 +59,14 @@ bazel_build:
-
bash tools/bazel_build_standalone_lib.sh
-
bash tools/bazel_build_standalone_lib.sh
-
bash tools/bazel_build_standalone_lib.sh --abi=armeabi-v7a --runtimes=cpu
-
bash tools/bazel_build_standalone_lib.sh --abi=armeabi-v7a --runtimes=cpu
-
bash tools/bazel_build_standalone_lib.sh --abi=armeabi-v7a --runtimes=cpu,gpu
-
bash tools/bazel_build_standalone_lib.sh --abi=armeabi-v7a --runtimes=cpu,gpu
-
LIBMACE32_FULL_SIZE=`stat -c%s build/lib/armeabi-v7a/libmace.so`
-
if (( LIBMACE32_FULL_SIZE > 1400000 )) ; then echo "The libmace.so size too large"; exit 1; fi
-
bash tools/bazel_build_standalone_lib.sh --abi=armeabi-v7a --runtimes=cpu,gpu,dsp
-
bash tools/bazel_build_standalone_lib.sh --abi=armeabi-v7a --runtimes=cpu,gpu,dsp
-
bash tools/bazel_build_standalone_lib.sh --abi=armeabi-v7a --runtimes=cpu,gpu,apu
-
bash tools/bazel_build_standalone_lib.sh --abi=armeabi-v7a --runtimes=cpu,gpu,apu
-
bash tools/bazel_build_standalone_lib.sh --abi=arm64-v8a --runtimes=cpu
-
bash tools/bazel_build_standalone_lib.sh --abi=arm64-v8a --runtimes=cpu
-
bash tools/bazel_build_standalone_lib.sh --abi=arm64-v8a --runtimes=cpu,gpu
-
bash tools/bazel_build_standalone_lib.sh --abi=arm64-v8a --runtimes=cpu,gpu
-
LIBMACE64_FULL_SIZE=`stat -c%s build/lib/arm64-v8a/libmace.so`
- if (( LIBMACE64_FULL_SIZE > 2300000 )) ; then echo "The libmace.so size too large"; exit 1; fi
-
bash tools/bazel_build_standalone_lib.sh --abi=arm64-v8a --runtimes=cpu,gpu,dsp
-
bash tools/bazel_build_standalone_lib.sh --abi=arm64-v8a --runtimes=cpu,gpu,dsp
-
bash tools/bazel_build_standalone_lib.sh --abi=arm64-v8a --runtimes=cpu,gpu,apu
-
bash tools/bazel_build_standalone_lib.sh --abi=arm64-v8a --runtimes=cpu,gpu,apu
-
bash tools/bazel_build_standalone_lib.sh --abi=arm_linux_gnueabihf --runtimes=cpu
-
bash tools/bazel_build_standalone_lib.sh --abi=arm_linux_gnueabihf --runtimes=cpu
...
...
docs/user_guide/advanced_usage_cmake.rst
浏览文件 @
a11195a7
...
@@ -175,7 +175,7 @@ After that you can rebuild the engine.
...
@@ -175,7 +175,7 @@ After that you can rebuild the engine.
..
code
-
block
::
bash
..
code
-
block
::
bash
RUNTIME
=
GPU
RUNMODE
=
code
bash
tools
/
cmake
/
cmake
-
build
-
armeabi
-
v7a
.
sh
RUNTIME
=
GPU
RUNMODE
=
code
QUANTIZE
=
OFF
bash
tools
/
cmake
/
cmake
-
build
-
armeabi
-
v7a
.
sh
``
RUNMODE
=
code
``
means
you
compile
and
link
model
library
with
MACE
engine
.
``
RUNMODE
=
code
``
means
you
compile
and
link
model
library
with
MACE
engine
.
...
...
docs/user_guide/basic_usage.rst
浏览文件 @
a11195a7
...
@@ -45,7 +45,7 @@ Here we use the mobilenet-v2 model as an example.
...
@@ -45,7 +45,7 @@ Here we use the mobilenet-v2 model as an example.
cd path/to/mace
cd path/to/mace
# Build library
# Build library
# output lib path: build/lib
# output lib path: build/lib
bash tools/bazel_build_standalone_lib.sh [-abi=abi][-runtimes=rt1,rt2,...][-static]
bash tools/bazel_build_standalone_lib.sh [-abi=abi][-runtimes=rt1,rt2,...][-
quantize][-
static]
.. note::
.. note::
...
...
docs/user_guide/basic_usage_cmake.rst
浏览文件 @
a11195a7
...
@@ -20,7 +20,7 @@ Please make sure you have CMake installed.
...
@@ -20,7 +20,7 @@ Please make sure you have CMake installed.
.. code-block:: sh
.. code-block:: sh
RUNTIME=GPU bash tools/cmake/cmake-build-armeabi-v7a.sh
RUNTIME=GPU
QUANTIZE=OFF
bash tools/cmake/cmake-build-armeabi-v7a.sh
which generate libraries in ``build/cmake-build/armeabi-v7a``, you can use either static libraries or the ``libmace.so`` shared library.
which generate libraries in ``build/cmake-build/armeabi-v7a``, you can use either static libraries or the ``libmace.so`` shared library.
...
...
docs/zh/user_guide/basic_usage.rst
浏览文件 @
a11195a7
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
.. code-block:: sh
.. code-block:: sh
RUNTIME=GPU bash tools/cmake/cmake-build-armeabi-v7a.sh
RUNTIME=GPU
QUANTIZE=OFF
bash tools/cmake/cmake-build-armeabi-v7a.sh
编译安装位置为 ``build/cmake-build/armeabi-v7a``, 可以使用 libmace 静态库或者动态库。
编译安装位置为 ``build/cmake-build/armeabi-v7a``, 可以使用 libmace 静态库或者动态库。
...
...
mace/core/runtime/opencl/cl2_header.h
浏览文件 @
a11195a7
...
@@ -37,7 +37,7 @@
...
@@ -37,7 +37,7 @@
#pragma GCC diagnostic ignored "-Wignored-attributes"
#pragma GCC diagnostic ignored "-Wignored-attributes"
#endif // MACE_OS_MAC
#endif // MACE_OS_MAC
#include
"CL/cl2.hpp"
#include
<CL/cl2.hpp>
#ifdef MACE_OS_MAC
#ifdef MACE_OS_MAC
#pragma GCC diagnostic pop
#pragma GCC diagnostic pop
...
...
mace/ops/arm/base/common_neon.h
浏览文件 @
a11195a7
...
@@ -144,7 +144,7 @@ inline void vst3q(float *ptr, float32x4x3_t v) {
...
@@ -144,7 +144,7 @@ inline void vst3q(float *ptr, float32x4x3_t v) {
}
}
inline
float32x8_t
vld1o
(
float
*
ptr
)
{
inline
float32x8_t
vld1o
(
float
*
ptr
)
{
return
{
vld1q_f32
(
ptr
),
vld1q_f32
(
ptr
+
4
)
};
return
{
{
vld1q_f32
(
ptr
),
vld1q_f32
(
ptr
+
4
)}
};
}
}
inline
void
vst1o
(
float
*
ptr
,
float32x8_t
v
)
{
inline
void
vst1o
(
float
*
ptr
,
float32x8_t
v
)
{
...
@@ -209,8 +209,8 @@ inline float32x4_t vld1q(const BFloat16 *ptr) {
...
@@ -209,8 +209,8 @@ inline float32x4_t vld1q(const BFloat16 *ptr) {
// load of 2 4D vectors and perform de-interleaving
// load of 2 4D vectors and perform de-interleaving
inline
float32x4x2_t
vld2q_bf16
(
const
uint16_t
*
ptr
)
{
inline
float32x4x2_t
vld2q_bf16
(
const
uint16_t
*
ptr
)
{
uint16x4x2_t
u
=
vld2_u16
(
ptr
);
uint16x4x2_t
u
=
vld2_u16
(
ptr
);
return
{
vreinterpretq_f32_u32
(
vshll_n_u16
(
u
.
val
[
0
],
16
)),
return
{
{
vreinterpretq_f32_u32
(
vshll_n_u16
(
u
.
val
[
0
],
16
)),
vreinterpretq_f32_u32
(
vshll_n_u16
(
u
.
val
[
1
],
16
))
};
vreinterpretq_f32_u32
(
vshll_n_u16
(
u
.
val
[
1
],
16
))}
};
}
}
inline
float32x4x2_t
vld2q_bf16
(
const
BFloat16
*
ptr
)
{
inline
float32x4x2_t
vld2q_bf16
(
const
BFloat16
*
ptr
)
{
...
@@ -228,9 +228,9 @@ inline float32x4x2_t vld2q(const BFloat16 *ptr) {
...
@@ -228,9 +228,9 @@ inline float32x4x2_t vld2q(const BFloat16 *ptr) {
// load of 3 4D vectors and perform de-interleaving
// load of 3 4D vectors and perform de-interleaving
inline
float32x4x3_t
vld3q_bf16
(
const
uint16_t
*
ptr
)
{
inline
float32x4x3_t
vld3q_bf16
(
const
uint16_t
*
ptr
)
{
uint16x4x3_t
u
=
vld3_u16
(
ptr
);
uint16x4x3_t
u
=
vld3_u16
(
ptr
);
return
{
vreinterpretq_f32_u32
(
vshll_n_u16
(
u
.
val
[
0
],
16
)),
return
{
{
vreinterpretq_f32_u32
(
vshll_n_u16
(
u
.
val
[
0
],
16
)),
vreinterpretq_f32_u32
(
vshll_n_u16
(
u
.
val
[
1
],
16
)),
vreinterpretq_f32_u32
(
vshll_n_u16
(
u
.
val
[
1
],
16
)),
vreinterpretq_f32_u32
(
vshll_n_u16
(
u
.
val
[
2
],
16
))
};
vreinterpretq_f32_u32
(
vshll_n_u16
(
u
.
val
[
2
],
16
))}
};
}
}
inline
float32x4x3_t
vld3q_bf16
(
const
BFloat16
*
ptr
)
{
inline
float32x4x3_t
vld3q_bf16
(
const
BFloat16
*
ptr
)
{
...
@@ -264,8 +264,8 @@ inline void vst1q(BFloat16 *ptr, const float32x4_t v) {
...
@@ -264,8 +264,8 @@ inline void vst1q(BFloat16 *ptr, const float32x4_t v) {
// store of 2 4D vectors and perform interleaving
// store of 2 4D vectors and perform interleaving
inline
void
vst2q_bf16
(
uint16_t
*
ptr
,
const
float32x4x2_t
v
)
{
inline
void
vst2q_bf16
(
uint16_t
*
ptr
,
const
float32x4x2_t
v
)
{
uint16x4x2_t
u
=
{
vshrn_n_u32
(
vreinterpretq_u32_f32
(
v
.
val
[
0
]),
16
),
uint16x4x2_t
u
=
{
{
vshrn_n_u32
(
vreinterpretq_u32_f32
(
v
.
val
[
0
]),
16
),
vshrn_n_u32
(
vreinterpretq_u32_f32
(
v
.
val
[
1
]),
16
)
};
vshrn_n_u32
(
vreinterpretq_u32_f32
(
v
.
val
[
1
]),
16
)}
};
vst2_u16
(
ptr
,
u
);
vst2_u16
(
ptr
,
u
);
}
}
...
@@ -283,9 +283,9 @@ inline void vst2q(BFloat16 *ptr, const float32x4x2_t v) {
...
@@ -283,9 +283,9 @@ inline void vst2q(BFloat16 *ptr, const float32x4x2_t v) {
// store of 3 4D vectors and perform interleaving
// store of 3 4D vectors and perform interleaving
inline
void
vst3q_bf16
(
uint16_t
*
ptr
,
const
float32x4x3_t
v
)
{
inline
void
vst3q_bf16
(
uint16_t
*
ptr
,
const
float32x4x3_t
v
)
{
uint16x4x3_t
u
=
{
vshrn_n_u32
(
vreinterpretq_u32_f32
(
v
.
val
[
0
]),
16
),
uint16x4x3_t
u
=
{
{
vshrn_n_u32
(
vreinterpretq_u32_f32
(
v
.
val
[
0
]),
16
),
vshrn_n_u32
(
vreinterpretq_u32_f32
(
v
.
val
[
0
]),
16
),
vshrn_n_u32
(
vreinterpretq_u32_f32
(
v
.
val
[
0
]),
16
),
vshrn_n_u32
(
vreinterpretq_u32_f32
(
v
.
val
[
0
]),
16
)};
vshrn_n_u32
(
vreinterpretq_u32_f32
(
v
.
val
[
0
]),
16
)}
}
;
vst3_u16
(
ptr
,
u
);
vst3_u16
(
ptr
,
u
);
}
}
...
@@ -304,8 +304,8 @@ inline void vst3q(BFloat16 *ptr, const float32x4x3_t v) {
...
@@ -304,8 +304,8 @@ inline void vst3q(BFloat16 *ptr, const float32x4x3_t v) {
// load of 8D vector
// load of 8D vector
inline
float32x8_t
vld1o_bf16
(
const
uint16_t
*
ptr
)
{
inline
float32x8_t
vld1o_bf16
(
const
uint16_t
*
ptr
)
{
uint16x8_t
u
=
vld1q_u16
(
ptr
);
uint16x8_t
u
=
vld1q_u16
(
ptr
);
return
{
vreinterpretq_f32_u32
(
vshll_n_u16
(
vget_low_u16
(
u
),
16
)),
return
{
{
vreinterpretq_f32_u32
(
vshll_n_u16
(
vget_low_u16
(
u
),
16
)),
vreinterpretq_f32_u32
(
vshll_n_u16
(
vget_high_u16
(
u
),
16
))
};
vreinterpretq_f32_u32
(
vshll_n_u16
(
vget_high_u16
(
u
),
16
))}
};
}
}
inline
float32x8_t
vld1o_bf16
(
const
BFloat16
*
ptr
)
{
inline
float32x8_t
vld1o_bf16
(
const
BFloat16
*
ptr
)
{
...
...
test/ccunit/mace/ops/depthwise_conv2d_test.cc
浏览文件 @
a11195a7
...
@@ -492,6 +492,7 @@ TEST_F(DepthwiseConv2dOpTest, Quant) {
...
@@ -492,6 +492,7 @@ TEST_F(DepthwiseConv2dOpTest, Quant) {
TestQuant
(
3
,
1
,
128
,
56
,
56
,
3
,
3
,
SAME
,
{
2
,
2
});
TestQuant
(
3
,
1
,
128
,
56
,
56
,
3
,
3
,
SAME
,
{
2
,
2
});
}
}
#ifdef MACE_ENABLE_BFLOAT16
namespace
{
namespace
{
void
TestBFloat16
(
const
index_t
batch
,
void
TestBFloat16
(
const
index_t
batch
,
const
index_t
multiplier
,
const
index_t
multiplier
,
...
@@ -557,6 +558,8 @@ TEST_F(DepthwiseConv2dOpTest, BFloat16) {
...
@@ -557,6 +558,8 @@ TEST_F(DepthwiseConv2dOpTest, BFloat16) {
TestBFloat16
(
3
,
1
,
128
,
56
,
56
,
3
,
3
,
SAME
,
{
2
,
2
});
TestBFloat16
(
3
,
1
,
128
,
56
,
56
,
3
,
3
,
SAME
,
{
2
,
2
});
}
}
#endif // MACE_ENABLE_BFLOAT16
}
// namespace test
}
// namespace test
}
// namespace ops
}
// namespace ops
}
// namespace mace
}
// namespace mace
third_party/opencl-clhpp/opencl-clhpp.BUILD
浏览文件 @
a11195a7
...
@@ -12,9 +12,12 @@ genrule(
...
@@ -12,9 +12,12 @@ genrule(
cmd = "workdir=$$(mktemp -d -t opencl-clhpp-build.XXXXXXXXXX); cp -aL $$(dirname $(location CMakeLists.txt))/* $$workdir; pushd $$workdir; mkdir build; pushd build; cmake ../ -DBUILD_DOCS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_TESTS=OFF; make generate_clhpp generate_cl2hpp; popd; popd; cp -a $$workdir/build/* $(@D); rm -rf $$workdir; echo installing to $(@D)",
cmd = "workdir=$$(mktemp -d -t opencl-clhpp-build.XXXXXXXXXX); cp -aL $$(dirname $(location CMakeLists.txt))/* $$workdir; pushd $$workdir; mkdir build; pushd build; cmake ../ -DBUILD_DOCS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_TESTS=OFF; make generate_clhpp generate_cl2hpp; popd; popd; cp -a $$workdir/build/* $(@D); rm -rf $$workdir; echo installing to $(@D)",
)
)
# The `srcs` is not used in c++ Code, but we need it to trigger the `genrule`,
# So we add the "include/CL/cl.hpp", "include/CL/cl2.hpp" into `srcs`, these
# two files is imported by the `includes` instead of `srcs`.
cc_library(
cc_library(
name = "opencl_clhpp",
name = "opencl_clhpp",
hdrs = ["include/CL/cl.hpp", "include/CL/cl2.hpp
"],
includes = ["include
"],
s
trip_include_prefix = "include"
,
s
rcs = ["include/CL/cl.hpp", "include/CL/cl2.hpp"]
,
visibility = ["//visibility:public"],
visibility = ["//visibility:public"],
)
)
tools/bazel.rc
浏览文件 @
a11195a7
...
@@ -10,6 +10,7 @@ build --copt=-D_GLIBCXX_USE_C99_MATH_TR1
...
@@ -10,6 +10,7 @@ build --copt=-D_GLIBCXX_USE_C99_MATH_TR1
build --copt=-DMACE_OBFUSCATE_LITERALS
build --copt=-DMACE_OBFUSCATE_LITERALS
build --copt=-DGEMMLOWP_USE_MACE_THREAD_POOL
build --copt=-DGEMMLOWP_USE_MACE_THREAD_POOL
build --copt=-DMACE_DEPTHWISE_U8_USE_MULTI_THREAD
build --copt=-DMACE_DEPTHWISE_U8_USE_MULTI_THREAD
build --copt=-O2
# Usage example: bazel build --config android
# Usage example: bazel build --config android
build:android --define linux_base=true
build:android --define linux_base=true
...
@@ -20,6 +21,7 @@ build:android --linkopt=-lm
...
@@ -20,6 +21,7 @@ build:android --linkopt=-lm
build:android --distinct_host_configuration=true
build:android --distinct_host_configuration=true
build:android --crosstool_top=//external:android/crosstool
build:android --crosstool_top=//external:android/crosstool
build:android --host_crosstool_top=@bazel_tools//tools/cpp:toolchain
build:android --host_crosstool_top=@bazel_tools//tools/cpp:toolchain
build:android --copt=-Oz
build:android --copt -Wall
build:android --copt -Wall
build:android --copt -Wno-mismatched-tags
build:android --copt -Wno-mismatched-tags
build:android --copt -Wno-missing-braces
build:android --copt -Wno-missing-braces
...
@@ -75,20 +77,27 @@ build:aarch64_linux_gnu --copt -Wno-implicit-fallthrough
...
@@ -75,20 +77,27 @@ build:aarch64_linux_gnu --copt -Wno-implicit-fallthrough
# Usage example: bazel build --config optimization
# Usage example: bazel build --config optimization
build:optimization -c opt
build:optimization -c opt
build:optimization --copt=-O3
build:optimization --linkopt=-Wl,--strip-all
build:optimization --linkopt=-Wl,--strip-all
build:optimization --copt=-ffunction-sections
build:optimization --copt=-ffunction-sections
build:optimization --copt=-fdata-sections
build:optimization --copt=-fdata-sections
build:optimization --linkopt=-Wl,--gc-sections
build:optimization --linkopt=-Wl,--gc-sections
build:optimization --copt=-fno-rtti
build:optimization --copt=-fno-exceptions
build:optimization --copt=-DGOOGLE_PROTOBUF_NO_RTTI
build:optimization --copt=-DPROTOBUF_USE_EXCEPTIONS=0
# Usage example: bazel build --config optimization_darwin
# Usage example: bazel build --config optimization_darwin
build:optimization_darwin --copt=-O3
build:optimization_darwin --copt=-ffunction-sections
build:optimization_darwin --copt=-ffunction-sections
build:optimization_darwin --copt=-fdata-sections
build:optimization_darwin --copt=-fdata-sections
build:optimization_darwin --linkopt=-Wl,-dead_strip
build:optimization_darwin --linkopt=-Wl,-dead_strip
build:optimization_darwin --copt=-fno-rtti
build:optimization_darwin --copt=-fno-exceptions
build:optimization_darwin --copt=-DGOOGLE_PROTOBUF_NO_RTTI
build:optimization_darwin --copt=-DPROTOBUF_USE_EXCEPTIONS=0
# Usage example: bazel build --config symbol_hidden
# Usage example: bazel build --config symbol_hidden
build:symbol_hidden --copt=-fvisibility=hidden
build:symbol_hidden --copt=-fvisibility=hidden
build:symbol_hidden --copt=-fvisibility-inlines-hidden
# Usage example: bazel build --config debug
# Usage example: bazel build --config debug
build:debug -c dbg
build:debug -c dbg
...
...
tools/bazel_build_standalone_lib.sh
浏览文件 @
a11195a7
...
@@ -40,8 +40,8 @@ enable_cpu=true
...
@@ -40,8 +40,8 @@ enable_cpu=true
enable_gpu
=
false
enable_gpu
=
false
enable_dsp
=
false
enable_dsp
=
false
enable_apu
=
false
enable_apu
=
false
enable_quantize
=
tru
e
enable_quantize
=
fals
e
enable_bfloat16
=
tru
e
enable_bfloat16
=
fals
e
enable_rpcmem
=
true
enable_rpcmem
=
true
static_lib
=
false
static_lib
=
false
symbol_hidden
=
symbol_hidden
=
...
@@ -97,6 +97,12 @@ for opt in "${@}";do
...
@@ -97,6 +97,12 @@ for opt in "${@}";do
static|-static|--static
)
static|-static|--static
)
static_lib
=
true
static_lib
=
true
;;
;;
quantize|-quantize|--quantize
)
enable_quantize
=
true
;;
bfloat16|-bfloat16|--bfloat16
)
enable_bfloat16
=
true
;;
help
|
-help
|
--help
)
help
|
-help
|
--help
)
helper
helper
;;
;;
...
...
tools/cmake/cmake-build-aarch64-linux-gnu.sh
浏览文件 @
a11195a7
...
@@ -17,14 +17,24 @@ if [[ "$RUNMODE" == "code" ]]; then
...
@@ -17,14 +17,24 @@ if [[ "$RUNMODE" == "code" ]]; then
MACE_ENABLE_CODE_MODE
=
ON
MACE_ENABLE_CODE_MODE
=
ON
fi
fi
MACE_ENABLE_QUANTIZE
=
OFF
if
[[
"
$QUANTIZE
"
==
"ON"
]]
;
then
MACE_ENABLE_QUANTIZE
=
ON
fi
DMACE_ENABLE_BFLOAT16
=
OFF
if
[[
"
$BFLOAT16
"
==
"ON"
]]
;
then
DMACE_ENABLE_BFLOAT16
=
ON
fi
mkdir
-p
${
BUILD_DIR
}
&&
cd
${
BUILD_DIR
}
mkdir
-p
${
BUILD_DIR
}
&&
cd
${
BUILD_DIR
}
cmake
-DCROSSTOOL_ROOT
=
${
LINARO_AARCH64_LINUX_GNU
}
\
cmake
-DCROSSTOOL_ROOT
=
${
LINARO_AARCH64_LINUX_GNU
}
\
-DCMAKE_TOOLCHAIN_FILE
=
./cmake/toolchains/aarch64-linux-gnu.cmake
\
-DCMAKE_TOOLCHAIN_FILE
=
./cmake/toolchains/aarch64-linux-gnu.cmake
\
-DCMAKE_BUILD_TYPE
=
Release
\
-DCMAKE_BUILD_TYPE
=
Release
\
-DMACE_ENABLE_NEON
=
ON
\
-DMACE_ENABLE_NEON
=
ON
\
-DMACE_ENABLE_QUANTIZE
=
ON
\
-DMACE_ENABLE_QUANTIZE
=
${
MACE_ENABLE_QUANTIZE
}
\
-DMACE_ENABLE_OPENCL
=
${
MACE_ENABLE_OPENCL
}
\
-DMACE_ENABLE_OPENCL
=
${
MACE_ENABLE_OPENCL
}
\
-DMACE_ENABLE_BFLOAT16
=
ON
\
-DMACE_ENABLE_BFLOAT16
=
${
DMACE_ENABLE_BFLOAT16
}
\
-DMACE_ENABLE_OPT_SIZE
=
ON
\
-DMACE_ENABLE_OPT_SIZE
=
ON
\
-DMACE_ENABLE_OBFUSCATE
=
ON
\
-DMACE_ENABLE_OBFUSCATE
=
ON
\
-DMACE_ENABLE_TESTS
=
ON
\
-DMACE_ENABLE_TESTS
=
ON
\
...
...
tools/cmake/cmake-build-arm-linux-gnueabihf.sh
浏览文件 @
a11195a7
...
@@ -17,14 +17,24 @@ if [[ "$RUNTIME" == "GPU" ]]; then
...
@@ -17,14 +17,24 @@ if [[ "$RUNTIME" == "GPU" ]]; then
MACE_ENABLE_OPENCL
=
ON
MACE_ENABLE_OPENCL
=
ON
fi
fi
MACE_ENABLE_QUANTIZE
=
OFF
if
[[
"
$QUANTIZE
"
==
"ON"
]]
;
then
MACE_ENABLE_QUANTIZE
=
ON
fi
DMACE_ENABLE_BFLOAT16
=
OFF
if
[[
"
$BFLOAT16
"
==
"ON"
]]
;
then
DMACE_ENABLE_BFLOAT16
=
ON
fi
mkdir
-p
${
BUILD_DIR
}
&&
cd
${
BUILD_DIR
}
mkdir
-p
${
BUILD_DIR
}
&&
cd
${
BUILD_DIR
}
cmake
-DCROSSTOOL_ROOT
=
${
LINARO_ARM_LINUX_GNUEABIHF
}
\
cmake
-DCROSSTOOL_ROOT
=
${
LINARO_ARM_LINUX_GNUEABIHF
}
\
-DCMAKE_TOOLCHAIN_FILE
=
./cmake/toolchains/arm-linux-gnueabihf.cmake
\
-DCMAKE_TOOLCHAIN_FILE
=
./cmake/toolchains/arm-linux-gnueabihf.cmake
\
-DCMAKE_BUILD_TYPE
=
Release
\
-DCMAKE_BUILD_TYPE
=
Release
\
-DMACE_ENABLE_NEON
=
ON
\
-DMACE_ENABLE_NEON
=
ON
\
-DMACE_ENABLE_QUANTIZE
=
ON
\
-DMACE_ENABLE_QUANTIZE
=
${
MACE_ENABLE_QUANTIZE
}
\
-DMACE_ENABLE_OPENCL
=
${
MACE_ENABLE_OPENCL
}
\
-DMACE_ENABLE_OPENCL
=
${
MACE_ENABLE_OPENCL
}
\
-DMACE_ENABLE_BFLOAT16
=
ON
\
-DMACE_ENABLE_BFLOAT16
=
${
DMACE_ENABLE_BFLOAT16
}
\
-DMACE_ENABLE_OPT_SIZE
=
ON
\
-DMACE_ENABLE_OPT_SIZE
=
ON
\
-DMACE_ENABLE_OBFUSCATE
=
ON
\
-DMACE_ENABLE_OBFUSCATE
=
ON
\
-DMACE_ENABLE_TESTS
=
ON
\
-DMACE_ENABLE_TESTS
=
ON
\
...
...
tools/cmake/cmake-build-arm64-v8a.sh
浏览文件 @
a11195a7
...
@@ -26,6 +26,16 @@ if [[ "$RUNMODE" == "code" ]]; then
...
@@ -26,6 +26,16 @@ if [[ "$RUNMODE" == "code" ]]; then
MACE_ENABLE_CODE_MODE
=
ON
MACE_ENABLE_CODE_MODE
=
ON
fi
fi
MACE_ENABLE_QUANTIZE
=
OFF
if
[[
"
$QUANTIZE
"
==
"ON"
]]
;
then
MACE_ENABLE_QUANTIZE
=
ON
fi
DMACE_ENABLE_BFLOAT16
=
OFF
if
[[
"
$BFLOAT16
"
==
"ON"
]]
;
then
DMACE_ENABLE_BFLOAT16
=
ON
fi
mkdir
-p
${
BUILD_DIR
}
&&
cd
${
BUILD_DIR
}
mkdir
-p
${
BUILD_DIR
}
&&
cd
${
BUILD_DIR
}
cmake
-DANDROID_ABI
=
"arm64-v8a"
\
cmake
-DANDROID_ABI
=
"arm64-v8a"
\
-DCMAKE_TOOLCHAIN_FILE
=
${
ANDROID_NDK_HOME
}
/build/cmake/android.toolchain.cmake
\
-DCMAKE_TOOLCHAIN_FILE
=
${
ANDROID_NDK_HOME
}
/build/cmake/android.toolchain.cmake
\
...
@@ -33,12 +43,12 @@ cmake -DANDROID_ABI="arm64-v8a" \
...
@@ -33,12 +43,12 @@ cmake -DANDROID_ABI="arm64-v8a" \
-DCMAKE_BUILD_TYPE
=
Release
\
-DCMAKE_BUILD_TYPE
=
Release
\
-DANDROID_STL
=
c++_shared
\
-DANDROID_STL
=
c++_shared
\
-DMACE_ENABLE_NEON
=
ON
\
-DMACE_ENABLE_NEON
=
ON
\
-DMACE_ENABLE_QUANTIZE
=
ON
\
-DMACE_ENABLE_QUANTIZE
=
${
MACE_ENABLE_QUANTIZE
}
\
-DMACE_ENABLE_OPENCL
=
${
MACE_ENABLE_OPENCL
}
\
-DMACE_ENABLE_OPENCL
=
${
MACE_ENABLE_OPENCL
}
\
-DMACE_ENABLE_HEXAGON_DSP
=
${
MACE_ENABLE_HEXAGON_DSP
}
\
-DMACE_ENABLE_HEXAGON_DSP
=
${
MACE_ENABLE_HEXAGON_DSP
}
\
-DMACE_ENABLE_HEXAGON_HTA
=
${
MACE_ENABLE_HEXAGON_HTA
}
\
-DMACE_ENABLE_HEXAGON_HTA
=
${
MACE_ENABLE_HEXAGON_HTA
}
\
-DMACE_ENABLE_MTK_APU
=
${
MACE_ENABLE_MTK_APU
}
\
-DMACE_ENABLE_MTK_APU
=
${
MACE_ENABLE_MTK_APU
}
\
-DMACE_ENABLE_BFLOAT16
=
ON
\
-DMACE_ENABLE_BFLOAT16
=
${
DMACE_ENABLE_BFLOAT16
}
\
-DMACE_ENABLE_OPT_SIZE
=
ON
\
-DMACE_ENABLE_OPT_SIZE
=
ON
\
-DMACE_ENABLE_OBFUSCATE
=
ON
\
-DMACE_ENABLE_OBFUSCATE
=
ON
\
-DMACE_ENABLE_TESTS
=
ON
\
-DMACE_ENABLE_TESTS
=
ON
\
...
...
tools/cmake/cmake-build-armeabi-v7a.sh
浏览文件 @
a11195a7
...
@@ -27,6 +27,16 @@ if [[ "$RUNMODE" == "code" ]]; then
...
@@ -27,6 +27,16 @@ if [[ "$RUNMODE" == "code" ]]; then
MACE_ENABLE_CODE_MODE
=
ON
MACE_ENABLE_CODE_MODE
=
ON
fi
fi
MACE_ENABLE_QUANTIZE
=
OFF
if
[[
"
$QUANTIZE
"
==
"ON"
]]
;
then
MACE_ENABLE_QUANTIZE
=
ON
fi
DMACE_ENABLE_BFLOAT16
=
OFF
if
[[
"
$BFLOAT16
"
==
"ON"
]]
;
then
DMACE_ENABLE_BFLOAT16
=
ON
fi
mkdir
-p
${
BUILD_DIR
}
&&
cd
${
BUILD_DIR
}
mkdir
-p
${
BUILD_DIR
}
&&
cd
${
BUILD_DIR
}
cmake
-DANDROID_ABI
=
"armeabi-v7a"
\
cmake
-DANDROID_ABI
=
"armeabi-v7a"
\
-DANDROID_ARM_NEON
=
ON
\
-DANDROID_ARM_NEON
=
ON
\
...
@@ -35,12 +45,12 @@ cmake -DANDROID_ABI="armeabi-v7a" \
...
@@ -35,12 +45,12 @@ cmake -DANDROID_ABI="armeabi-v7a" \
-DCMAKE_BUILD_TYPE
=
Release
\
-DCMAKE_BUILD_TYPE
=
Release
\
-DANDROID_STL
=
c++_shared
\
-DANDROID_STL
=
c++_shared
\
-DMACE_ENABLE_NEON
=
ON
\
-DMACE_ENABLE_NEON
=
ON
\
-DMACE_ENABLE_QUANTIZE
=
ON
\
-DMACE_ENABLE_QUANTIZE
=
${
MACE_ENABLE_QUANTIZE
}
\
-DMACE_ENABLE_OPENCL
=
${
MACE_ENABLE_OPENCL
}
\
-DMACE_ENABLE_OPENCL
=
${
MACE_ENABLE_OPENCL
}
\
-DMACE_ENABLE_HEXAGON_DSP
=
${
MACE_ENABLE_HEXAGON_DSP
}
\
-DMACE_ENABLE_HEXAGON_DSP
=
${
MACE_ENABLE_HEXAGON_DSP
}
\
-DMACE_ENABLE_HEXAGON_HTA
=
${
MACE_ENABLE_HEXAGON_HTA
}
\
-DMACE_ENABLE_HEXAGON_HTA
=
${
MACE_ENABLE_HEXAGON_HTA
}
\
-DMACE_ENABLE_MTK_APU
=
${
MACE_ENABLE_MTK_APU
}
\
-DMACE_ENABLE_MTK_APU
=
${
MACE_ENABLE_MTK_APU
}
\
-DMACE_ENABLE_BFLOAT16
=
ON
\
-DMACE_ENABLE_BFLOAT16
=
${
DMACE_ENABLE_BFLOAT16
}
\
-DMACE_ENABLE_OPT_SIZE
=
ON
\
-DMACE_ENABLE_OPT_SIZE
=
ON
\
-DMACE_ENABLE_OBFUSCATE
=
ON
\
-DMACE_ENABLE_OBFUSCATE
=
ON
\
-DMACE_ENABLE_TESTS
=
ON
\
-DMACE_ENABLE_TESTS
=
ON
\
...
...
tools/cmake/cmake-build-host.sh
浏览文件 @
a11195a7
...
@@ -13,12 +13,16 @@ if [[ "$RUNMODE" == "code" ]]; then
...
@@ -13,12 +13,16 @@ if [[ "$RUNMODE" == "code" ]]; then
MACE_ENABLE_CODE_MODE
=
ON
MACE_ENABLE_CODE_MODE
=
ON
fi
fi
DMACE_ENABLE_BFLOAT16
=
OFF
if
[[
"
$BFLOAT16
"
==
"ON"
]]
;
then
DMACE_ENABLE_BFLOAT16
=
ON
fi
mkdir
-p
${
BUILD_DIR
}
&&
cd
${
BUILD_DIR
}
mkdir
-p
${
BUILD_DIR
}
&&
cd
${
BUILD_DIR
}
cmake
-DMACE_ENABLE_NEON
=
OFF
\
cmake
-DMACE_ENABLE_NEON
=
OFF
\
-DMACE_ENABLE_QUANTIZE
=
OFF
\
-DMACE_ENABLE_QUANTIZE
=
OFF
\
-DMACE_ENABLE_OPENCL
=
OFF
\
-DMACE_ENABLE_OPENCL
=
OFF
\
-DMACE_ENABLE_BFLOAT16
=
ON
\
-DMACE_ENABLE_BFLOAT16
=
${
DMACE_ENABLE_BFLOAT16
}
\
-DMACE_ENABLE_TESTS
=
ON
\
-DMACE_ENABLE_TESTS
=
ON
\
-DMACE_ENABLE_BENCHMARKS
=
ON
\
-DMACE_ENABLE_BENCHMARKS
=
ON
\
-DMACE_ENABLE_CODE_MODE
=
${
MACE_ENABLE_CODE_MODE
}
\
-DMACE_ENABLE_CODE_MODE
=
${
MACE_ENABLE_CODE_MODE
}
\
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录