Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MegEngine 天元
MegEngine
提交
3620a940
MegEngine
项目概览
MegEngine 天元
/
MegEngine
大约 1 年 前同步成功
通知
399
Star
4705
Fork
582
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
MegEngine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
3620a940
编写于
1月 25, 2021
作者:
M
Megvii Engine Team
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(megdnn): fix test with workspace_limits to zero
GitOrigin-RevId: c4ec323361594550e9ed46fff2f7bf42b8301ed8
上级
0d720653
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
23 addition
and
8 deletion
+23
-8
src/core/test/mem_reuse.cpp
src/core/test/mem_reuse.cpp
+15
-8
src/opr/impl/search_policy/algo_chooser.cpp
src/opr/impl/search_policy/algo_chooser.cpp
+8
-0
未找到文件。
src/core/test/mem_reuse.cpp
浏览文件 @
3620a940
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
#include "megbrain/opr/blas.h"
#include "megbrain/opr/blas.h"
#include "megbrain/test/helper.h"
#include "megbrain/test/helper.h"
#include "megdnn/oprs/base.h"
using
namespace
mgb
;
using
namespace
mgb
;
...
@@ -26,7 +27,8 @@ SymbolVar make_conv(SymbolVar inp, SymbolVar kern) {
...
@@ -26,7 +27,8 @@ SymbolVar make_conv(SymbolVar inp, SymbolVar kern) {
using
Conv
=
opr
::
Convolution
;
using
Conv
=
opr
::
Convolution
;
Conv
::
ExecutionPolicy
poly
;
Conv
::
ExecutionPolicy
poly
;
poly
.
workspace_limit
=
0
;
poly
.
workspace_limit
=
0
;
return
Conv
::
make
(
inp
,
kern
,
{},
poly
);
SymbolVar
conv
=
Conv
::
make
(
inp
,
kern
,
{},
poly
);
return
conv
;
}
}
// used for test NO_SYS_MEM_ALLOC
// used for test NO_SYS_MEM_ALLOC
...
@@ -74,9 +76,12 @@ MGB_DYN_TYPE_OBJ_FINAL_IMPL(SharedDeviceTensorDirect);
...
@@ -74,9 +76,12 @@ MGB_DYN_TYPE_OBJ_FINAL_IMPL(SharedDeviceTensorDirect);
TEST
(
TestMemReuse
,
PureMLP0
)
{
TEST
(
TestMemReuse
,
PureMLP0
)
{
auto
graph
=
ComputingGraph
::
make
();
auto
graph
=
ComputingGraph
::
make
();
HostTensorGenerator
<>
gen
;
HostTensorGenerator
<>
gen
;
auto
host_inp
=
gen
({
256
,
1
,
64
,
64
}),
CompNode
cn
=
CompNode
::
load
(
"cpu0"
);
host_kern0
=
gen
({
32
,
1
,
1
,
1
}),
//! FIXME currently recursive chooser does not support workspace_limit in
host_kern1
=
gen
({
32
,
32
,
1
,
1
});
//! heuristic
auto
host_inp
=
gen
({
256
,
1
,
64
,
64
},
cn
),
host_kern0
=
gen
({
32
,
1
,
1
,
1
},
cn
),
host_kern1
=
gen
({
32
,
32
,
1
,
1
},
cn
);
auto
inp
=
opr
::
SharedDeviceTensor
::
make
(
*
graph
,
*
host_inp
,
{
"inp"
}),
auto
inp
=
opr
::
SharedDeviceTensor
::
make
(
*
graph
,
*
host_inp
,
{
"inp"
}),
kern0
=
opr
::
SharedDeviceTensor
::
make
(
*
graph
,
*
host_kern0
,
{
"kern0"
}),
kern0
=
opr
::
SharedDeviceTensor
::
make
(
*
graph
,
*
host_kern0
,
{
"kern0"
}),
kern1
=
opr
::
SharedDeviceTensor
::
make
(
*
graph
,
*
host_kern1
,
{
"kern1"
});
kern1
=
opr
::
SharedDeviceTensor
::
make
(
*
graph
,
*
host_kern1
,
{
"kern1"
});
...
@@ -102,9 +107,12 @@ TEST(TestMemReuse, PureMLP0) {
...
@@ -102,9 +107,12 @@ TEST(TestMemReuse, PureMLP0) {
TEST
(
TestMemReuse
,
PureMLP1
)
{
TEST
(
TestMemReuse
,
PureMLP1
)
{
auto
graph
=
ComputingGraph
::
make
();
auto
graph
=
ComputingGraph
::
make
();
HostTensorGenerator
<>
gen
;
HostTensorGenerator
<>
gen
;
auto
host_inp
=
gen
({
256
,
1
,
64
,
64
}),
CompNode
cn
=
CompNode
::
load
(
"cpu0"
);
host_kern0
=
gen
({
32
,
1
,
1
,
1
}),
//! FIXME currently recursive chooser does not support workspace_limit in
host_kern1
=
gen
({
32
,
32
,
1
,
1
});
//! heuristic
auto
host_inp
=
gen
({
256
,
1
,
64
,
64
},
cn
),
host_kern0
=
gen
({
32
,
1
,
1
,
1
},
cn
),
host_kern1
=
gen
({
32
,
32
,
1
,
1
},
cn
);
auto
inp
=
opr
::
Host2DeviceCopy
::
make
(
*
graph
,
host_inp
,
{
"inp"
}),
auto
inp
=
opr
::
Host2DeviceCopy
::
make
(
*
graph
,
host_inp
,
{
"inp"
}),
kern0
=
opr
::
SharedDeviceTensor
::
make
(
*
graph
,
*
host_kern0
,
{
"kern0"
}),
kern0
=
opr
::
SharedDeviceTensor
::
make
(
*
graph
,
*
host_kern0
,
{
"kern0"
}),
kern1
=
opr
::
SharedDeviceTensor
::
make
(
*
graph
,
*
host_kern1
,
{
"kern1"
}),
kern1
=
opr
::
SharedDeviceTensor
::
make
(
*
graph
,
*
host_kern1
,
{
"kern1"
}),
...
@@ -338,4 +346,3 @@ TEST(TestMemReuse, FwdNoSysMemAlloc) {
...
@@ -338,4 +346,3 @@ TEST(TestMemReuse, FwdNoSysMemAlloc) {
}
}
// vim: syntax=cpp.doxygen foldmethod=marker foldmarker=f{{{,f}}}
// vim: syntax=cpp.doxygen foldmethod=marker foldmarker=f{{{,f}}}
src/opr/impl/search_policy/algo_chooser.cpp
浏览文件 @
3620a940
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
*/
*/
#include "megbrain/opr/search_policy/algo_chooser.h"
#include "megbrain/opr/search_policy/algo_chooser.h"
#include <limits>
#include "megbrain/opr/internal/megdnn_opr_wrapper.h"
#include "megbrain/opr/internal/megdnn_opr_wrapper.h"
#include "megbrain/opr/search_policy/algo_chooser_helper.h"
#include "megbrain/opr/search_policy/algo_chooser_helper.h"
#include "megbrain/opr/search_policy/profiler.h"
#include "megbrain/opr/search_policy/profiler.h"
...
@@ -473,6 +474,13 @@ AlgoChooser<Opr>::ExeContext::get_profile_result_from_cache(
...
@@ -473,6 +474,13 @@ AlgoChooser<Opr>::ExeContext::get_profile_result_from_cache(
template
<
typename
Opr
>
template
<
typename
Opr
>
typename
AlgoChooser
<
Opr
>::
ImplExecutionPolicy
typename
AlgoChooser
<
Opr
>::
ImplExecutionPolicy
AlgoChooser
<
Opr
>::
ExeContext
::
choose_by_heuristic
(
bool
reproducible
)
const
{
AlgoChooser
<
Opr
>::
ExeContext
::
choose_by_heuristic
(
bool
reproducible
)
const
{
if
(
m_execution_policy
.
workspace_limit
!=
std
::
numeric_limits
<
decltype
(
m_execution_policy
.
workspace_limit
)
>::
max
())
{
mgb_log_warn
(
"workspace_limit should not be setted if choose algo by "
"heuristic"
);
}
auto
workspace_limit
=
WorkspaceLimitGetter
::
get_workspace_limit
(
auto
workspace_limit
=
WorkspaceLimitGetter
::
get_workspace_limit
(
owner_graph
(),
m_cn
,
m_execution_policy
.
workspace_limit
);
owner_graph
(),
m_cn
,
m_execution_policy
.
workspace_limit
);
ImplExecutionPolicy
policy
;
ImplExecutionPolicy
policy
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录