Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MegEngine 天元
MegEngine
提交
a3550f91
MegEngine
项目概览
MegEngine 天元
/
MegEngine
1 年多 前同步成功
通知
403
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看板
提交
a3550f91
编写于
11月 04, 2020
作者:
M
Megvii Engine Team
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test(rocm): Fix rocm testcase
GitOrigin-RevId: d1a17d3eddea7bce298f26eb320043fb4d06b177
上级
1e90c457
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
42 addition
and
0 deletion
+42
-0
src/core/test/comp_node.cpp
src/core/test/comp_node.cpp
+21
-0
src/opr/impl/search_policy/profiler.cpp
src/opr/impl/search_policy/profiler.cpp
+12
-0
test/src/helper.cpp
test/src/helper.cpp
+7
-0
test/src/include/megbrain/test/helper.h
test/src/include/megbrain/test/helper.h
+2
-0
未找到文件。
src/core/test/comp_node.cpp
浏览文件 @
a3550f91
...
@@ -40,6 +40,10 @@ TEST(TestCompNode, Parse) {
...
@@ -40,6 +40,10 @@ TEST(TestCompNode, Parse) {
ASSERT_EQ
(
L
::
parse
(
"cpu2:23"
),
make_lc
(
D
::
CPU
,
2
,
23
));
ASSERT_EQ
(
L
::
parse
(
"cpu2:23"
),
make_lc
(
D
::
CPU
,
2
,
23
));
ASSERT_EQ
(
L
::
parse
(
"cpu21:23"
),
make_lc
(
D
::
CPU
,
21
,
23
));
ASSERT_EQ
(
L
::
parse
(
"cpu21:23"
),
make_lc
(
D
::
CPU
,
21
,
23
));
ASSERT_EQ
(
L
::
parse
(
"rocmx"
),
make_lc
(
D
::
ROCM
,
-
1
,
0
));
ASSERT_EQ
(
L
::
parse
(
"rocm2"
),
make_lc
(
D
::
ROCM
,
2
,
0
));
ASSERT_EQ
(
L
::
parse
(
"rocm2:3"
),
make_lc
(
D
::
ROCM
,
2
,
3
));
ASSERT_EQ
(
L
::
parse
(
"cambriconx"
),
make_lc
(
D
::
CAMBRICON
,
-
1
,
0
));
ASSERT_EQ
(
L
::
parse
(
"cambriconx"
),
make_lc
(
D
::
CAMBRICON
,
-
1
,
0
));
ASSERT_EQ
(
L
::
parse
(
"cambricon2"
),
make_lc
(
D
::
CAMBRICON
,
2
,
0
));
ASSERT_EQ
(
L
::
parse
(
"cambricon2"
),
make_lc
(
D
::
CAMBRICON
,
2
,
0
));
ASSERT_EQ
(
L
::
parse
(
"cambricon2:3"
),
make_lc
(
D
::
CAMBRICON
,
2
,
3
));
ASSERT_EQ
(
L
::
parse
(
"cambricon2:3"
),
make_lc
(
D
::
CAMBRICON
,
2
,
3
));
...
@@ -66,6 +70,7 @@ TEST(TestCompNode, Parse) {
...
@@ -66,6 +70,7 @@ TEST(TestCompNode, Parse) {
ASSERT_THROW
(
L
::
parse
(
"cpu0:"
),
MegBrainError
);
ASSERT_THROW
(
L
::
parse
(
"cpu0:"
),
MegBrainError
);
ASSERT_THROW
(
L
::
parse
(
"cpu0:x"
),
MegBrainError
);
ASSERT_THROW
(
L
::
parse
(
"cpu0:x"
),
MegBrainError
);
ASSERT_THROW
(
L
::
parse
(
"cpu2:23x"
),
MegBrainError
);
ASSERT_THROW
(
L
::
parse
(
"cpu2:23x"
),
MegBrainError
);
ASSERT_THROW
(
L
::
parse
(
"rcom0"
),
MegBrainError
);
ASSERT_THROW
(
L
::
parse
(
"cmabricon0"
),
MegBrainError
);
ASSERT_THROW
(
L
::
parse
(
"cmabricon0"
),
MegBrainError
);
ASSERT_THROW
(
L
::
parse
(
"atlast0"
),
MegBrainError
);
ASSERT_THROW
(
L
::
parse
(
"atlast0"
),
MegBrainError
);
ASSERT_THROW
(
L
::
parse
(
"multithread"
),
MegBrainError
);
ASSERT_THROW
(
L
::
parse
(
"multithread"
),
MegBrainError
);
...
@@ -296,6 +301,18 @@ TEST(TestCompNodeCuda, set_prealloc_config) {
...
@@ -296,6 +301,18 @@ TEST(TestCompNodeCuda, set_prealloc_config) {
4
,
CompNode
::
DeviceType
::
CUDA
);
4
,
CompNode
::
DeviceType
::
CUDA
);
}
}
#if MGB_ROCM
TEST
(
TestCompNodeROCm
,
MemNode
)
{
REQUIRE_AMD_GPU
(
2
);
auto
cn00
=
CompNode
::
load
(
"rocm0"
),
cn1
=
CompNode
::
load
(
"rocm1"
),
cn01
=
CompNode
::
load
(
"rocm0:1"
);
ASSERT_EQ
(
cn00
,
CompNode
::
load
(
"rocm0"
));
ASSERT_EQ
(
cn00
.
mem_node
(),
cn01
.
mem_node
());
ASSERT_NE
(
cn00
.
mem_node
(),
cn1
.
mem_node
());
}
#endif
#if MGB_CAMBRICON
#if MGB_CAMBRICON
TEST
(
TestCompNodeCambricon
,
MemNode
)
{
TEST
(
TestCompNodeCambricon
,
MemNode
)
{
...
@@ -466,6 +483,10 @@ TEST(TestCompNodeCPU, PeerCopyFromCUDA) {
...
@@ -466,6 +483,10 @@ TEST(TestCompNodeCPU, PeerCopyFromCUDA) {
test_peer_copy_from_device
(
"gpux"
);
test_peer_copy_from_device
(
"gpux"
);
}
}
TEST
(
TestCompNodeCPU
,
PeerCopyFromROCm
)
{
REQUIRE_AMD_GPU
(
1
);
test_peer_copy_from_device
(
"rocmx"
);
}
#if MGB_CAMBRICON
#if MGB_CAMBRICON
TEST
(
TestCompNodeCPU
,
PeerCopyFromCambricon
)
{
TEST
(
TestCompNodeCPU
,
PeerCopyFromCambricon
)
{
...
...
src/opr/impl/search_policy/profiler.cpp
浏览文件 @
a3550f91
...
@@ -14,6 +14,10 @@
...
@@ -14,6 +14,10 @@
#include "../internal/invoke.h"
#include "../internal/invoke.h"
#if MGB_ROCM
#include "hcc_detail/hcc_defs_prologue.h"
#include "megcore_rocm.h"
#endif
//! TODO: here has to be know some megdnn::opr when there is produced midout.h
//! TODO: here has to be know some megdnn::opr when there is produced midout.h
//! fix it if there is another graceful way.
//! fix it if there is another graceful way.
...
@@ -58,6 +62,11 @@ template <typename Opr>
...
@@ -58,6 +62,11 @@ template <typename Opr>
typename
TimedProfiler
<
Opr
>::
TResult
TimedProfiler
<
Opr
>::
prof_impl
(
typename
TimedProfiler
<
Opr
>::
TResult
TimedProfiler
<
Opr
>::
prof_impl
(
const
TParam
&
raw_param
)
{
const
TParam
&
raw_param
)
{
MIDOUT_B
(
Opr
,
midout_iv
(
MGB_HASH_STR
(
"TimedProfiler::prof_impl"
)))
MIDOUT_B
(
Opr
,
midout_iv
(
MGB_HASH_STR
(
"TimedProfiler::prof_impl"
)))
#if MGB_ROCM
bool
miopen_algo_search_enabled
;
megcore
::
getMIOpenAlgoSearchStatus
(
&
miopen_algo_search_enabled
);
mgb_assert
(
miopen_algo_search_enabled
,
"MIOpen algo search not enabled"
);
#endif
auto
&&
param
=
raw_param
.
as_single_pod
<
Param
>
();
auto
&&
param
=
raw_param
.
as_single_pod
<
Param
>
();
CompNode
cn
=
CompNode
::
load
(
param
.
comp_node_loc
,
param
.
comp_node_loc
);
CompNode
cn
=
CompNode
::
load
(
param
.
comp_node_loc
,
param
.
comp_node_loc
);
auto
megdnn_opr
=
intl
::
create_megdnn_opr
<
Opr
>
(
cn
);
auto
megdnn_opr
=
intl
::
create_megdnn_opr
<
Opr
>
(
cn
);
...
@@ -234,6 +243,9 @@ Maybe<typename TimedProfiler<Opr>::Result> TimedProfiler<Opr>::profile(
...
@@ -234,6 +243,9 @@ Maybe<typename TimedProfiler<Opr>::Result> TimedProfiler<Opr>::profile(
template
<
typename
Opr
>
template
<
typename
Opr
>
void
TimedProfiler
<
Opr
>::
prof_init_device
(
const
TParam
&
raw_param
)
{
void
TimedProfiler
<
Opr
>::
prof_init_device
(
const
TParam
&
raw_param
)
{
MIDOUT_B
(
Opr
,
midout_iv
(
MGB_HASH_STR
(
"TimedProfiler::prof_init_device"
)))
MIDOUT_B
(
Opr
,
midout_iv
(
MGB_HASH_STR
(
"TimedProfiler::prof_init_device"
)))
#if MGB_ROCM
megcore
::
enableMIOpenAlgoSearch
(
true
);
#endif
auto
&&
param
=
raw_param
.
as_single_pod
<
Param
>
();
auto
&&
param
=
raw_param
.
as_single_pod
<
Param
>
();
CompNode
cn
=
CompNode
::
load
(
param
.
comp_node_loc
,
param
.
comp_node_loc
);
CompNode
cn
=
CompNode
::
load
(
param
.
comp_node_loc
,
param
.
comp_node_loc
);
// wait for cuda init, so its time does not get accounted in timeout
// wait for cuda init, so its time does not get accounted in timeout
...
...
test/src/helper.cpp
浏览文件 @
a3550f91
...
@@ -327,6 +327,13 @@ bool mgb::check_gpu_available(size_t num) {
...
@@ -327,6 +327,13 @@ bool mgb::check_gpu_available(size_t num) {
return
true
;
return
true
;
}
}
bool
mgb
::
check_amd_gpu_available
(
size_t
num
)
{
if
(
CompNode
::
get_device_count
(
CompNode
::
DeviceType
::
ROCM
)
<
num
)
{
mgb_log_warn
(
"skip test case that requires %zu AMD GPU(s)"
,
num
);
return
false
;
}
return
true
;
}
bool
mgb
::
check_cambricon_device_available
(
size_t
num
)
{
bool
mgb
::
check_cambricon_device_available
(
size_t
num
)
{
if
(
CompNode
::
get_device_count
(
CompNode
::
DeviceType
::
CAMBRICON
)
<
num
)
{
if
(
CompNode
::
get_device_count
(
CompNode
::
DeviceType
::
CAMBRICON
)
<
num
)
{
...
...
test/src/include/megbrain/test/helper.h
浏览文件 @
a3550f91
...
@@ -460,6 +460,8 @@ std::vector<CompNode> load_multiple_xpus(size_t num);
...
@@ -460,6 +460,8 @@ std::vector<CompNode> load_multiple_xpus(size_t num);
//! check whether given number of GPUs is available
//! check whether given number of GPUs is available
bool
check_gpu_available
(
size_t
num
);
bool
check_gpu_available
(
size_t
num
);
//! check whether given number of AMD GPUs is available
bool
check_amd_gpu_available
(
size_t
num
);
//! check whether given number of cambricon devices is available
//! check whether given number of cambricon devices is available
bool
check_cambricon_device_available
(
size_t
num
);
bool
check_cambricon_device_available
(
size_t
num
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录