Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
3c45174a
Commit
3c45174a
authored
Feb 08, 2019
by
Paul
Browse files
Check context during debug
parent
9a419232
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
5 deletions
+18
-5
src/program.cpp
src/program.cpp
+18
-5
No files found.
src/program.cpp
View file @
3c45174a
...
@@ -379,20 +379,33 @@ argument generic_eval(const program& p,
...
@@ -379,20 +379,33 @@ argument generic_eval(const program& p,
argument
program
::
eval
(
std
::
unordered_map
<
std
::
string
,
argument
>
params
)
const
argument
program
::
eval
(
std
::
unordered_map
<
std
::
string
,
argument
>
params
)
const
{
{
auto
&
ctx
=
this
->
impl
->
ctx
;
#ifndef NDEBUG
auto
sctx
=
ctx
;
auto
check_context
=
[
&
](
auto
f
)
{
assert
(
is_shared
(
ctx
,
sctx
));
auto
x
=
f
();
sctx
=
ctx
;
return
x
;
};
#else
auto
check_context
=
[](
auto
f
)
{
return
f
();
};
#endif
if
(
enabled
(
MIGRAPHX_TRACE_EVAL
{}))
if
(
enabled
(
MIGRAPHX_TRACE_EVAL
{}))
{
{
auto
&
ctx
=
this
->
impl
->
ctx
;
return
generic_eval
(
*
this
,
ctx
,
std
::
move
(
params
),
[
&
](
auto
&
ins
,
auto
f
)
{
return
generic_eval
(
*
this
,
this
->
impl
->
ctx
,
std
::
move
(
params
),
[
&
](
auto
&
ins
,
auto
f
)
{
ctx
.
finish
();
ctx
.
finish
();
std
::
cout
<<
"Run instruction: "
;
std
::
cout
<<
"Run instruction: "
;
this
->
debug_print
(
ins
);
this
->
debug_print
(
ins
);
return
f
(
);
return
check_context
(
f
);
});
});
}
}
else
else
{
{
return
generic_eval
(
return
generic_eval
(
*
this
,
this
->
impl
->
ctx
,
std
::
move
(
params
),
[](
auto
&
,
auto
f
)
{
return
f
(
);
});
*
this
,
ctx
,
std
::
move
(
params
),
[
&
](
auto
&
,
auto
f
)
{
return
check_context
(
f
);
});
}
}
}
}
...
@@ -447,7 +460,7 @@ void program::perf_report(std::ostream& os, std::size_t n, parameter_map params)
...
@@ -447,7 +460,7 @@ void program::perf_report(std::ostream& os, std::size_t n, parameter_map params)
for
(
std
::
size_t
i
=
0
;
i
<
n
;
i
++
)
for
(
std
::
size_t
i
=
0
;
i
<
n
;
i
++
)
{
{
overhead_vec
.
push_back
(
time
<
milliseconds
>
(
overhead_vec
.
push_back
(
time
<
milliseconds
>
(
[
&
]
{
generic_eval
(
*
this
,
ctx
,
params
,
[](
auto
...)
{
return
argument
{};
}
);
}));
[
&
]
{
dry_run
(
params
);
}));
}
}
double
total_time
=
common_average
(
total_vec
);
double
total_time
=
common_average
(
total_vec
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment