Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
9005c5a2
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2302
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
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 @@
...
@@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
if
(
NOT LINUX
OR NOT WITH_MKL
)
if
(
NOT LINUX
)
message
(
"Paddle-lite will not build because the required Linux
and MKL
do not exist."
)
message
(
"Paddle-lite will not build because the required Linux do not exist."
)
set
(
WITH_LITE OFF
)
set
(
WITH_LITE OFF
)
return
()
return
()
endif
()
endif
()
...
@@ -42,7 +42,50 @@ if (NOT LITE_SOURCE_DIR OR NOT LITE_BINARY_DIR)
...
@@ -42,7 +42,50 @@ if (NOT LITE_SOURCE_DIR OR NOT LITE_BINARY_DIR)
endif
()
endif
()
# No quotes, so cmake can resolve it as a command with arguments.
# No quotes, so cmake can resolve it as a command with arguments.
if
(
WITH_ARM
)
set
(
LITE_BUILD_COMMAND $
(
MAKE
)
publish_inference -j
)
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
""
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
}
)
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
set
(
LITE_OPTIONAL_ARGS -DWITH_MKL=ON
-DLITE_WITH_CUDA=
${
WITH_GPU
}
-DLITE_WITH_CUDA=
${
WITH_GPU
}
-DWITH_MKLDNN=OFF
-DWITH_MKLDNN=OFF
...
@@ -82,6 +125,7 @@ if (NOT LITE_SOURCE_DIR OR NOT LITE_BINARY_DIR)
...
@@ -82,6 +125,7 @@ if (NOT LITE_SOURCE_DIR OR NOT LITE_BINARY_DIR)
${
EXTERNAL_OPTIONAL_ARGS
}
${
EXTERNAL_OPTIONAL_ARGS
}
${
LITE_OPTIONAL_ARGS
}
${
LITE_OPTIONAL_ARGS
}
)
)
endif
()
ExternalProject_Get_property
(
${
LITE_PROJECT
}
BINARY_DIR
)
ExternalProject_Get_property
(
${
LITE_PROJECT
}
BINARY_DIR
)
ExternalProject_Get_property
(
${
LITE_PROJECT
}
SOURCE_DIR
)
ExternalProject_Get_property
(
${
LITE_PROJECT
}
SOURCE_DIR
)
set
(
LITE_BINARY_DIR
${
BINARY_DIR
}
)
set
(
LITE_BINARY_DIR
${
BINARY_DIR
}
)
...
@@ -103,8 +147,8 @@ function(external_lite_libs alias path)
...
@@ -103,8 +147,8 @@ function(external_lite_libs alias path)
endif
()
endif
()
endfunction
()
endfunction
()
external_lite_libs
(
lite_full_static
${
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
}
/
inference_lite_lib
/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
(
-DPADDLE_WITH_LITE
)
add_definitions
(
-DLITE_WITH_LOG
)
add_definitions
(
-DLITE_WITH_LOG
)
cmake/inference_lib.cmake
浏览文件 @
9005c5a2
...
@@ -131,7 +131,7 @@ function(copy_part_of_thrid_party TARGET DST)
...
@@ -131,7 +131,7 @@ function(copy_part_of_thrid_party TARGET DST)
if
(
LITE_BINARY_DIR
)
if
(
LITE_BINARY_DIR
)
set
(
dst_dir
"
${
DST
}
/third_party/install/lite"
)
set
(
dst_dir
"
${
DST
}
/third_party/install/lite"
)
copy
(
${
TARGET
}
copy
(
${
TARGET
}
SRCS
${
LITE_BINARY_DIR
}
/
inference_lite_lib
/*
SRCS
${
LITE_BINARY_DIR
}
/
${
LITE_OUTPUT_BIN_DIR
}
/*
DSTS
${
dst_dir
}
)
DSTS
${
dst_dir
}
)
endif
()
endif
()
endfunction
()
endfunction
()
...
...
paddle/fluid/inference/analysis/ir_passes/lite_subgraph_pass.cc
浏览文件 @
9005c5a2
...
@@ -252,7 +252,11 @@ void LiteSubgraphPass::SetUpEngine(
...
@@ -252,7 +252,11 @@ void LiteSubgraphPass::SetUpEngine(
}
else
if
(
use_xpu
)
{
}
else
if
(
use_xpu
)
{
target_type
=
TARGET
(
kXPU
);
target_type
=
TARGET
(
kXPU
);
}
else
{
}
else
{
#ifdef PADDLE_WITH_ARM
target_type
=
TARGET
(
kARM
);
#else
target_type
=
TARGET
(
kX86
);
target_type
=
TARGET
(
kX86
);
#endif
}
}
paddle
::
lite_api
::
PrecisionType
precision_type
=
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) {
...
@@ -46,6 +46,7 @@ platform::Place GetNativePlace(const TargetType& type, int id = 0) {
switch
(
type
)
{
switch
(
type
)
{
case
TargetType
::
kHost
:
case
TargetType
::
kHost
:
case
TargetType
::
kX86
:
case
TargetType
::
kX86
:
case
TargetType
::
kARM
:
return
platform
::
CPUPlace
();
return
platform
::
CPUPlace
();
case
TargetType
::
kCUDA
:
case
TargetType
::
kCUDA
:
return
platform
::
CUDAPlace
(
id
);
return
platform
::
CUDAPlace
(
id
);
...
...
paddle/fluid/pybind/inference_api.cc
浏览文件 @
9005c5a2
...
@@ -481,8 +481,8 @@ void BindAnalysisConfig(py::module *m) {
...
@@ -481,8 +481,8 @@ void BindAnalysisConfig(py::module *m) {
py
::
arg
(
"disable_trt_plugin_fp16"
)
=
false
)
py
::
arg
(
"disable_trt_plugin_fp16"
)
=
false
)
.
def
(
"tensorrt_engine_enabled"
,
&
AnalysisConfig
::
tensorrt_engine_enabled
)
.
def
(
"tensorrt_engine_enabled"
,
&
AnalysisConfig
::
tensorrt_engine_enabled
)
.
def
(
"enable_lite_engine"
,
&
AnalysisConfig
::
EnableLiteEngine
,
.
def
(
"enable_lite_engine"
,
&
AnalysisConfig
::
EnableLiteEngine
,
py
::
arg
(
"zero_copy"
)
=
false
,
py
::
arg
(
"precision_mode"
)
=
AnalysisConfig
::
Precision
::
kFloat32
,
py
::
arg
(
"precision_mode"
)
=
AnalysisConfig
::
Precision
::
kFloat32
,
py
::
arg
(
"zero_copy"
)
=
false
,
py
::
arg
(
"passes_filter"
)
=
std
::
vector
<
std
::
string
>
(),
py
::
arg
(
"passes_filter"
)
=
std
::
vector
<
std
::
string
>
(),
py
::
arg
(
"ops_filter"
)
=
std
::
vector
<
std
::
string
>
())
py
::
arg
(
"ops_filter"
)
=
std
::
vector
<
std
::
string
>
())
.
def
(
"lite_engine_enabled"
,
&
AnalysisConfig
::
lite_engine_enabled
)
.
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录