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
20190861
Commit
20190861
authored
Apr 17, 2019
by
Shucai Xiao
Browse files
Merge branch 'develop' of
https://github.com/ROCmSoftwarePlatform/AMDMIGraphX
into ins_fp32_fp16
parents
fb51b2c5
369cb3a5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
70 additions
and
17 deletions
+70
-17
src/CMakeLists.txt
src/CMakeLists.txt
+1
-0
src/include/migraphx/pass_manager.hpp
src/include/migraphx/pass_manager.hpp
+25
-0
src/pass_manager.cpp
src/pass_manager.cpp
+42
-0
src/program.cpp
src/program.cpp
+2
-17
No files found.
src/CMakeLists.txt
View file @
20190861
...
@@ -21,6 +21,7 @@ add_library(migraphx
...
@@ -21,6 +21,7 @@ add_library(migraphx
quantize_ins.cpp
quantize_ins.cpp
shape.cpp
shape.cpp
schedule.cpp
schedule.cpp
pass_manager.cpp
simplify_algebra.cpp
simplify_algebra.cpp
simplify_reshapes.cpp
simplify_reshapes.cpp
opt/memory_coloring.cpp
opt/memory_coloring.cpp
...
...
src/include/migraphx/pass_manager.hpp
0 → 100644
View file @
20190861
#ifndef MIGRAPHX_GUARD_MIGRAPHLIB_PASS_MANAGER_HPP
#define MIGRAPHX_GUARD_MIGRAPHLIB_PASS_MANAGER_HPP
#include <list>
#include <unordered_map>
#include <migraphx/operation.hpp>
#include <migraphx/literal.hpp>
#include <migraphx/builtin.hpp>
#include <migraphx/instruction_ref.hpp>
#include <migraphx/target.hpp>
#include <migraphx/tracer.hpp>
#include <migraphx/env.hpp>
#include <migraphx/config.hpp>
#include <algorithm>
#include <iostream>
namespace
migraphx
{
inline
namespace
MIGRAPHX_INLINE_NS
{
void
run_passes
(
program
&
prog
,
const
std
::
vector
<
pass
>&
passes
,
tracer
trace
=
tracer
{});
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace migraphx
#endif
src/pass_manager.cpp
0 → 100644
View file @
20190861
#include <migraphx/program.hpp>
#include <migraphx/pass_manager.hpp>
#include <migraphx/stringutils.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/operators.hpp>
#include <migraphx/target.hpp>
#include <migraphx/env.hpp>
#include <migraphx/ranges.hpp>
#include <migraphx/time.hpp>
#include <migraphx/iterator_for.hpp>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <utility>
namespace
migraphx
{
inline
namespace
MIGRAPHX_INLINE_NS
{
void
run_passes
(
program
&
prog
,
const
std
::
vector
<
pass
>&
passes
,
tracer
trace
)
{
for
(
auto
&
p
:
passes
)
{
trace
(
"Pass: "
,
p
.
name
());
p
.
apply
(
prog
);
trace
(
prog
);
#ifndef NDEBUG
trace
(
"Validate ..."
);
auto
invalid
=
prog
.
validate
();
if
(
invalid
!=
prog
.
end
())
{
auto
index
=
std
::
distance
(
prog
.
begin
(),
invalid
);
MIGRAPHX_THROW
(
p
.
name
()
+
" pass produces invalid program at instruction "
+
std
::
to_string
(
index
)
+
": "
+
invalid
->
name
());
}
trace
();
#endif
}
}
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace migraphx
src/program.cpp
View file @
20190861
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
#include <migraphx/ranges.hpp>
#include <migraphx/ranges.hpp>
#include <migraphx/time.hpp>
#include <migraphx/time.hpp>
#include <migraphx/iterator_for.hpp>
#include <migraphx/iterator_for.hpp>
#include <migraphx/pass_manager.hpp>
#include <iostream>
#include <iostream>
#include <sstream>
#include <sstream>
#include <algorithm>
#include <algorithm>
...
@@ -291,23 +292,7 @@ void program::compile(const target& t, tracer trace)
...
@@ -291,23 +292,7 @@ void program::compile(const target& t, tracer trace)
trace
=
tracer
{
std
::
cout
};
trace
=
tracer
{
std
::
cout
};
trace
(
*
this
);
trace
(
*
this
);
trace
();
trace
();
for
(
auto
&&
p
:
t
.
get_passes
(
this
->
impl
->
ctx
))
run_passes
(
*
this
,
t
.
get_passes
(
this
->
impl
->
ctx
),
trace
);
{
trace
(
"Pass: "
,
p
.
name
());
p
.
apply
(
*
this
);
trace
(
*
this
);
#ifndef NDEBUG
trace
(
"Validate ..."
);
auto
invalid
=
this
->
validate
();
if
(
invalid
!=
impl
->
instructions
.
end
())
{
auto
index
=
std
::
distance
(
impl
->
instructions
.
begin
(),
invalid
);
MIGRAPHX_THROW
(
p
.
name
()
+
" pass produces invalid program at instruction "
+
std
::
to_string
(
index
)
+
": "
+
invalid
->
name
());
}
trace
();
#endif
}
auto
invalid
=
this
->
validate
();
auto
invalid
=
this
->
validate
();
if
(
invalid
!=
impl
->
instructions
.
end
())
if
(
invalid
!=
impl
->
instructions
.
end
())
{
{
...
...
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