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
a4bb0fdb
"git@developer.sourcefind.cn:gaoqiong/migraphx.git" did not exist on "c570fb57d4732725b9147e645f51d709bd64ce5a"
Commit
a4bb0fdb
authored
Aug 19, 2018
by
Paul
Browse files
Add a device sync at the end
parent
8f08e754
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
0 deletions
+25
-0
src/targets/gpu/hip.cpp
src/targets/gpu/hip.cpp
+5
-0
src/targets/gpu/include/migraph/gpu/hip.hpp
src/targets/gpu/include/migraph/gpu/hip.hpp
+19
-0
src/targets/gpu/lowering.cpp
src/targets/gpu/lowering.cpp
+1
-0
No files found.
src/targets/gpu/hip.cpp
View file @
a4bb0fdb
...
...
@@ -88,6 +88,11 @@ argument from_gpu(argument arg)
return
result
;
}
void
gpu_sync
()
{
hipDeviceSynchronize
();
}
}
// namespace gpu
}
// namespace migraph
src/targets/gpu/include/migraph/gpu/hip.hpp
View file @
a4bb0fdb
...
...
@@ -13,6 +13,8 @@ migraph::argument to_gpu(migraph::argument arg, bool host = false);
migraph
::
argument
from_gpu
(
migraph
::
argument
arg
);
void
gpu_sync
();
struct
hip_allocate
{
std
::
string
tag
{};
...
...
@@ -44,6 +46,23 @@ struct hip_load
}
};
struct
hip_sync
{
std
::
string
tag
{};
std
::
string
name
()
const
{
return
"hip::sync"
;
}
shape
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
{
if
(
inputs
.
empty
())
return
{};
else
return
inputs
.
front
();
}
argument
compute
(
context
&
,
const
shape
&
,
const
std
::
vector
<
argument
>&
args
)
const
{
gpu_sync
();
if
(
args
.
empty
())
return
{};
else
return
args
.
front
();
}
};
struct
hip_write
{
std
::
string
name
()
const
{
return
"hip::write"
;
}
...
...
src/targets/gpu/lowering.cpp
View file @
a4bb0fdb
...
...
@@ -330,6 +330,7 @@ struct miopen_apply
check_shape
(
s
,
apply_batch_norm_inference
(
it
));
}
}
prog
->
insert_instruction
(
prog
->
end
(),
hip_sync
{},
std
::
prev
(
prog
->
end
()));
}
instruction_ref
insert_allocation
(
instruction_ref
ins
,
const
shape
&
s
,
std
::
string
tag
=
""
)
...
...
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