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
f3a84348
Commit
f3a84348
authored
May 02, 2019
by
Paul
Browse files
Fix adjust gpu allocation test
parent
b3e9d8f8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
4 deletions
+15
-4
src/include/migraphx/instruction.hpp
src/include/migraphx/instruction.hpp
+2
-0
src/instruction.cpp
src/instruction.cpp
+6
-0
src/program.cpp
src/program.cpp
+6
-3
test/gpu/adjust_allocation.cpp
test/gpu/adjust_allocation.cpp
+1
-1
No files found.
src/include/migraphx/instruction.hpp
View file @
f3a84348
...
@@ -25,6 +25,8 @@ struct instruction
...
@@ -25,6 +25,8 @@ struct instruction
instruction
(
literal
l
);
instruction
(
literal
l
);
void
replace
(
const
shape
&
r
);
void
replace
(
const
shape
&
r
);
void
replace
(
const
operation
&
o
);
void
recompute_shape
();
void
recompute_shape
();
...
...
src/instruction.cpp
View file @
f3a84348
...
@@ -28,6 +28,12 @@ void instruction::replace(const shape& r)
...
@@ -28,6 +28,12 @@ void instruction::replace(const shape& r)
}
}
}
}
void
instruction
::
replace
(
const
operation
&
o
)
{
op
=
std
::
move
(
o
);
recompute_shape
();
}
void
instruction
::
recompute_shape
()
{
replace
(
compute_shape
(
op
,
arguments
));
}
void
instruction
::
recompute_shape
()
{
replace
(
compute_shape
(
op
,
arguments
));
}
void
instruction
::
clear_arguments
()
void
instruction
::
clear_arguments
()
...
...
src/program.cpp
View file @
f3a84348
...
@@ -63,11 +63,16 @@ static void print_program(const program& p, F print_func)
...
@@ -63,11 +63,16 @@ static void print_program(const program& p, F print_func)
for
(
auto
ins
:
iterator_for
(
p
))
for
(
auto
ins
:
iterator_for
(
p
))
{
{
std
::
string
var_name
=
"@"
+
std
::
to_string
(
count
)
;
std
::
string
var_name
;
if
(
ins
->
name
()
==
"@param"
)
if
(
ins
->
name
()
==
"@param"
)
{
{
var_name
=
any_cast
<
builtin
::
param
>
(
ins
->
get_operator
()).
parameter
;
var_name
=
any_cast
<
builtin
::
param
>
(
ins
->
get_operator
()).
parameter
;
}
}
else
{
var_name
=
"@"
+
std
::
to_string
(
count
);
count
++
;
}
names
.
emplace
(
ins
,
var_name
);
names
.
emplace
(
ins
,
var_name
);
// TODO: Use all_of
// TODO: Use all_of
...
@@ -78,8 +83,6 @@ static void print_program(const program& p, F print_func)
...
@@ -78,8 +83,6 @@ static void print_program(const program& p, F print_func)
}
}
print_func
(
ins
,
names
);
print_func
(
ins
,
names
);
count
++
;
}
}
}
}
...
...
test/gpu/adjust_allocation.cpp
View file @
f3a84348
...
@@ -56,7 +56,7 @@ TEST_CASE(tanh_shape)
...
@@ -56,7 +56,7 @@ TEST_CASE(tanh_shape)
if
(
ins
->
name
()
==
"hip::allocate"
)
if
(
ins
->
name
()
==
"hip::allocate"
)
{
{
migraphx
::
shape
wrong_s
{
migraphx
::
shape
::
float_type
,
{
3
,
2
},
{
1
,
3
}};
migraphx
::
shape
wrong_s
{
migraphx
::
shape
::
float_type
,
{
3
,
2
},
{
1
,
3
}};
ins
->
replace
(
wrong_s
);
ins
->
replace
(
migraphx
::
gpu
::
hip_allocate
{
wrong_s
}
);
}
}
}
}
EXPECT
(
p1
!=
p2
);
EXPECT
(
p1
!=
p2
);
...
...
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