Commit 088dc5eb authored by Paul's avatar Paul
Browse files

Add sync for allocate and write to gpu

parent 966d45df
......@@ -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;
}
......
......@@ -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()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment