Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
9005c5a2
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
9005c5a2
编写于
10月 12, 2020
作者:
W
Wilber
提交者:
GitHub
10月 12, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Lite subgraph support arm cpu. (#27827)
上级
2bcb7c0a
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
75 addition
and
26 deletion
+75
-26
cmake/external/lite.cmake
cmake/external/lite.cmake
+68
-24
cmake/inference_lib.cmake
cmake/inference_lib.cmake
+1
-1
paddle/fluid/inference/analysis/ir_passes/lite_subgraph_pass.cc
.../fluid/inference/analysis/ir_passes/lite_subgraph_pass.cc
+4
-0
paddle/fluid/inference/lite/tensor_utils.cc
paddle/fluid/inference/lite/tensor_utils.cc
+1
-0
paddle/fluid/pybind/inference_api.cc
paddle/fluid/pybind/inference_api.cc
+1
-1
未找到文件。
cmake/external/lite.cmake
浏览文件 @
9005c5a2
...
...
@@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
if
(
NOT LINUX
OR NOT WITH_MKL
)
message
(
"Paddle-lite will not build because the required Linux
and MKL
do not exist."
)
if
(
NOT LINUX
)
message
(
"Paddle-lite will not build because the required Linux do not exist."
)
set
(
WITH_LITE OFF
)
return
()
endif
()
...
...
@@ -42,30 +42,30 @@ if (NOT LITE_SOURCE_DIR OR NOT LITE_BINARY_DIR)
endif
()
# No quotes, so cmake can resolve it as a command with arguments.
set
(
LITE_BUILD_COMMAND $
(
MAKE
)
publish_inference -j
)
set
(
LITE_OPTIONAL_ARGS -DWITH_MKL=ON
-DLITE_WITH_CUDA=
${
WITH_GPU
}
-DWITH_MKLDNN=OFF
-DLITE_WITH_X86=ON
-DLITE_WITH_PROFILE=OFF
-DWITH_LITE=OFF
-DLITE_WITH_LIGHT_WEIGHT_FRAMEWORK=OFF
-DWITH_PYTHON=OFF
-DWITH_TESTING=OFF
-DLITE_BUILD_EXTRA=ON
-DCUDNN_ROOT=
${
CUDNN_ROOT
}
-DLITE_WITH_STATIC_CUDA=OFF
-DCUDA_ARCH_NAME=
${
CUDA_ARCH_NAME
}
-DLITE_WITH_XPU=
${
LITE_WITH_XPU
}
-DXPU_SDK_ROOT=
${
XPU_SDK_ROOT
}
-DLITE_WITH_ARM=OFF
)
ExternalProject_Add
(
if
(
WITH_ARM
)
set
(
LITE_BUILD_COMMAND $
(
MAKE
)
publish_inference -j
)
message
(
WARNING
"BUILD_COMMAND:
${
LITE_BUILD_COMMAND
}
"
)
set
(
LITE_OPTIONAL_ARGS -DWITH_MKL=OFF
-DLITE_WITH_CUDA=OFF
-DWITH_MKLDNN=OFF
-DLITE_WITH_X86=OFF
-DLITE_WITH_LIGHT_WEIGHT_FRAMEWORK=ON
-DLITE_WITH_PROFILE=OFF
-DARM_TARGET_OS=armlinux
-DWITH_LITE=ON
-DWITH_PYTHON=OFF
-DWITH_TESTING=OFF
-DLITE_BUILD_EXTRA=ON
-DLITE_WITH_XPU=
${
LITE_WITH_XPU
}
-DXPU_SDK_ROOT=
${
XPU_SDK_ROOT
}
-DLITE_WITH_ARM=ON
)
ExternalProject_Add
(
${
LITE_PROJECT
}
${
EXTERNAL_PROJECT_LOG_ARGS
}
GIT_REPOSITORY
"https://github.com/PaddlePaddle/Paddle-Lite.git"
GIT_TAG
${
LITE_GIT_TAG
}
PREFIX
${
LITE_SOURCES_DIR
}
PATCH_COMMAND mkdir -p
${
LITE_SOURCES_DIR
}
/src/extern_lite-build/lite/gen_code && touch
${
LITE_SOURCES_DIR
}
/src/extern_lite-build/lite/gen_code/__generated_code__.cc
UPDATE_COMMAND
""
BUILD_COMMAND
${
LITE_BUILD_COMMAND
}
INSTALL_COMMAND
""
...
...
@@ -81,7 +81,51 @@ if (NOT LITE_SOURCE_DIR OR NOT LITE_BINARY_DIR)
-DCMAKE_BUILD_TYPE=
${
THIRD_PARTY_BUILD_TYPE
}
${
EXTERNAL_OPTIONAL_ARGS
}
${
LITE_OPTIONAL_ARGS
}
)
)
set
(
LITE_OUTPUT_BIN_DIR inference_lite_lib.armlinux.armv8
)
else
()
set
(
LITE_BUILD_COMMAND $
(
MAKE
)
publish_inference -j
)
set
(
LITE_OUTPUT_BIN_DIR inference_lite_lib
)
set
(
LITE_OPTIONAL_ARGS -DWITH_MKL=ON
-DLITE_WITH_CUDA=
${
WITH_GPU
}
-DWITH_MKLDNN=OFF
-DLITE_WITH_X86=ON
-DLITE_WITH_PROFILE=OFF
-DWITH_LITE=OFF
-DLITE_WITH_LIGHT_WEIGHT_FRAMEWORK=OFF
-DWITH_PYTHON=OFF
-DWITH_TESTING=OFF
-DLITE_BUILD_EXTRA=ON
-DCUDNN_ROOT=
${
CUDNN_ROOT
}
-DLITE_WITH_STATIC_CUDA=OFF
-DCUDA_ARCH_NAME=
${
CUDA_ARCH_NAME
}
-DLITE_WITH_XPU=
${
LITE_WITH_XPU
}
-DXPU_SDK_ROOT=
${
XPU_SDK_ROOT
}
-DLITE_WITH_ARM=OFF
)
ExternalProject_Add
(
${
LITE_PROJECT
}
${
EXTERNAL_PROJECT_LOG_ARGS
}
GIT_REPOSITORY
"https://github.com/PaddlePaddle/Paddle-Lite.git"
GIT_TAG
${
LITE_GIT_TAG
}
PREFIX
${
LITE_SOURCES_DIR
}
UPDATE_COMMAND
""
BUILD_COMMAND
${
LITE_BUILD_COMMAND
}
INSTALL_COMMAND
""
CMAKE_ARGS -DCMAKE_CXX_COMPILER=
${
CMAKE_CXX_COMPILER
}
-DCMAKE_C_COMPILER=
${
CMAKE_C_COMPILER
}
-DCMAKE_CXX_FLAGS=
${
LITE_CMAKE_CXX_FLAGS
}
-DCMAKE_CXX_FLAGS_RELEASE=
${
CMAKE_CXX_FLAGS_RELEASE
}
-DCMAKE_CXX_FLAGS_DEBUG=
${
CMAKE_CXX_FLAGS_DEBUG
}
-DCMAKE_C_FLAGS=
${
CMAKE_C_FLAGS
}
-DCMAKE_C_FLAGS_DEBUG=
${
CMAKE_C_FLAGS_DEBUG
}
-DCMAKE_C_FLAGS_RELEASE=
${
CMAKE_C_FLAGS_RELEASE
}
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DCMAKE_BUILD_TYPE=
${
THIRD_PARTY_BUILD_TYPE
}
${
EXTERNAL_OPTIONAL_ARGS
}
${
LITE_OPTIONAL_ARGS
}
)
endif
()
ExternalProject_Get_property
(
${
LITE_PROJECT
}
BINARY_DIR
)
ExternalProject_Get_property
(
${
LITE_PROJECT
}
SOURCE_DIR
)
set
(
LITE_BINARY_DIR
${
BINARY_DIR
}
)
...
...
@@ -103,8 +147,8 @@ function(external_lite_libs alias path)
endif
()
endfunction
()
external_lite_libs
(
lite_full_static
${
LITE_BINARY_DIR
}
/
inference_lite_lib
/cxx/lib/libpaddle_full_api_shared.so
)
set
(
LITE_SHARED_LIB
${
LITE_BINARY_DIR
}
/
inference_lite_lib
/cxx/lib/libpaddle_full_api_shared.so
)
external_lite_libs
(
lite_full_static
${
LITE_BINARY_DIR
}
/
${
LITE_OUTPUT_BIN_DIR
}
/cxx/lib/libpaddle_full_api_shared.so
)
set
(
LITE_SHARED_LIB
${
LITE_BINARY_DIR
}
/
${
LITE_OUTPUT_BIN_DIR
}
/cxx/lib/libpaddle_full_api_shared.so
)
add_definitions
(
-DPADDLE_WITH_LITE
)
add_definitions
(
-DLITE_WITH_LOG
)
cmake/inference_lib.cmake
浏览文件 @
9005c5a2
...
...
@@ -131,7 +131,7 @@ function(copy_part_of_thrid_party TARGET DST)
if
(
LITE_BINARY_DIR
)
set
(
dst_dir
"
${
DST
}
/third_party/install/lite"
)
copy
(
${
TARGET
}
SRCS
${
LITE_BINARY_DIR
}
/
inference_lite_lib
/*
SRCS
${
LITE_BINARY_DIR
}
/
${
LITE_OUTPUT_BIN_DIR
}
/*
DSTS
${
dst_dir
}
)
endif
()
endfunction
()
...
...
paddle/fluid/inference/analysis/ir_passes/lite_subgraph_pass.cc
浏览文件 @
9005c5a2
...
...
@@ -252,7 +252,11 @@ void LiteSubgraphPass::SetUpEngine(
}
else
if
(
use_xpu
)
{
target_type
=
TARGET
(
kXPU
);
}
else
{
#ifdef PADDLE_WITH_ARM
target_type
=
TARGET
(
kARM
);
#else
target_type
=
TARGET
(
kX86
);
#endif
}
paddle
::
lite_api
::
PrecisionType
precision_type
=
...
...
paddle/fluid/inference/lite/tensor_utils.cc
浏览文件 @
9005c5a2
...
...
@@ -46,6 +46,7 @@ platform::Place GetNativePlace(const TargetType& type, int id = 0) {
switch
(
type
)
{
case
TargetType
::
kHost
:
case
TargetType
::
kX86
:
case
TargetType
::
kARM
:
return
platform
::
CPUPlace
();
case
TargetType
::
kCUDA
:
return
platform
::
CUDAPlace
(
id
);
...
...
paddle/fluid/pybind/inference_api.cc
浏览文件 @
9005c5a2
...
...
@@ -481,8 +481,8 @@ void BindAnalysisConfig(py::module *m) {
py
::
arg
(
"disable_trt_plugin_fp16"
)
=
false
)
.
def
(
"tensorrt_engine_enabled"
,
&
AnalysisConfig
::
tensorrt_engine_enabled
)
.
def
(
"enable_lite_engine"
,
&
AnalysisConfig
::
EnableLiteEngine
,
py
::
arg
(
"zero_copy"
)
=
false
,
py
::
arg
(
"precision_mode"
)
=
AnalysisConfig
::
Precision
::
kFloat32
,
py
::
arg
(
"zero_copy"
)
=
false
,
py
::
arg
(
"passes_filter"
)
=
std
::
vector
<
std
::
string
>
(),
py
::
arg
(
"ops_filter"
)
=
std
::
vector
<
std
::
string
>
())
.
def
(
"lite_engine_enabled"
,
&
AnalysisConfig
::
lite_engine_enabled
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录