Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
3c49f08e
P
Paddle
项目概览
机器未来
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
3c49f08e
编写于
6月 11, 2021
作者:
J
Jacek Czaja
提交者:
GitHub
6月 11, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[oneDNN] Second fix to #33021 (#33471)
* - Second fix - fix * - fix
上级
681778d8
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
19 addition
and
6 deletion
+19
-6
paddle/fluid/inference/api/analysis_predictor.cc
paddle/fluid/inference/api/analysis_predictor.cc
+6
-6
paddle/fluid/inference/tests/api/analyzer_detect_functional_mkldnn_tester.cc
...nce/tests/api/analyzer_detect_functional_mkldnn_tester.cc
+13
-0
未找到文件。
paddle/fluid/inference/api/analysis_predictor.cc
浏览文件 @
3c49f08e
...
@@ -343,8 +343,6 @@ void AnalysisPredictor::MkldnnPreSet(
...
@@ -343,8 +343,6 @@ void AnalysisPredictor::MkldnnPreSet(
platform
::
MKLDNNDeviceContext
::
tls
().
set_cur_mkldnn_session_id
(
platform
::
MKLDNNDeviceContext
::
tls
().
set_cur_mkldnn_session_id
(
platform
::
MKLDNNDeviceContextThreadLocals
::
platform
::
MKLDNNDeviceContextThreadLocals
::
kMKLDNNSessionID_CacheClearing
);
kMKLDNNSessionID_CacheClearing
);
platform
::
MKLDNNDeviceContext
::
tls
().
set_cur_input_shape_cache_capacity
(
config_
.
mkldnn_cache_capacity_
);
// Set current_input_shape for caching dynamic shape.
// Set current_input_shape for caching dynamic shape.
std
::
stringstream
ss
;
std
::
stringstream
ss
;
for
(
size_t
i
=
0
;
i
<
inputs_shape
.
size
();
++
i
)
{
for
(
size_t
i
=
0
;
i
<
inputs_shape
.
size
();
++
i
)
{
...
@@ -355,6 +353,9 @@ void AnalysisPredictor::MkldnnPreSet(
...
@@ -355,6 +353,9 @@ void AnalysisPredictor::MkldnnPreSet(
VLOG
(
2
)
<<
"Set input shape="
<<
ss
.
str
();
VLOG
(
2
)
<<
"Set input shape="
<<
ss
.
str
();
platform
::
MKLDNNDeviceContext
::
tls
().
set_cur_input_shape_str
(
ss
.
str
());
platform
::
MKLDNNDeviceContext
::
tls
().
set_cur_input_shape_str
(
ss
.
str
());
}
}
platform
::
MKLDNNDeviceContext
::
tls
().
set_cur_input_shape_cache_capacity
(
config_
.
mkldnn_cache_capacity_
);
#endif
#endif
}
}
...
@@ -370,10 +371,9 @@ void AnalysisPredictor::MkldnnPostReset() {
...
@@ -370,10 +371,9 @@ void AnalysisPredictor::MkldnnPostReset() {
CHECK_LE
(
shape_blob_size
,
CHECK_LE
(
shape_blob_size
,
static_cast
<
size_t
>
(
config_
.
mkldnn_cache_capacity_
));
static_cast
<
size_t
>
(
config_
.
mkldnn_cache_capacity_
));
}
}
paddle
::
platform
::
MKLDNNDeviceContext
::
tls
().
set_cur_mkldnn_session_id
(
// We cannot reset to the default cache settings
platform
::
MKLDNNDeviceContextThreadLocals
::
kMKLDNNSessionID_Default
);
// as there maybe CopyToCPU method used and oneDNN
platform
::
MKLDNNDeviceContext
::
tls
().
set_cur_input_shape_cache_capacity
(
0
);
// primitives are used there so cache would grow
platform
::
MKLDNNDeviceContext
::
tls
().
set_cur_input_shape_str
(
""
);
}
}
#endif
#endif
}
}
...
...
paddle/fluid/inference/tests/api/analyzer_detect_functional_mkldnn_tester.cc
浏览文件 @
3c49f08e
...
@@ -120,6 +120,19 @@ void validate_cache_onednn(int cache_capacity = 1) {
...
@@ -120,6 +120,19 @@ void validate_cache_onednn(int cache_capacity = 1) {
file
.
close
();
file
.
close
();
infer_file
.
close
();
infer_file
.
close
();
// Pick first output tensor from model
// as internally reorders may be called
// so it will impact cache size
auto
output_names
=
predictor
->
GetOutputNames
();
auto
output_t
=
predictor
->
GetOutputTensor
(
output_names
[
0
]);
std
::
vector
<
int
>
output_shape
=
output_t
->
shape
();
size_t
out_num
=
std
::
accumulate
(
output_shape
.
begin
(),
output_shape
.
end
(),
1
,
std
::
multiplies
<
int
>
());
std
::
vector
<
float
>
out_data
;
out_data
.
resize
(
out_num
);
output_t
->
CopyToCpu
(
out_data
.
data
());
// Release predictor (relevant cache should be emptied)
predictor
.
reset
(
nullptr
);
predictor
.
reset
(
nullptr
);
cache_filling
.
push_back
(
GetNumCachedObjects
());
cache_filling
.
push_back
(
GetNumCachedObjects
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录