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
686b9ea9
"vscode:/vscode.git/clone" did not exist on "1278c439bdba0c2c86dd7601c616e2285c3e873f"
Commit
686b9ea9
authored
Aug 16, 2018
by
mei-ye
Browse files
coloring
parent
e747cf2e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
7 deletions
+24
-7
src/opt/memory_coloring_impl.cpp
src/opt/memory_coloring_impl.cpp
+15
-2
src/opt/memory_coloring_impl.hpp
src/opt/memory_coloring_impl.hpp
+9
-5
No files found.
src/opt/memory_coloring_impl.cpp
View file @
686b9ea9
...
...
@@ -49,6 +49,7 @@ bool memory_coloring_impl::allocate(T_live_interval* interval)
conflict_queue
.
pop
();
}
segment
.
offset
=
offset
;
DEBUG
(
segment
.
dump
());
return
true
;
}
...
...
@@ -158,11 +159,22 @@ void memory_coloring_impl::dump()
}
#define GET_INS_ENUM(x) (((x) >> 1) - 1)
void
live_range
::
dump
()
{
std
::
cout
<<
" segment:"
<<
vn
;
std
::
cout
<<
" ["
<<
GET_INS_ENUM
(
begin
)
<<
", "
<<
GET_INS_ENUM
(
end
)
<<
"]"
;
if
(
offset
!=
-
1
)
{
std
::
cout
<<
" mem:"
;
std
::
cout
<<
" ["
<<
offset
<<
","
<<
offset
+
size
<<
"]"
;
}
std
::
cout
<<
std
::
endl
;
}
void
live_interval
::
dump
()
{
std
::
cout
<<
"id:"
<<
id
;
std
::
cout
<<
" segment:"
<<
segment
.
vn
;
std
::
cout
<<
" ["
<<
GET_INS_ENUM
(
segment
.
begin
)
<<
", "
<<
GET_INS_ENUM
(
segment
.
end
)
<<
"]"
;
segment
.
dump
();
std
::
cout
<<
" uses:"
;
for
(
auto
iter
=
use_points
.
begin
(),
end
=
use_points
.
end
();
iter
!=
end
;
++
iter
)
{
int
&
use
=
*
iter
;
...
...
@@ -181,6 +193,7 @@ void live_interval::dump()
std
::
cout
<<
" "
<<
result
;
std
::
cout
<<
std
::
endl
;
}
#endif
}
// namespace migraph
src/opt/memory_coloring_impl.hpp
View file @
686b9ea9
...
...
@@ -10,6 +10,9 @@ typedef struct live_range {
int
offset
;
// offset to base pointer of allocated memory trunk.
int
vn
;
// value number that identifies this live_range.
int
size
;
// size of required memory in bytes
#ifdef DEBUG_OPT
void
dump
();
#endif
}
T_live_range
;
typedef
struct
live_interval
{
...
...
@@ -77,13 +80,14 @@ struct memory_coloring_impl {
{
int
len1
=
I1
->
get_end
()
-
I1
->
get_begin
();
int
len2
=
I2
->
get_end
()
-
I2
->
get_begin
();
if
(
len1
<
len2
)
return
tru
e
;
else
if
(
I1
->
result
.
bytes
()
<
I2
->
result
.
bytes
())
return
tru
e
;
else
if
(
len1
!=
len2
)
{
return
(
len1
<
len2
)
?
true
:
fals
e
;
}
else
if
(
I1
->
result
.
bytes
()
!=
I2
->
result
.
bytes
())
{
return
(
I1
->
result
.
bytes
()
<
I2
->
result
.
bytes
())
?
true
:
fals
e
;
}
else
{
return
I1
->
id
>
I2
->
id
;
}
}
bool
operator
()
(
const
T_live_range
*
I1
,
const
T_live_range
*
I2
)
const
{
return
(
I1
->
offset
>
I2
->
offset
);
...
...
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