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
088dc5eb
Commit
088dc5eb
authored
Oct 26, 2018
by
Paul
Browse files
Add sync for allocate and write to gpu
parent
966d45df
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
1 deletion
+7
-1
src/targets/gpu/hip.cpp
src/targets/gpu/hip.cpp
+3
-0
test/CMakeLists.txt
test/CMakeLists.txt
+4
-1
No files found.
src/targets/gpu/hip.cpp
View file @
088dc5eb
...
...
@@ -35,6 +35,7 @@ hip_ptr allocate_gpu(std::size_t sz, bool host = false)
else
allocate_gpu
(
sz
,
true
);
}
gpu_sync
();
return
hip_ptr
{
result
};
}
...
...
@@ -60,10 +61,12 @@ std::vector<T> read_from_gpu(const void* x, std::size_t sz)
hip_ptr
write_to_gpu
(
const
void
*
x
,
std
::
size_t
sz
,
bool
host
=
false
)
{
gpu_sync
();
auto
result
=
allocate_gpu
(
sz
,
host
);
auto
status
=
hipMemcpy
(
result
.
get
(),
x
,
sz
,
hipMemcpyHostToDevice
);
if
(
status
!=
hipSuccess
)
MIGRAPH_THROW
(
"Copy to gpu failed: "
+
hip_error
(
status
));
gpu_sync
();
return
result
;
}
...
...
test/CMakeLists.txt
View file @
088dc5eb
...
...
@@ -103,7 +103,10 @@ if(MIGRAPH_ENABLE_GPU)
get_filename_component
(
BASE_NAME
${
TEST
}
NAME_WE
)
add_test_executable
(
test_gpu_
${
BASE_NAME
}
${
TEST
}
)
rocm_clang_tidy_check
(
test_gpu_
${
BASE_NAME
}
)
set_tests_properties
(
test_gpu_
${
BASE_NAME
}
PROPERTIES COST 10
)
set_tests_properties
(
test_gpu_
${
BASE_NAME
}
PROPERTIES
COST 10
RESOURCE_LOCK gpu
)
target_link_libraries
(
test_gpu_
${
BASE_NAME
}
migraph_gpu
)
endforeach
()
endif
()
...
...
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