Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
6c649c7b
Commit
6c649c7b
authored
Sep 24, 2018
by
Paul
Browse files
Fix compile errors
parent
99ee76c0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
15 deletions
+15
-15
src/opt/memory_coloring_impl.cpp
src/opt/memory_coloring_impl.cpp
+5
-5
src/opt/memory_coloring_impl.hpp
src/opt/memory_coloring_impl.hpp
+8
-8
src/program.cpp
src/program.cpp
+2
-2
No files found.
src/opt/memory_coloring_impl.cpp
View file @
6c649c7b
...
@@ -115,13 +115,13 @@ void memory_coloring_impl::build()
...
@@ -115,13 +115,13 @@ void memory_coloring_impl::build()
if
(
is_allocate
(
iter
)
||
is_lit
)
if
(
is_allocate
(
iter
)
||
is_lit
)
{
{
live_range
&
range
=
def_interval
->
segment
;
live_range
&
range
=
def_interval
->
segment
;
def_interval
->
result
=
iter
->
result
;
def_interval
->
result
=
iter
->
get_shape
()
;
def_interval
->
is_literal
=
is_lit
;
def_interval
->
is_literal
=
is_lit
;
if
(
!
is_lit
||
unify_literals
)
if
(
!
is_lit
||
unify_literals
)
alloc_queue
.
push
(
def_interval
);
alloc_queue
.
push
(
def_interval
);
range
.
begin
=
cur_points
;
range
.
begin
=
cur_points
;
def_interval
->
def_point
=
cur_points
;
def_interval
->
def_point
=
cur_points
;
range
.
size
=
(
iter
->
result
).
bytes
();
range
.
size
=
(
iter
->
get_shape
()
).
bytes
();
live_set
.
erase
(
range
.
vn
);
live_set
.
erase
(
range
.
vn
);
}
}
}
}
...
@@ -131,7 +131,7 @@ void memory_coloring_impl::build()
...
@@ -131,7 +131,7 @@ void memory_coloring_impl::build()
}
}
int
tie_ndx
=
get_input_tie_ndx
(
iter
);
int
tie_ndx
=
get_input_tie_ndx
(
iter
);
int
cnt
=
-
1
;
int
cnt
=
-
1
;
for
(
auto
&&
arg
:
iter
->
arguments
)
for
(
auto
&&
arg
:
iter
->
inputs
()
)
{
{
cnt
++
;
cnt
++
;
if
(
is_param
(
arg
)
||
is_outline
(
arg
))
if
(
is_param
(
arg
)
||
is_outline
(
arg
))
...
@@ -228,9 +228,9 @@ void memory_coloring_impl::rewrite()
...
@@ -228,9 +228,9 @@ void memory_coloring_impl::rewrite()
if
(
is_allocate
(
ins
))
if
(
is_allocate
(
ins
))
{
{
if
(
!
ins
->
arguments
.
empty
())
if
(
!
ins
->
inputs
()
.
empty
())
p_program
->
replace_instruction
(
p_program
->
replace_instruction
(
ins
,
load
{
ins
->
arguments
.
at
(
0
)
->
result
,
offset
},
scratch_param
);
ins
,
load
{
ins
->
inputs
().
at
(
0
)
->
get_shape
()
,
offset
},
scratch_param
);
}
}
else
if
(
is_literal
(
ins
))
else
if
(
is_literal
(
ins
))
{
{
...
...
src/opt/memory_coloring_impl.hpp
View file @
6c649c7b
...
@@ -79,23 +79,23 @@ struct memory_coloring_impl
...
@@ -79,23 +79,23 @@ struct memory_coloring_impl
void
rewrite
();
void
rewrite
();
private:
private:
static
bool
is_param
(
const
instruction_ref
ins
)
{
return
ins
->
op
.
name
()
==
"@param"
;
}
static
bool
is_param
(
const
instruction_ref
ins
)
{
return
ins
->
name
()
==
"@param"
;
}
static
bool
is_output_param
(
const
instruction_ref
ins
)
static
bool
is_output_param
(
const
instruction_ref
ins
)
{
{
return
is_param
(
ins
)
&&
any_cast
<
builtin
::
param
>
(
ins
->
op
).
parameter
==
"output"
;
return
is_param
(
ins
)
&&
any_cast
<
builtin
::
param
>
(
ins
->
get_operator
()
).
parameter
==
"output"
;
}
}
bool
is_allocate
(
const
instruction_ref
ins
)
{
return
ins
->
op
.
name
()
==
allocation_op
;
}
bool
is_allocate
(
const
instruction_ref
ins
)
{
return
ins
->
name
()
==
allocation_op
;
}
static
bool
is_outline
(
const
instruction_ref
ins
)
{
return
ins
->
op
.
name
()
==
"@outline"
;
}
static
bool
is_outline
(
const
instruction_ref
ins
)
{
return
ins
->
name
()
==
"@outline"
;
}
static
bool
is_literal
(
const
instruction_ref
ins
)
{
return
ins
->
op
.
name
()
==
"@literal"
;
}
static
bool
is_literal
(
const
instruction_ref
ins
)
{
return
ins
->
name
()
==
"@literal"
;
}
static
bool
is_check_context
(
const
instruction_ref
ins
)
static
bool
is_check_context
(
const
instruction_ref
ins
)
{
{
return
ins
->
op
.
name
()
==
"check_context"
;
return
ins
->
name
()
==
"check_context"
;
}
}
// get operand alias info. This is a temporary workaround.
// get operand alias info. This is a temporary workaround.
int
get_input_tie_ndx
(
const
instruction_ref
ins
)
int
get_input_tie_ndx
(
const
instruction_ref
ins
)
{
{
std
::
string
name
=
ins
->
op
.
name
();
std
::
string
name
=
ins
->
name
();
if
(
operand_alias
.
find
(
name
)
!=
operand_alias
.
end
())
if
(
operand_alias
.
find
(
name
)
!=
operand_alias
.
end
())
return
operand_alias
[
name
];
return
operand_alias
[
name
];
if
(
is_allocate
(
ins
))
if
(
is_allocate
(
ins
))
...
@@ -106,7 +106,7 @@ struct memory_coloring_impl
...
@@ -106,7 +106,7 @@ struct memory_coloring_impl
}
}
int
cnt
=
-
1
;
int
cnt
=
-
1
;
int
last_allocate
=
-
1
;
int
last_allocate
=
-
1
;
for
(
auto
&&
arg
:
ins
->
arguments
)
for
(
auto
&&
arg
:
ins
->
inputs
()
)
{
{
cnt
++
;
cnt
++
;
if
(
is_allocate
(
arg
)
||
is_output_param
(
arg
))
if
(
is_allocate
(
arg
)
||
is_output_param
(
arg
))
...
...
src/program.cpp
View file @
6c649c7b
...
@@ -207,9 +207,9 @@ instruction_ref program::get_parameter(std::string name) const
...
@@ -207,9 +207,9 @@ instruction_ref program::get_parameter(std::string name) const
{
{
auto
ins
=
std
::
find_if
(
auto
ins
=
std
::
find_if
(
impl
->
instructions
.
begin
(),
impl
->
instructions
.
end
(),
[
&
](
const
instruction
&
x
)
{
impl
->
instructions
.
begin
(),
impl
->
instructions
.
end
(),
[
&
](
const
instruction
&
x
)
{
if
(
x
.
op
.
name
()
==
"@param"
)
if
(
x
.
name
()
==
"@param"
)
{
{
return
any_cast
<
builtin
::
param
>
(
x
.
op
).
parameter
==
name
;
return
any_cast
<
builtin
::
param
>
(
x
.
get_operator
()
).
parameter
==
name
;
}
}
else
else
{
{
...
...
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