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
d7c4602a
Commit
d7c4602a
authored
Apr 30, 2019
by
Paul
Browse files
Only call can_eval once
parent
5387920b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
src/include/migraphx/instruction.hpp
src/include/migraphx/instruction.hpp
+1
-1
src/instruction.cpp
src/instruction.cpp
+5
-3
No files found.
src/include/migraphx/instruction.hpp
View file @
d7c4602a
...
@@ -74,7 +74,7 @@ struct instruction
...
@@ -74,7 +74,7 @@ struct instruction
bool
can_eval
()
const
;
bool
can_eval
()
const
;
argument
eval
()
const
;
argument
eval
(
bool
check_eval
=
true
)
const
;
void
finalize
(
context
&
ctx
);
void
finalize
(
context
&
ctx
);
...
...
src/instruction.cpp
View file @
d7c4602a
...
@@ -179,19 +179,21 @@ bool instruction::can_eval() const
...
@@ -179,19 +179,21 @@ bool instruction::can_eval() const
}
}
}
}
argument
instruction
::
eval
()
const
argument
instruction
::
eval
(
bool
check_eval
)
const
{
{
if
(
op
.
name
()
==
"@literal"
)
if
(
op
.
name
()
==
"@literal"
)
{
{
return
this
->
get_literal
().
get_argument
();
return
this
->
get_literal
().
get_argument
();
}
}
if
(
is_context_free
(
op
)
and
this
->
can_eval
()
)
if
(
is_context_free
(
op
))
{
{
if
(
check_eval
and
not
this
->
can_eval
())
return
{};
std
::
vector
<
argument
>
args
;
std
::
vector
<
argument
>
args
;
std
::
transform
(
this
->
inputs
().
begin
(),
std
::
transform
(
this
->
inputs
().
begin
(),
this
->
inputs
().
end
(),
this
->
inputs
().
end
(),
std
::
back_inserter
(
args
),
std
::
back_inserter
(
args
),
[](
auto
arg
)
{
return
arg
->
eval
();
});
[](
auto
arg
)
{
return
arg
->
eval
(
false
);
});
return
op
.
compute
(
result
,
args
);
return
op
.
compute
(
result
,
args
);
}
}
return
{};
return
{};
...
...
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