Skip to content

Commit

Permalink
Client: don't use hipDeviceSynchronize for blocking CPU to get CPU timer
Browse files Browse the repository at this point in the history
  • Loading branch information
jichangjichang committed May 3, 2024
1 parent fde584b commit 69d6262
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
4 changes: 2 additions & 2 deletions clients/common/utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ double get_time_us_sync_device(void)
/*! \brief CPU Timer(in microsecond): synchronize with given queue/stream and return wall time */
double get_time_us_sync(hipStream_t stream)
{
if(hipDeviceSynchronize() != hipSuccess)
if(hipStreamSynchronize(stream) != hipSuccess)
{
hipblaslt_cerr << "Synchronizing device failed" << std::endl;
hipblaslt_cerr << "Synchronizing stream failed" << std::endl;
}

auto now = std::chrono::steady_clock::now();
Expand Down
9 changes: 0 additions & 9 deletions clients/include/testing_matmul.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2470,7 +2470,6 @@ void testing_matmul_with_bias(const Arguments& arg)
CHECK_HIP_ERROR(hipEventRecord(event_gpu_time_start, stream));
else
{
CHECK_HIP_ERROR(hipStreamSynchronize(stream));
flush_time_used = get_time_us_sync(stream);
}
for(int i = 0; i < flush_iter; i++)
Expand All @@ -2486,7 +2485,6 @@ void testing_matmul_with_bias(const Arguments& arg)
}
else
{
CHECK_HIP_ERROR(hipStreamSynchronize(stream));
flush_time_used = get_time_us_sync(stream) - flush_time_used;
}
flush_time_used /= flush_iter;
Expand All @@ -2513,7 +2511,6 @@ void testing_matmul_with_bias(const Arguments& arg)
CHECK_HIP_ERROR(hipEventRecord(event_gpu_time_start, stream));
else
{
CHECK_HIP_ERROR(hipStreamSynchronize(stream));
gpu_time_used = get_time_us_sync(stream);
}

Expand Down Expand Up @@ -2562,7 +2559,6 @@ void testing_matmul_with_bias(const Arguments& arg)
CHECK_HIP_ERROR(hipEventRecord(event_gpu_time_start, stream));
else
{
CHECK_HIP_ERROR(hipStreamSynchronize(stream));
gpu_time_used = get_time_us_sync(stream);
}
for(int i = 0; i < number_hot_calls; i++)
Expand Down Expand Up @@ -2608,7 +2604,6 @@ void testing_matmul_with_bias(const Arguments& arg)
}
else
{
CHECK_HIP_ERROR(hipStreamSynchronize(stream));
gpu_time_used = get_time_us_sync(stream) - gpu_time_used;
}
}
Expand Down Expand Up @@ -2645,7 +2640,6 @@ void testing_matmul_with_bias(const Arguments& arg)
CHECK_HIP_ERROR(hipEventRecord(event_gpu_time_start, stream));
else
{
CHECK_HIP_ERROR(hipStreamSynchronize(stream));
gpu_time_used = get_time_us_sync(stream);
}

Expand All @@ -2664,7 +2658,6 @@ void testing_matmul_with_bias(const Arguments& arg)
}
else
{
CHECK_HIP_ERROR(hipStreamSynchronize(stream));
gpu_time_used = get_time_us_sync(stream) - gpu_time_used;
}
}
Expand All @@ -2689,7 +2682,6 @@ void testing_matmul_with_bias(const Arguments& arg)
CHECK_HIP_ERROR(hipEventRecord(event_gpu_time_start, stream));
else
{
CHECK_HIP_ERROR(hipStreamSynchronize(stream));
gpu_time_used = get_time_us_sync(stream);
}

Expand All @@ -2707,7 +2699,6 @@ void testing_matmul_with_bias(const Arguments& arg)
}
else
{
CHECK_HIP_ERROR(hipStreamSynchronize(stream));
gpu_time_used = get_time_us_sync(stream) - gpu_time_used;
}
}
Expand Down

0 comments on commit 69d6262

Please sign in to comment.