Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
041ea14c
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看板
未验证
提交
041ea14c
编写于
2月 24, 2023
作者:
Y
Yuanle Liu
提交者:
GitHub
2月 24, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix libpaddle_inference.so symbol conflicts with other .so (gflags) (#50787)
上级
bda59b1b
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
32 addition
and
116 deletion
+32
-116
paddle/fluid/inference/CMakeLists.txt
paddle/fluid/inference/CMakeLists.txt
+2
-8
paddle/fluid/inference/api/details/zero_copy_tensor.cc
paddle/fluid/inference/api/details/zero_copy_tensor.cc
+20
-20
paddle/fluid/inference/paddle_inference.map
paddle/fluid/inference/paddle_inference.map
+1
-0
paddle/fluid/inference/paddle_inference_custom_device.map
paddle/fluid/inference/paddle_inference_custom_device.map
+0
-81
paddle/phi/core/enforce.cc
paddle/phi/core/enforce.cc
+4
-1
paddle/phi/core/enforce.h
paddle/phi/core/enforce.h
+5
-6
未找到文件。
paddle/fluid/inference/CMakeLists.txt
浏览文件 @
041ea14c
...
@@ -154,14 +154,8 @@ set_target_properties(paddle_inference_shared PROPERTIES OUTPUT_NAME
...
@@ -154,14 +154,8 @@ set_target_properties(paddle_inference_shared PROPERTIES OUTPUT_NAME
paddle_inference
)
paddle_inference
)
if
(
NOT APPLE AND NOT WIN32
)
if
(
NOT APPLE AND NOT WIN32
)
# TODO(liuyiqun): Temporarily disable the link flag because it is not support on Mac.
# TODO(liuyiqun): Temporarily disable the link flag because it is not support on Mac.
if
(
WITH_CUSTOM_DEVICE
)
set
(
LINK_FLAGS
set
(
LINK_FLAGS
"-Wl,--version-script
${
CMAKE_CURRENT_SOURCE_DIR
}
/paddle_inference.map"
)
"-Wl,--version-script
${
CMAKE_CURRENT_SOURCE_DIR
}
/paddle_inference_custom_device.map"
)
else
()
set
(
LINK_FLAGS
"-Wl,--version-script
${
CMAKE_CURRENT_SOURCE_DIR
}
/paddle_inference.map"
)
endif
()
set_target_properties
(
paddle_inference_shared PROPERTIES LINK_FLAGS
set_target_properties
(
paddle_inference_shared PROPERTIES LINK_FLAGS
"
${
LINK_FLAGS
}
"
)
"
${
LINK_FLAGS
}
"
)
# check symbol hidden
# check symbol hidden
...
...
paddle/fluid/inference/api/details/zero_copy_tensor.cc
浏览文件 @
041ea14c
...
@@ -378,17 +378,16 @@ void Tensor::CopyToCpuImpl(T *data,
...
@@ -378,17 +378,16 @@ void Tensor::CopyToCpuImpl(T *data,
auto
*
t_data
=
tensor
->
data
<
T
>
();
auto
*
t_data
=
tensor
->
data
<
T
>
();
auto
t_place
=
tensor
->
place
();
auto
t_place
=
tensor
->
place
();
phi
::
DenseTensor
out
;
auto
mem_allocation
=
std
::
make_shared
<
paddle
::
memory
::
allocation
::
Allocation
>
(
static_cast
<
void
*>
(
data
),
ele_num
*
sizeof
(
T
),
paddle
::
platform
::
CPUPlace
());
out
.
ResetHolder
(
mem_allocation
);
if
(
paddle
::
platform
::
is_cpu_place
(
t_place
))
{
if
(
paddle
::
platform
::
is_cpu_place
(
t_place
))
{
#ifdef PADDLE_WITH_MKLDNN
#ifdef PADDLE_WITH_MKLDNN
if
(
tensor
->
layout
()
==
phi
::
DataLayout
::
ONEDNN
)
if
(
tensor
->
layout
()
==
phi
::
DataLayout
::
ONEDNN
)
{
phi
::
DenseTensor
out
;
auto
mem_allocation
=
std
::
make_shared
<
paddle
::
memory
::
allocation
::
Allocation
>
(
static_cast
<
void
*>
(
data
),
ele_num
*
sizeof
(
T
),
paddle
::
platform
::
CPUPlace
());
out
.
ResetHolder
(
mem_allocation
);
phi
::
funcs
::
TransDataLayoutFromOneDNN
(
phi
::
funcs
::
TransDataLayoutFromOneDNN
(
tensor
->
layout
(),
tensor
->
layout
(),
phi
::
OneDNNContext
::
tls
().
get_cur_paddle_data_layout
(),
phi
::
OneDNNContext
::
tls
().
get_cur_paddle_data_layout
(),
...
@@ -396,8 +395,9 @@ void Tensor::CopyToCpuImpl(T *data,
...
@@ -396,8 +395,9 @@ void Tensor::CopyToCpuImpl(T *data,
&
out
,
&
out
,
paddle
::
platform
::
CPUPlace
(),
paddle
::
platform
::
CPUPlace
(),
true
);
true
);
else
}
else
{
std
::
memcpy
(
static_cast
<
void
*>
(
data
),
t_data
,
ele_num
*
sizeof
(
T
));
std
::
memcpy
(
static_cast
<
void
*>
(
data
),
t_data
,
ele_num
*
sizeof
(
T
));
}
#else
#else
std
::
memcpy
(
static_cast
<
void
*>
(
data
),
t_data
,
ele_num
*
sizeof
(
T
));
std
::
memcpy
(
static_cast
<
void
*>
(
data
),
t_data
,
ele_num
*
sizeof
(
T
));
#endif
#endif
...
@@ -871,17 +871,16 @@ void InternalUtils::CopyToCpuWithIoStream(paddle_infer::Tensor *t,
...
@@ -871,17 +871,16 @@ void InternalUtils::CopyToCpuWithIoStream(paddle_infer::Tensor *t,
auto
*
t_data
=
tensor
->
data
<
T
>
();
auto
*
t_data
=
tensor
->
data
<
T
>
();
auto
t_place
=
tensor
->
place
();
auto
t_place
=
tensor
->
place
();
phi
::
DenseTensor
out
;
auto
mem_allocation
=
std
::
make_shared
<
paddle
::
memory
::
allocation
::
Allocation
>
(
static_cast
<
void
*>
(
data
),
ele_num
*
sizeof
(
T
),
paddle
::
platform
::
CPUPlace
());
out
.
ResetHolder
(
mem_allocation
);
if
(
paddle
::
platform
::
is_cpu_place
(
t_place
))
{
if
(
paddle
::
platform
::
is_cpu_place
(
t_place
))
{
#ifdef PADDLE_WITH_MKLDNN
#ifdef PADDLE_WITH_MKLDNN
if
(
tensor
->
layout
()
==
phi
::
DataLayout
::
ONEDNN
)
if
(
tensor
->
layout
()
==
phi
::
DataLayout
::
ONEDNN
)
{
phi
::
DenseTensor
out
;
auto
mem_allocation
=
std
::
make_shared
<
paddle
::
memory
::
allocation
::
Allocation
>
(
static_cast
<
void
*>
(
data
),
ele_num
*
sizeof
(
T
),
paddle
::
platform
::
CPUPlace
());
out
.
ResetHolder
(
mem_allocation
);
phi
::
funcs
::
TransDataLayoutFromOneDNN
(
phi
::
funcs
::
TransDataLayoutFromOneDNN
(
tensor
->
layout
(),
tensor
->
layout
(),
phi
::
OneDNNContext
::
tls
().
get_cur_paddle_data_layout
(),
phi
::
OneDNNContext
::
tls
().
get_cur_paddle_data_layout
(),
...
@@ -889,8 +888,9 @@ void InternalUtils::CopyToCpuWithIoStream(paddle_infer::Tensor *t,
...
@@ -889,8 +888,9 @@ void InternalUtils::CopyToCpuWithIoStream(paddle_infer::Tensor *t,
&
out
,
&
out
,
paddle
::
platform
::
CPUPlace
(),
paddle
::
platform
::
CPUPlace
(),
true
);
true
);
else
}
else
{
std
::
memcpy
(
static_cast
<
void
*>
(
data
),
t_data
,
ele_num
*
sizeof
(
T
));
std
::
memcpy
(
static_cast
<
void
*>
(
data
),
t_data
,
ele_num
*
sizeof
(
T
));
}
#else
#else
std
::
memcpy
(
static_cast
<
void
*>
(
data
),
t_data
,
ele_num
*
sizeof
(
T
));
std
::
memcpy
(
static_cast
<
void
*>
(
data
),
t_data
,
ele_num
*
sizeof
(
T
));
#endif
#endif
...
...
paddle/fluid/inference/paddle_inference.map
浏览文件 @
041ea14c
...
@@ -73,6 +73,7 @@
...
@@ -73,6 +73,7 @@
*Pass*;
*Pass*;
*profile*;
*profile*;
*phi*;
*phi*;
PD_*;
*cinn*;
*cinn*;
local:
local:
*;
*;
...
...
paddle/fluid/inference/paddle_inference_custom_device.map
已删除
100644 → 0
浏览文件 @
bda59b1b
{
global:
extern "C++" {
*paddle_infer::GetVersion*;
*paddle_infer::UpdateDllFlag*;
*paddle_infer::experimental::InternalUtils*;
*paddle_infer::Tensor*;
*paddle_infer::Predictor*;
*paddle_infer::CreatePredictor*;
*paddle_infer::GetTrtCompileVersion*;
*paddle_infer::GetTrtRuntimeVersion*;
*paddle_infer::GetNumBytesOfDataType*;
*paddle_infer::ConvertToMixedPrecision*;
*paddle_infer::contrib::TensorUtils*;
*paddle_infer::contrib::Status*;
*paddle_infer::services::PredictorPool*;
*paddle_infer::LayoutConvert*;
*paddle::experimental*;
*paddle::internal*;
*paddle::get_version*;
*paddle::LiteNNAdapterConfig*;
*paddle::AnalysisConfig::*;
*paddle::PaddlePredictor::*;
*paddle::CreatePaddlePredictor*;
*paddle::NativePaddlePredictor*;
*paddle::AnalysisPredictor*;
*paddle::PaddleDtypeSize*;
*paddle::ZeroCopyTensor*;
*paddle::*Strategy*;
*paddle::NativeConfig*;
*paddle::PaddleBuf*;
*paddle::PaddleTensor*;
*paddle::UpdateDllFlag*;
*paddle::MakeCipher*;
*paddle::DistConfig*;
*paddle::DefaultGPUPlace*;
*paddle::ResourceManager*;
*paddle::GPUContextResource*;
*paddle::CPUContextResource*;
*paddle::OpMetaInfoBuilder*;
*paddle::CustomOpKernelContext*;
/* ut needs the following symbol, we need to modify all the ut to hidden such symbols */
/* Another question: the ut size will grow from 50M to 80M, why? */
*paddle::detail*;
*paddle::imperative*;
*paddle::detailv3*;
*paddle::memory*;
*paddle::string*;
*paddle::operators*;
*paddle::distributed*;
/* *paddle::distributed::FleetWrapper*; */
/* *paddle::distributed::TensorTable*; */
/* *paddle::distributed::TableManager*; */
/* *paddle::inference*; */
*paddle::inference::ReadBinaryFile*;
*paddle::platform*;
/* *paddle::platform::GetExportedFlagInfoMap*; */
/* *paddle::framework*; */
*paddle::framework::InterpreterCore*;
*paddle::framework::Executor*;
*paddle::framework::proto*;
};
/* The following symbols need to reconsider. */
*Pass*;
*profile*;
*phi*;
*FLAGS_*;
PD_*;
*cinn*;
local:
*;
};
paddle/phi/core/enforce.cc
浏览文件 @
041ea14c
...
@@ -20,7 +20,8 @@ limitations under the License. */
...
@@ -20,7 +20,8 @@ limitations under the License. */
#include <vector>
#include <vector>
#include "paddle/utils/blank.h"
#include "paddle/utils/blank.h"
#include "paddle/utils/variant.h"
DECLARE_int32
(
call_stack_level
);
namespace
egr
{
namespace
egr
{
class
EagerVariable
;
class
EagerVariable
;
...
@@ -88,6 +89,8 @@ using NameTensorMap = NameVarMap<egr::EagerVariable>;
...
@@ -88,6 +89,8 @@ using NameTensorMap = NameVarMap<egr::EagerVariable>;
namespace
phi
{
namespace
phi
{
namespace
enforce
{
namespace
enforce
{
int
GetCallStackLevel
()
{
return
FLAGS_call_stack_level
;
}
template
<
typename
T
>
template
<
typename
T
>
static
std
::
string
ReplaceComplexTypeStr
(
std
::
string
str
,
static
std
::
string
ReplaceComplexTypeStr
(
std
::
string
str
,
const
std
::
string
&
type_name
)
{
const
std
::
string
&
type_name
)
{
...
...
paddle/phi/core/enforce.h
浏览文件 @
041ea14c
...
@@ -101,8 +101,6 @@ limitations under the License. */
...
@@ -101,8 +101,6 @@ limitations under the License. */
#include "paddle/utils/variant.h"
#include "paddle/utils/variant.h"
DECLARE_int32
(
call_stack_level
);
namespace
phi
{
namespace
phi
{
class
ErrorSummary
;
class
ErrorSummary
;
}
// namespace phi
}
// namespace phi
...
@@ -235,6 +233,7 @@ struct BinaryCompareMessageConverter<false> {
...
@@ -235,6 +233,7 @@ struct BinaryCompareMessageConverter<false> {
};
};
}
// namespace details
}
// namespace details
int
GetCallStackLevel
();
std
::
string
GetCurrentTraceBackString
(
bool
for_signal
=
false
);
std
::
string
GetCurrentTraceBackString
(
bool
for_signal
=
false
);
std
::
string
SimplifyErrorTypeFormat
(
const
std
::
string
&
str
);
std
::
string
SimplifyErrorTypeFormat
(
const
std
::
string
&
str
);
...
@@ -243,7 +242,7 @@ static std::string GetErrorSumaryString(StrType&& what,
...
@@ -243,7 +242,7 @@ static std::string GetErrorSumaryString(StrType&& what,
const
char
*
file
,
const
char
*
file
,
int
line
)
{
int
line
)
{
std
::
ostringstream
sout
;
std
::
ostringstream
sout
;
if
(
FLAGS_call_stack_level
>
1
)
{
if
(
GetCallStackLevel
()
>
1
)
{
sout
<<
"
\n
----------------------
\n
Error Message "
sout
<<
"
\n
----------------------
\n
Error Message "
"Summary:
\n
----------------------
\n
"
;
"Summary:
\n
----------------------
\n
"
;
}
}
...
@@ -270,7 +269,7 @@ template <typename StrType>
...
@@ -270,7 +269,7 @@ template <typename StrType>
static
std
::
string
GetTraceBackString
(
StrType
&&
what
,
static
std
::
string
GetTraceBackString
(
StrType
&&
what
,
const
char
*
file
,
const
char
*
file
,
int
line
)
{
int
line
)
{
if
(
FLAGS_call_stack_level
>
1
)
{
if
(
GetCallStackLevel
()
>
1
)
{
// FLAGS_call_stack_level>1 means showing c++ call stack
// FLAGS_call_stack_level>1 means showing c++ call stack
return
GetCurrentTraceBackString
()
+
GetErrorSumaryString
(
what
,
file
,
line
);
return
GetCurrentTraceBackString
()
+
GetErrorSumaryString
(
what
,
file
,
line
);
}
else
{
}
else
{
...
@@ -317,7 +316,7 @@ struct EnforceNotMet : public std::exception {
...
@@ -317,7 +316,7 @@ struct EnforceNotMet : public std::exception {
}
}
const
char
*
what
()
const
noexcept
override
{
const
char
*
what
()
const
noexcept
override
{
if
(
FLAGS_call_stack_level
>
1
)
{
if
(
GetCallStackLevel
()
>
1
)
{
return
err_str_
.
c_str
();
return
err_str_
.
c_str
();
}
else
{
}
else
{
return
simple_err_str_
.
c_str
();
return
simple_err_str_
.
c_str
();
...
@@ -331,7 +330,7 @@ struct EnforceNotMet : public std::exception {
...
@@ -331,7 +330,7 @@ struct EnforceNotMet : public std::exception {
const
std
::
string
&
simple_error_str
()
const
{
return
simple_err_str_
;
}
const
std
::
string
&
simple_error_str
()
const
{
return
simple_err_str_
;
}
void
set_error_str
(
std
::
string
str
)
{
void
set_error_str
(
std
::
string
str
)
{
if
(
FLAGS_call_stack_level
>
1
)
{
if
(
GetCallStackLevel
()
>
1
)
{
err_str_
=
str
;
err_str_
=
str
;
}
else
{
}
else
{
simple_err_str_
=
str
;
simple_err_str_
=
str
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录