Unverified Commit a32b1bc6 authored by Po Yen Chen's avatar Po Yen Chen Committed by GitHub
Browse files

Replace hipDeviceSynchronize() by hipStreamSynchronize(stream) calls (#1359)

parent 0cb2e06d
...@@ -27,7 +27,7 @@ struct gpu_timer ...@@ -27,7 +27,7 @@ struct gpu_timer
CK_TILE_HOST void start(const hipStream_t& s) CK_TILE_HOST void start(const hipStream_t& s)
{ {
HIP_CHECK_ERROR(hipDeviceSynchronize()); HIP_CHECK_ERROR(hipStreamSynchronize(s));
HIP_CHECK_ERROR(hipEventRecord(start_evt, s)); HIP_CHECK_ERROR(hipEventRecord(start_evt, s));
} }
...@@ -51,15 +51,15 @@ struct gpu_timer ...@@ -51,15 +51,15 @@ struct gpu_timer
struct cpu_timer struct cpu_timer
{ {
// torch.utils.benchmark.Timer(), there is a sync inside each timer callback // torch.utils.benchmark.Timer(), there is a sync inside each timer callback
CK_TILE_HOST void start(const hipStream_t&) CK_TILE_HOST void start(const hipStream_t& s)
{ {
HIP_CHECK_ERROR(hipDeviceSynchronize()); HIP_CHECK_ERROR(hipStreamSynchronize(s));
start_tick = std::chrono::high_resolution_clock::now(); start_tick = std::chrono::high_resolution_clock::now();
} }
// torch.utils.benchmark.Timer(), there is a sync inside each timer callback // torch.utils.benchmark.Timer(), there is a sync inside each timer callback
CK_TILE_HOST void stop(const hipStream_t&) CK_TILE_HOST void stop(const hipStream_t& s)
{ {
HIP_CHECK_ERROR(hipDeviceSynchronize()); HIP_CHECK_ERROR(hipStreamSynchronize(s));
stop_tick = std::chrono::high_resolution_clock::now(); stop_tick = std::chrono::high_resolution_clock::now();
} }
// return in ms // return in ms
......
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