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
d3140314
Commit
d3140314
authored
Sep 19, 2018
by
mei-ye
Browse files
make separated literal coloring a default
parent
1bdd1762
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
15 deletions
+12
-15
src/opt/memory_coloring_impl.cpp
src/opt/memory_coloring_impl.cpp
+6
-9
src/opt/memory_coloring_impl.hpp
src/opt/memory_coloring_impl.hpp
+6
-2
src/targets/gpu/target.cpp
src/targets/gpu/target.cpp
+0
-1
src/targets/gpu/write_literals.cpp
src/targets/gpu/write_literals.cpp
+0
-3
No files found.
src/opt/memory_coloring_impl.cpp
View file @
d3140314
...
...
@@ -83,13 +83,6 @@ bool memory_coloring_impl::allocate(interval_ptr interval)
offset
+=
(
element_size
-
(
offset
%
element_size
));
conflict_queue
.
pop
();
}
#if 1
if
(
interval
->
get_end
()
==
latest_end_point
)
{
offset
=
required_bytes
;
if
((
offset
%
element_size
)
!=
0
)
offset
+=
(
element_size
-
(
offset
%
element_size
));
}
#endif
segment
.
offset
=
offset
;
MIGRAPH_DEBUG
(
segment
.
dump
());
required_bytes
=
std
::
max
(
required_bytes
,
offset
+
segment
.
size
);
...
...
@@ -124,6 +117,7 @@ void memory_coloring_impl::build()
live_range
&
range
=
def_interval
->
segment
;
def_interval
->
result
=
iter
->
result
;
def_interval
->
is_literal
=
is_lit
;
if
(
!
is_lit
||
unify_literals
)
alloc_queue
.
push
(
def_interval
);
range
.
begin
=
cur_points
;
def_interval
->
def_point
=
cur_points
;
...
...
@@ -172,7 +166,7 @@ void memory_coloring_impl::build()
live_set
.
insert
(
max_value_number
);
live_ranges
[
max_value_number
]
=
&
(
interval
->
segment
);
earliest_end_point
=
cur_points
;
if
(
latest_end_point
==
-
1
)
if
(
latest_end_point
==
-
1
)
latest_end_point
=
cur_points
;
}
else
...
...
@@ -219,6 +213,9 @@ void memory_coloring_impl::rewrite()
if
(
interval
->
get_begin
()
==
invalid_offset
)
continue
;
if
(
!
unify_literals
&&
interval
->
is_literal
)
continue
;
std
::
size_t
offset
=
0
;
if
(
interval
->
get_offset
()
==
invalid_offset
)
{
...
...
src/opt/memory_coloring_impl.hpp
View file @
d3140314
...
...
@@ -50,7 +50,8 @@ using interval_ptr = live_interval*;
struct
memory_coloring_impl
{
memory_coloring_impl
(
program
*
p
,
std
::
string
alloc_op
)
:
p_program
(
p
),
allocation_op
(
std
::
move
(
alloc_op
))
memory_coloring_impl
(
program
*
p
,
std
::
string
alloc_op
)
:
p_program
(
p
),
allocation_op
(
std
::
move
(
alloc_op
))
{
instr2_live
.
clear
();
live_ranges
.
clear
();
...
...
@@ -61,6 +62,7 @@ struct memory_coloring_impl
operand_alias
.
clear
();
earliest_end_point
=
-
1
;
latest_end_point
=
-
1
;
unify_literals
=
false
;
}
bool
allocate
(
interval_ptr
);
void
add_conflicts
(
std
::
set
<
int
>&
live_set
,
int
val
)
...
...
@@ -171,6 +173,8 @@ struct memory_coloring_impl
int
earliest_end_point
;
// The latest program point where an live interval ends.
int
latest_end_point
;
// Whether to unify literals into coloring.
bool
unify_literals
;
std
::
string
allocation_op
{};
};
}
// namespace migraph
...
...
src/targets/gpu/target.cpp
View file @
d3140314
...
...
@@ -30,7 +30,6 @@ std::vector<pass> target::get_passes(migraph::context& gctx) const
dead_code_elimination
{},
lowering
{
ctx
},
memory_coloring
{
"hip::allocate"
},
lowering_memory_coloring
{
&
ctx
},
fuse_ops
{},
dead_code_elimination
{},
eliminate_workspace
{},
...
...
src/targets/gpu/write_literals.cpp
View file @
d3140314
...
...
@@ -26,9 +26,6 @@ struct hip_load_literal
void
write_literals
::
apply
(
program
&
p
)
const
{
if
(
!
enabled
(
MIGRAPH_DISABLE_MEMORY_COLORING
{}))
return
;
assert
(
ctx
!=
nullptr
);
for
(
auto
ins
:
iterator_for
(
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