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
ae70a47c
Commit
ae70a47c
authored
Feb 08, 2019
by
Paul
Browse files
Add dry run test
parent
009cf895
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
0 deletions
+15
-0
src/include/migraphx/program.hpp
src/include/migraphx/program.hpp
+2
-0
src/program.cpp
src/program.cpp
+6
-0
test/gpu/miopen.cpp
test/gpu/miopen.cpp
+7
-0
No files found.
src/include/migraphx/program.hpp
View file @
ae70a47c
...
@@ -105,6 +105,8 @@ struct program
...
@@ -105,6 +105,8 @@ struct program
void
debug_print
(
instruction_ref
ins
)
const
;
void
debug_print
(
instruction_ref
ins
)
const
;
void
debug_print
(
const
std
::
vector
<
instruction_ref
>&
inss
)
const
;
void
debug_print
(
const
std
::
vector
<
instruction_ref
>&
inss
)
const
;
void
dry_run
(
parameter_map
params
)
const
;
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
program
&
p
);
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
program
&
p
);
friend
bool
operator
==
(
const
program
&
x
,
const
program
&
y
);
friend
bool
operator
==
(
const
program
&
x
,
const
program
&
y
);
friend
bool
operator
!=
(
const
program
&
x
,
const
program
&
y
)
{
return
!
(
x
==
y
);
}
friend
bool
operator
!=
(
const
program
&
x
,
const
program
&
y
)
{
return
!
(
x
==
y
);
}
...
...
src/program.cpp
View file @
ae70a47c
...
@@ -511,6 +511,12 @@ void program::debug_print(const std::vector<instruction_ref>& inss) const
...
@@ -511,6 +511,12 @@ void program::debug_print(const std::vector<instruction_ref>& inss) const
std
::
cout
<<
std
::
endl
;
std
::
cout
<<
std
::
endl
;
}
}
void
program
::
dry_run
(
std
::
unordered_map
<
std
::
string
,
argument
>
params
)
const
{
auto
&
ctx
=
this
->
impl
->
ctx
;
generic_eval
(
*
this
,
ctx
,
params
,
[](
auto
&&
...)
{
return
argument
{};
});
}
bool
operator
==
(
const
program
&
x
,
const
program
&
y
)
{
return
to_string
(
x
)
==
to_string
(
y
);
}
bool
operator
==
(
const
program
&
x
,
const
program
&
y
)
{
return
to_string
(
x
)
==
to_string
(
y
);
}
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
program
&
p
)
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
program
&
p
)
...
...
test/gpu/miopen.cpp
View file @
ae70a47c
...
@@ -122,7 +122,14 @@ migraphx::argument run_gpu(migraphx::program& p)
...
@@ -122,7 +122,14 @@ migraphx::argument run_gpu(migraphx::program& p)
m
[
x
.
first
]
=
m
[
x
.
first
]
=
migraphx
::
gpu
::
to_gpu
(
migraphx
::
generate_argument
(
x
.
second
,
get_hash
(
x
.
first
)));
migraphx
::
gpu
::
to_gpu
(
migraphx
::
generate_argument
(
x
.
second
,
get_hash
(
x
.
first
)));
}
}
// Program should have an output parameter
EXPECT
(
bool
{
m
.
find
(
"output"
)
!=
m
.
end
()});
EXPECT
(
bool
{
m
.
find
(
"output"
)
!=
m
.
end
()});
// Ensure the program doesn't modify the context in a dry run
auto
ctx
=
p
.
get_context
();
assert
(
&
ctx
!=
&
p
.
get_context
());
EXPECT
(
is_shared
(
ctx
,
p
.
get_context
()));
p
.
dry_run
(
m
);
EXPECT
(
is_shared
(
ctx
,
p
.
get_context
()));
return
migraphx
::
gpu
::
from_gpu
(
p
.
eval
(
m
));
return
migraphx
::
gpu
::
from_gpu
(
p
.
eval
(
m
));
}
}
...
...
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