Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
229e91bf
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2299
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看板
未验证
提交
229e91bf
编写于
4月 06, 2022
作者:
A
Allen Guo
提交者:
GitHub
4月 06, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[IPU] remove paddle_ipu shared library (#41307)
* remove paddle_ipu shared library * fix unique_name
上级
5ae8babb
变更
17
隐藏空白更改
内联
并排
Showing
17 changed file
with
100 addition
and
73 deletion
+100
-73
cmake/inference_lib.cmake
cmake/inference_lib.cmake
+0
-7
paddle/fluid/framework/ir/CMakeLists.txt
paddle/fluid/framework/ir/CMakeLists.txt
+1
-1
paddle/fluid/inference/CMakeLists.txt
paddle/fluid/inference/CMakeLists.txt
+0
-2
paddle/fluid/inference/api/analysis_predictor.cc
paddle/fluid/inference/api/analysis_predictor.cc
+4
-0
paddle/fluid/platform/device/ipu/CMakeLists.txt
paddle/fluid/platform/device/ipu/CMakeLists.txt
+22
-9
paddle/fluid/platform/device/ipu/popart_canonicalization/activation_ops.cc
...form/device/ipu/popart_canonicalization/activation_ops.cc
+5
-5
paddle/fluid/platform/device/ipu/popart_canonicalization/canonicalization_utils.h
...vice/ipu/popart_canonicalization/canonicalization_utils.h
+30
-3
paddle/fluid/platform/device/ipu/popart_canonicalization/elementwise_ops.cc
...orm/device/ipu/popart_canonicalization/elementwise_ops.cc
+5
-5
paddle/fluid/platform/device/ipu/popart_canonicalization/logic_ops.cc
.../platform/device/ipu/popart_canonicalization/logic_ops.cc
+5
-5
paddle/fluid/platform/device/ipu/popart_canonicalization/math_ops.cc
...d/platform/device/ipu/popart_canonicalization/math_ops.cc
+5
-5
paddle/fluid/platform/device/ipu/popart_canonicalization/nn_ops.cc
...uid/platform/device/ipu/popart_canonicalization/nn_ops.cc
+5
-5
paddle/fluid/platform/device/ipu/popart_canonicalization/other_ops.cc
.../platform/device/ipu/popart_canonicalization/other_ops.cc
+5
-5
paddle/fluid/platform/device/ipu/popart_canonicalization/reduce_ops.cc
...platform/device/ipu/popart_canonicalization/reduce_ops.cc
+5
-5
paddle/fluid/platform/device/ipu/popart_canonicalization/search_ops.cc
...platform/device/ipu/popart_canonicalization/search_ops.cc
+3
-3
paddle/fluid/platform/device/ipu/popart_canonicalization/tensor_ops.cc
...platform/device/ipu/popart_canonicalization/tensor_ops.cc
+5
-5
paddle/fluid/pybind/CMakeLists.txt
paddle/fluid/pybind/CMakeLists.txt
+0
-4
python/setup.py.in
python/setup.py.in
+0
-4
未找到文件。
cmake/inference_lib.cmake
浏览文件 @
229e91bf
...
...
@@ -199,13 +199,6 @@ IF(WITH_XPU)
DSTS
${
dst_dir
}
${
dst_dir
}
)
ENDIF
()
IF
(
WITH_IPU
)
set
(
dst_dir
"
${
PADDLE_INFERENCE_INSTALL_DIR
}
/third_party/install/ipu"
)
copy
(
inference_lib_dist
SRCS
${
CMAKE_BINARY_DIR
}
/paddle/fluid/platform/device/ipu/libpaddle_ipu.so
DSTS
${
dst_dir
}
)
ENDIF
()
# CMakeCache Info
copy
(
inference_lib_dist
SRCS
${
CMAKE_CURRENT_BINARY_DIR
}
/CMakeCache.txt
...
...
paddle/fluid/framework/ir/CMakeLists.txt
浏览文件 @
229e91bf
...
...
@@ -150,7 +150,7 @@ if(WITH_IPU)
pass_library
(
ipu_runtime_replacer_pass base DIR ipu
)
pass_library
(
inference_process_pass base DIR ipu
)
pass_library
(
inference_postprocess_pass base DIR ipu
)
pass_library
(
popart_canonicalization_pass base DIR ipu
DEPS paddle_ipu
)
pass_library
(
popart_canonicalization_pass base DIR ipu
)
pass_library
(
ipu_inplace_pass base DIR ipu
)
pass_library
(
infer_shape_pass base DIR ipu
)
pass_library
(
delete_scale_op_pass base DIR ipu
)
...
...
paddle/fluid/inference/CMakeLists.txt
浏览文件 @
229e91bf
...
...
@@ -53,8 +53,6 @@ endif()
#TODO(wilber, T8T9): Do we still need to support windows gpu static library?
if
(
WIN32 AND WITH_GPU
)
cc_library
(
paddle_inference DEPS
${
fluid_modules
}
${
phi_modules
}
${
STATIC_INFERENCE_API
}
${
utils_modules
}
)
elseif
(
WITH_IPU
)
cc_library
(
paddle_inference DEPS
${
fluid_modules
}
${
phi_modules
}
${
STATIC_INFERENCE_API
}
${
utils_modules
}
paddle_ipu
)
else
()
create_static_lib
(
paddle_inference
${
fluid_modules
}
${
phi_modules
}
${
STATIC_INFERENCE_API
}
${
utils_modules
}
)
endif
()
...
...
paddle/fluid/inference/api/analysis_predictor.cc
浏览文件 @
229e91bf
...
...
@@ -74,6 +74,10 @@
#include "paddle/fluid/inference/tensorrt/trt_int8_calibrator.h"
#endif
#ifdef PADDLE_WITH_IPU
#include "paddle/fluid/platform/device/ipu/paddle_ipu_handler.h"
#endif
namespace
paddle
{
using
inference
::
Singleton
;
...
...
paddle/fluid/platform/device/ipu/CMakeLists.txt
浏览文件 @
229e91bf
IF
(
WITH_IPU
)
FILE
(
GLOB POPART_CANONICALIZATION_SRC
${
PADDLE_SOURCE_DIR
}
/paddle/fluid/platform/device/ipu/popart_canonicalization/*.cc
)
list
(
APPEND PADDLE_IPU_SRC
${
POPART_CANONICALIZATION_SRC
}
)
if
(
WITH_IPU
)
set
(
paddle_ipu_handler
${
CMAKE_CURRENT_BINARY_DIR
}
/paddle_ipu_handler.h.tmp
)
set
(
paddle_ipu_handler_final
${
CMAKE_CURRENT_BINARY_DIR
}
/paddle_ipu_handler.h
)
file
(
WRITE
${
paddle_ipu_handler
}
"// Auto generated from CMake. DO NOT EDIT!
\n\n
"
)
file
(
APPEND
${
paddle_ipu_handler
}
"
\#
pragma once
\n
"
)
file
(
APPEND
${
paddle_ipu_handler
}
"
\#
include
\"
paddle/fluid/platform/device/ipu/popart_canonicalization/canonicalization_utils.h
\"\n\n
"
)
file
(
GLOB POPART_CANONICALIZATION_SRC
${
CMAKE_CURRENT_SOURCE_DIR
}
/popart_canonicalization/*.cc
)
copy_if_different
(
${
paddle_ipu_handler
}
${
paddle_ipu_handler_final
}
)
foreach
(
file_path
${
POPART_CANONICALIZATION_SRC
}
)
file
(
READ
${
file_path
}
file_content
)
string
(
REGEX MATCHALL
"(REGISTER_HANDLER)(
\\
()([A-Za-z0-9_]+)(,)"
op_handlers
${
file_content
}
)
string
(
REPLACE
"REGISTER_HANDLER("
""
op_handlers
"
${
op_handlers
}
"
)
string
(
REPLACE
","
""
op_handlers
"
${
op_handlers
}
"
)
foreach
(
op_handler
${
op_handlers
}
)
file
(
APPEND
${
paddle_ipu_handler
}
"USE_HANDLER(
${
op_handler
}
);
\n
"
)
endforeach
()
endforeach
()
set
(
IPU_BACKEND_SRC
"ipu_strategy.cc"
"ipu_executor.cc"
...
...
@@ -13,10 +29,7 @@ IF(WITH_IPU)
"ipu_device.cc"
)
cc_library
(
ipu_backend SRCS
${
IPU_BACKEND_SRC
}
DEPS popart-only graph graph_helper popdist
)
cc_library
(
popart_canonicalization SRCS
${
POPART_CANONICALIZATION_SRC
}
DEPS graph
)
cc_library
(
ipu_backend SRCS
${
IPU_BACKEND_SRC
}
DEPS popart-only graph graph_helper popdist popart_canonicalization
)
cc_library
(
ipu_info SRCS
${
IPU_INFO_SRC
}
DEPS popart-only enforce
)
add_library
(
paddle_ipu SHARED
${
PADDLE_IPU_SRC
}
)
add_dependencies
(
paddle_ipu ipu_backend
)
set
(
PADDLE_IPU_LIB
"
${
CMAKE_CURRENT_BINARY_DIR
}
/libpaddle_ipu.so"
CACHE STRING
""
)
set
(
PADDLE_IPU_LIB_DIR
"
${
CMAKE_CURRENT_BINARY_DIR
}
"
CACHE STRING
""
)
ENDIF
()
endif
()
paddle/fluid/platform/device/ipu/popart_canonicalization/activation_ops.cc
浏览文件 @
229e91bf
...
...
@@ -88,6 +88,11 @@ Node *log_softmax_handler(Graph *graph, Node *node) {
node
->
outputs
);
}
}
// namespace
}
// namespace ipu
}
// namespace platform
}
// namespace paddle
REGISTER_HANDLER
(
relu
,
relu_handler
);
REGISTER_HANDLER
(
tanh
,
tanh_handler
);
REGISTER_HANDLER
(
log
,
log_handler
);
...
...
@@ -95,8 +100,3 @@ REGISTER_HANDLER(sigmoid, sigmoid_handler);
REGISTER_HANDLER
(
sqrt
,
sqrt_handler
);
REGISTER_HANDLER
(
gelu
,
gelu_handler
);
REGISTER_HANDLER
(
log_softmax
,
log_softmax_handler
);
}
// namespace
}
// namespace ipu
}
// namespace platform
}
// namespace paddle
paddle/fluid/platform/device/ipu/popart_canonicalization/canonicalization_utils.h
浏览文件 @
229e91bf
...
...
@@ -23,9 +23,36 @@ namespace paddle {
namespace
platform
{
namespace
ipu
{
#define REGISTER_HANDLER(name, func) \
static bool __UNUSED_##name = \
paddle::platform::ipu::RegisterHandler(#name, func)
#define STATIC_ASSERT_GLOBAL_NAMESPACE(uniq_name, msg) \
struct __test_global_namespace_##uniq_name##__ {}; \
static_assert(std::is_same<::__test_global_namespace_##uniq_name##__, \
__test_global_namespace_##uniq_name##__>::value, \
msg)
#define REGISTER_HANDLER(op_type, handler) \
STATIC_ASSERT_GLOBAL_NAMESPACE( \
__reg_ipu_op_handler__##op_type, \
"REGISTER_HANDLER must be called in global namespace"); \
struct __PaddleRegisterIpuOpHandler_##op_type { \
__PaddleRegisterIpuOpHandler_##op_type() { \
::paddle::platform::ipu::RegisterHandler( \
#op_type, paddle::platform::ipu::handler); \
} \
int Touch() const { return 0; } \
}; \
static __PaddleRegisterIpuOpHandler_##op_type \
__PaddleRegisterIpuOpHandler_instance##op_type; \
int TouchPaddleIpuOpHandlerRegister_##op_type() { \
return __PaddleRegisterIpuOpHandler_instance##op_type.Touch(); \
}
#define USE_HANDLER(op_type) \
STATIC_ASSERT_GLOBAL_NAMESPACE( \
__use_ipu_op_handler__##op_type, \
"USE_HANDLER must be called in global namespace"); \
extern int TouchPaddleIpuOpHandlerRegister_##op_type(); \
UNUSED static int use_handler__itself_##op_type##_ = \
TouchPaddleIpuOpHandlerRegister_##op_type()
using
SymbolHandler
=
std
::
function
<
Node
*
(
Graph
*
,
Node
*
)
>
;
...
...
paddle/fluid/platform/device/ipu/popart_canonicalization/elementwise_ops.cc
浏览文件 @
229e91bf
...
...
@@ -93,6 +93,11 @@ Node *elementwise_mod_handler(Graph *graph, Node *node) {
return
elementwise_op_handler
(
graph
,
node
,
"popart_mod"
);
}
}
// namespace
}
// namespace ipu
}
// namespace platform
}
// namespace paddle
REGISTER_HANDLER
(
elementwise_add
,
elementwise_add_handler
);
REGISTER_HANDLER
(
elementwise_sub
,
elementwise_sub_handler
);
REGISTER_HANDLER
(
elementwise_div
,
elementwise_div_handler
);
...
...
@@ -101,8 +106,3 @@ REGISTER_HANDLER(elementwise_min, elementwise_min_handler);
REGISTER_HANDLER
(
elementwise_max
,
elementwise_max_handler
);
REGISTER_HANDLER
(
elementwise_pow
,
elementwise_pow_handler
);
REGISTER_HANDLER
(
elementwise_mod
,
elementwise_mod_handler
);
}
// namespace
}
// namespace ipu
}
// namespace platform
}
// namespace paddle
paddle/fluid/platform/device/ipu/popart_canonicalization/logic_ops.cc
浏览文件 @
229e91bf
...
...
@@ -58,14 +58,14 @@ Node *less_than_handler(Graph *graph, Node *node) {
{
GetOutputVarNode
(
"Out"
,
node
)},
{});
}
}
// namespace
}
// namespace ipu
}
// namespace platform
}
// namespace paddle
REGISTER_HANDLER
(
equal
,
equal_handler
);
REGISTER_HANDLER
(
logical_not
,
logical_not_handler
);
REGISTER_HANDLER
(
logical_or
,
logical_or_handler
);
REGISTER_HANDLER
(
logical_and
,
logical_and_handler
);
REGISTER_HANDLER
(
greater_than
,
greater_than_handler
);
REGISTER_HANDLER
(
less_than
,
less_than_handler
);
}
// namespace
}
// namespace ipu
}
// namespace platform
}
// namespace paddle
paddle/fluid/platform/device/ipu/popart_canonicalization/math_ops.cc
浏览文件 @
229e91bf
...
...
@@ -366,6 +366,11 @@ Node *arg_max_handler(Graph *graph, Node *node) {
{{
"axis"
,
axis
},
{
"keepdims"
,
int64_t
{
0
}}});
}
}
// namespace
}
// namespace ipu
}
// namespace platform
}
// namespace paddle
REGISTER_HANDLER
(
mean
,
mean_handler
);
REGISTER_HANDLER
(
pow
,
pow_handler
);
REGISTER_HANDLER
(
mul
,
mul_handler
);
...
...
@@ -377,8 +382,3 @@ REGISTER_HANDLER(cross_entropy2, cross_entropy2_handler);
REGISTER_HANDLER
(
cumsum
,
cumsum_handler
);
REGISTER_HANDLER
(
matmul_v2
,
matmul_v2_handler
);
REGISTER_HANDLER
(
arg_max
,
arg_max_handler
);
}
// namespace
}
// namespace ipu
}
// namespace platform
}
// namespace paddle
paddle/fluid/platform/device/ipu/popart_canonicalization/nn_ops.cc
浏览文件 @
229e91bf
...
...
@@ -298,6 +298,11 @@ Node *dropout_handler(Graph *graph, Node *node) {
}
}
}
// namespace
}
// namespace ipu
}
// namespace platform
}
// namespace paddle
REGISTER_HANDLER
(
pool2d
,
pool2d_handler
);
REGISTER_HANDLER
(
batch_norm
,
batch_norm_handler
);
REGISTER_HANDLER
(
group_norm
,
group_norm_handler
);
...
...
@@ -305,8 +310,3 @@ REGISTER_HANDLER(instance_norm, instance_norm_handler);
REGISTER_HANDLER
(
layer_norm
,
layer_norm_handler
);
REGISTER_HANDLER
(
conv2d
,
conv2d_handler
);
REGISTER_HANDLER
(
dropout
,
dropout_handler
);
}
// namespace
}
// namespace ipu
}
// namespace platform
}
// namespace paddle
paddle/fluid/platform/device/ipu/popart_canonicalization/other_ops.cc
浏览文件 @
229e91bf
...
...
@@ -77,6 +77,11 @@ Node *detach_handler(Graph *graph, Node *node) {
node
->
outputs
);
}
}
// namespace
}
// namespace ipu
}
// namespace platform
}
// namespace paddle
REGISTER_HANDLER
(
custom_op
,
custom_op_handler
);
REGISTER_HANDLER
(
print
,
print_handler
);
REGISTER_HANDLER
(
popart_optimizer
,
popart_optimizer_handler
);
...
...
@@ -84,8 +89,3 @@ REGISTER_HANDLER(checkpointoutput, checkpointoutput_handler);
REGISTER_HANDLER
(
custom_nll_loss
,
custom_nll_loss_handler
);
REGISTER_HANDLER
(
identity
,
identity_handler
);
REGISTER_HANDLER
(
detach
,
detach_handler
);
}
// namespace
}
// namespace ipu
}
// namespace platform
}
// namespace paddle
paddle/fluid/platform/device/ipu/popart_canonicalization/reduce_ops.cc
浏览文件 @
229e91bf
...
...
@@ -56,13 +56,13 @@ Node *reduce_prod_handler(Graph *graph, Node *node) {
return
reduce_op_handler
(
graph
,
node
,
"popart_reduceprod"
);
}
}
// namespace
}
// namespace ipu
}
// namespace platform
}
// namespace paddle
REGISTER_HANDLER
(
reduce_mean
,
reduce_mean_handler
);
REGISTER_HANDLER
(
reduce_min
,
reduce_min_handler
);
REGISTER_HANDLER
(
reduce_sum
,
reduce_sum_handler
);
REGISTER_HANDLER
(
reduce_max
,
reduce_max_handler
);
REGISTER_HANDLER
(
reduce_prod
,
reduce_prod_handler
);
}
// namespace
}
// namespace ipu
}
// namespace platform
}
// namespace paddle
paddle/fluid/platform/device/ipu/popart_canonicalization/search_ops.cc
浏览文件 @
229e91bf
...
...
@@ -86,10 +86,10 @@ Node *topk_handler(Graph *graph, Node *node) {
static_cast
<
int
>
(
framework
::
proto
::
VarType
::
INT32
));
}
REGISTER_HANDLER
(
top_k
,
topk_handler
);
REGISTER_HANDLER
(
top_k_v2
,
topk_handler
);
}
// namespace
}
// namespace ipu
}
// namespace platform
}
// namespace paddle
REGISTER_HANDLER
(
top_k
,
topk_handler
);
REGISTER_HANDLER
(
top_k_v2
,
topk_handler
);
paddle/fluid/platform/device/ipu/popart_canonicalization/tensor_ops.cc
浏览文件 @
229e91bf
...
...
@@ -570,6 +570,11 @@ Node *split_handler(Graph *graph, Node *node) {
{
"split"
,
std
::
vector
<
int64_t
>
{
sections
.
begin
(),
sections
.
end
()}}});
}
}
// namespace
}
// namespace ipu
}
// namespace platform
}
// namespace paddle
REGISTER_HANDLER
(
fill_constant
,
fill_constant_handler
);
REGISTER_HANDLER
(
gaussian_random
,
gaussian_random_handler
);
REGISTER_HANDLER
(
uniform_random
,
uniform_random_handler
);
...
...
@@ -593,8 +598,3 @@ REGISTER_HANDLER(lookup_table_v2, lookup_table_v2_handler);
REGISTER_HANDLER
(
split
,
split_handler
);
REGISTER_HANDLER
(
one_hot
,
one_hot_handler
);
REGISTER_HANDLER
(
one_hot_v2
,
one_hot_v2_handler
);
}
// namespace
}
// namespace ipu
}
// namespace platform
}
// namespace paddle
paddle/fluid/pybind/CMakeLists.txt
浏览文件 @
229e91bf
...
...
@@ -369,10 +369,6 @@ if(WITH_PYTHON)
target_link_libraries
(
paddle_pybind
${
ROCM_HIPRTC_LIB
}
)
endif
()
if
(
WITH_IPU
)
target_link_libraries
(
paddle_pybind paddle_ipu
)
endif
()
get_property
(
os_dependency_modules GLOBAL PROPERTY OS_DEPENDENCY_MODULES
)
target_link_libraries
(
paddle_pybind
${
os_dependency_modules
}
)
add_dependencies
(
paddle_pybind op_function_generator_cmd
)
...
...
python/setup.py.in
浏览文件 @
229e91bf
...
...
@@ -547,10 +547,6 @@ if '${WITH_XPU_BKCL}' == 'ON':
shutil.copy('${XPU_BKCL_LIB}', libs_path)
package_data['paddle.libs']+=['${XPU_BKCL_LIB_NAME}']
if '${WITH_IPU}' == 'ON':
shutil.copy('${PADDLE_IPU_LIB}', libs_path)
package_data['paddle.libs'] += ['libpaddle_ipu' + ext_name]
# remove unused paddle/libs/__init__.py
if os.path.isfile(libs_path+'/__init__.py'):
os.remove(libs_path+'/__init__.py')
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录