Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MegEngine 天元
MegEngine
提交
fc8d13cd
MegEngine
项目概览
MegEngine 天元
/
MegEngine
大约 1 年 前同步成功
通知
395
Star
4704
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
fc8d13cd
编写于
2月 01, 2021
作者:
M
Megvii Engine Team
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(build): fix linkage on ubuntu1604
GitOrigin-RevId: ee2a8360b02b26f94f9ca32dbecc342d62c76669
上级
c51a687c
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
20 addition
and
20 deletion
+20
-20
imperative/src/impl/interpreter/commands.h
imperative/src/impl/interpreter/commands.h
+1
-1
imperative/src/impl/interpreter/interpreter_impl.cpp
imperative/src/impl/interpreter/interpreter_impl.cpp
+4
-4
imperative/src/impl/interpreter/profiler.cpp
imperative/src/impl/interpreter/profiler.cpp
+7
-7
imperative/src/include/megbrain/imperative/profiler.h
imperative/src/include/megbrain/imperative/profiler.h
+8
-8
未找到文件。
imperative/src/impl/interpreter/commands.h
浏览文件 @
fc8d13cd
...
...
@@ -213,7 +213,7 @@ using IdentifiedCommand = std::pair<uint64_t, Command>;
template
<
>
struct
ToStringTrait
<
interpreter
::
intl
::
Command
>
{
std
::
string
operator
()(
const
interpreter
::
intl
::
Command
&
cmd
)
const
{
return
std
::
visit
([](
auto
&
cmd
){
return
std
::
visit
([](
const
auto
&
cmd
){
std
::
string
result
=
cmd
.
get_name
();
result
+=
"{"
;
cmd
.
get_props
([
&
](
const
char
*
key
,
auto
&&
value
)
{
...
...
imperative/src/impl/interpreter/interpreter_impl.cpp
浏览文件 @
fc8d13cd
...
...
@@ -481,8 +481,8 @@ void ChannelImpl::process_one_task(IdentifiedCommand& icmd) {
finished
=
true
;
};
//TODO: remove std::visit for support osx 10.12
auto
cmd_visitor
=
[
&
](
auto
&
cmd
)
{
using
T
=
std
::
remove_reference
_t
<
decltype
(
cmd
)
>
;
auto
cmd_visitor
=
[
&
](
const
auto
&
cmd
)
{
using
T
=
std
::
decay
_t
<
decltype
(
cmd
)
>
;
if
constexpr
(
std
::
is_same_v
<
T
,
Put
>
)
{
auto
value
=
cmd
.
no_cache
?
std
::
make_shared
<
Tensor
>
(
cmd
.
value
)
:
Tensor
::
make
(
cmd
.
value
);
produce_tensor
(
cmd
.
dest
,
std
::
move
(
value
));
...
...
@@ -598,10 +598,10 @@ void ChannelImpl::process_one_task(IdentifiedCommand& icmd) {
do_finish_command
();
m_worker_state
.
profiler
->
record_host
<
WorkerEndScope
>
(
cmd
.
scope_name
);
}
else
{
static_assert
(
std
::
is_same_v
<
T
,
T
>
);
static_assert
(
!
std
::
is_same_v
<
T
,
T
>
);
}
};
std
::
visit
([
&
](
auto
&
cmd
){
std
::
visit
([
&
](
const
auto
&
cmd
){
using
T
=
std
::
decay_t
<
decltype
(
cmd
)
>
;
if
(
!
m_worker_state
.
options
.
catch_worker_execption
)
{
cmd_visitor
(
cmd
);
...
...
imperative/src/impl/interpreter/profiler.cpp
浏览文件 @
fc8d13cd
...
...
@@ -97,7 +97,7 @@ struct InterpreterProfilerDumpChromeTimelineContext {
};
// convert Command to json object. Has to be an callable object
static
auto
constexpr
cmd_to_args
=
[](
auto
&
&
cmd
)
{
static
auto
constexpr
cmd_to_args
=
[](
const
auto
&
cmd
)
{
auto
args
=
json
::
Object
::
make
();
cmd
.
get_props
([
&
](
const
char
*
key
,
auto
&&
value
){
(
*
args
)[
key
]
=
json
::
String
::
make
(
to_string
(
value
));
...
...
@@ -108,14 +108,14 @@ struct InterpreterProfilerDumpChromeTimelineContext {
void
process
()
{
// enumerate and process each record
for
(
auto
&
&
record
:
profile_data
.
records
)
{
std
::
visit
([
this
](
auto
&
record
){
for
(
auto
&
record
:
profile_data
.
records
)
{
std
::
visit
([
this
](
const
auto
&
record
){
using
TEvent
=
std
::
decay_t
<
decltype
(
record
.
data
)
>
;
Session
<
TEvent
>
(
*
this
,
record
).
process
();
},
record
);
}
for
(
size_t
tid
=
0
;
tid
<
thread_list
.
size
();
++
tid
)
{
auto
tname
=
std
::
visit
([
&
](
auto
&
host_or_device
)
->
std
::
string
{
auto
tname
=
std
::
visit
([
&
](
auto
host_or_device
)
->
std
::
string
{
using
T
=
std
::
decay_t
<
decltype
(
host_or_device
)
>
;
if
constexpr
(
std
::
is_same_v
<
T
,
std
::
thread
::
id
>
)
{
// take name from host_map
...
...
@@ -142,11 +142,11 @@ struct InterpreterProfilerDumpChromeTimelineContext {
template
<
typename
TEvent
>
struct
Session
{
InterpreterProfilerDumpChromeTimelineContext
&
ctx
;
ProfilerBase
::
EventRecord
<
TEvent
>&
record
;
TEvent
&
data
;
const
ProfilerBase
::
EventRecord
<
TEvent
>&
record
;
const
TEvent
&
data
;
Session
(
InterpreterProfilerDumpChromeTimelineContext
&
ctx
,
ProfilerBase
::
EventRecord
<
TEvent
>&
record
)
const
ProfilerBase
::
EventRecord
<
TEvent
>&
record
)
:
ctx
{
ctx
},
record
{
record
},
data
{
record
.
data
}
{}
uint64_t
get_host_tid
()
{
...
...
imperative/src/include/megbrain/imperative/profiler.h
浏览文件 @
fc8d13cd
...
...
@@ -57,7 +57,7 @@ public:
Host
tid
;
double
time
;
void
wait
()
{}
void
wait
()
const
{}
};
struct
DeviceInstant
{
...
...
@@ -65,7 +65,7 @@ public:
std
::
shared_ptr
<
CompNode
::
Event
>
event
;
double
after
;
void
wait
()
{
void
wait
()
const
{
event
->
host_wait
();
}
};
...
...
@@ -77,16 +77,16 @@ public:
Instant
instant
;
TEvent
data
;
HostInstant
&
host
()
{
const
HostInstant
&
host
()
const
{
return
std
::
get
<
HostInstant
>
(
instant
);
}
DeviceInstant
device
()
{
const
DeviceInstant
&
device
()
const
{
return
std
::
get
<
DeviceInstant
>
(
instant
);
}
void
wait
()
{
std
::
visit
([
&
](
auto
&
instant
){
instant
.
wait
();
},
instant
);
void
wait
()
const
{
std
::
visit
([
&
](
const
auto
&
instant
){
instant
.
wait
();
},
instant
);
}
};
protected:
...
...
@@ -173,7 +173,7 @@ public:
mgb_assert
(
m_status
==
Profiling
,
"profiler not active"
);
m_status
=
Stopped
;
for
(
auto
&&
record
:
m_record_list
)
{
std
::
visit
([
&
](
auto
&
record
){
std
::
visit
([
&
](
const
auto
&
record
){
record
.
wait
();
},
record
);
}
...
...
@@ -312,7 +312,7 @@ public:
return
m_content
.
back
();
}
std
::
shared_ptr
<
json
::
Array
>
to_json
()
{
std
::
shared_ptr
<
json
::
Array
>
to_json
()
const
{
auto
result
=
json
::
Array
::
make
();
for
(
auto
&&
event
:
m_content
)
{
result
->
add
(
event
.
to_json
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录