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
2e01a4fc
Commit
2e01a4fc
authored
Aug 08, 2018
by
mei-ye
Browse files
staging
parent
dd33a45f
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
50 additions
and
7 deletions
+50
-7
src/CMakeLists.txt
src/CMakeLists.txt
+1
-1
src/include/migraph/program.hpp
src/include/migraph/program.hpp
+2
-0
src/opt/common_header.hpp
src/opt/common_header.hpp
+7
-0
src/opt/memory_coloring.cpp
src/opt/memory_coloring.cpp
+9
-0
src/opt/memory_coloring.hpp
src/opt/memory_coloring.hpp
+14
-0
src/opt/optimize.cpp
src/opt/optimize.cpp
+12
-6
src/program.cpp
src/program.cpp
+5
-0
No files found.
src/CMakeLists.txt
View file @
2e01a4fc
...
...
@@ -4,8 +4,8 @@ add_library(migraph
generate.cpp
program.cpp
shape.cpp
opt/dfs.cpp
opt/optimize.cpp
opt/memory_coloring.cpp
)
rocm_clang_tidy_check
(
migraph
)
target_include_directories
(
migraph PUBLIC $<BUILD_INTERFACE:
${
CMAKE_CURRENT_SOURCE_DIR
}
/include>
)
...
...
src/include/migraph/program.hpp
View file @
2e01a4fc
...
...
@@ -82,6 +82,8 @@ struct program
void
compile
(
const
target
&
t
);
int
get_size
()
const
;
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
)
{
return
!
(
x
==
y
);
}
...
...
src/opt/common_header.hpp
0 → 100644
View file @
2e01a4fc
#ifndef MIGRAPH_GUARD_RTGLIB_COMMON_HEADER_HPP
#define MIGRAPH_GUARD_RTGLIB_COMMON_HEADER_HPP
#include <migraph/program.hpp>
#include <migraph/instruction.hpp>
#include <migraph/operators.hpp>
#include <migraph/iterator_for.hpp>
#endif
src/opt/memory_coloring.cpp
0 → 100644
View file @
2e01a4fc
#include "memory_coloring.hpp"
namespace
migraph
{
void
memory_coloring
::
run
()
{
}
}
// namespsace migraph
src/opt/memory_coloring.hpp
0 → 100644
View file @
2e01a4fc
#ifndef MIGRAPH_GUARD_RTGLIB_MEMORY_COLORING_HPP
#define MIGRAPH_GUARD_RTGLIB_MEMORY_COLORING_HPP
#include "common_header.hpp"
namespace
migraph
{
struct
memory_coloring
{
explicit
memory_coloring
(
program
*
p
)
:
p_program
(
p
)
{}
void
run
();
private:
program
*
p_program
;
};
}
// namespace migraph
#endif
src/opt/optimize.cpp
View file @
2e01a4fc
#include <migraph/optimize.hpp>
#include <migraph/program.hpp>
#include <migraph/instruction.hpp>
#include <migraph/operators.hpp>
#include <migraph/iterator_for.hpp>
#include "memory_coloring.hpp"
namespace
migraph
{
void
optimize
::
apply
(
program
&
p
)
const
{
std
::
cout
<<
p
<<
std
::
endl
;
for
(
auto
ins
:
iterator_for
(
p
))
{
memory_coloring
opt
(
&
p
);
opt
.
run
();
int
ins_enum
=
p
.
get_size
();
if
(
ins_enum
==
0
)
return
;
instruction_ref
iter_ins
=
std
::
prev
(
p
.
end
());
instruction_ref
first_ins
=
p
.
begin
();
do
{
iter_ins
=
std
::
prev
(
iter_ins
);
}
}
while
(
iter_ins
!=
first_ins
);
}
}
// namespace migraph
src/program.cpp
View file @
2e01a4fc
...
...
@@ -191,6 +191,11 @@ argument program::eval(std::unordered_map<std::string, argument> params) const
return
result
;
}
int
program
::
get_size
()
const
{
return
(
*
impl
).
instructions
.
size
();
}
bool
operator
==
(
const
program
&
x
,
const
program
&
y
)
{
return
to_string
(
x
)
==
to_string
(
y
);
}
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
program
&
p
)
...
...
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