Skip to content

Commit 24d46d8

Browse files
mmoadelifabiomestre
authored andcommitted
[SYCL][CUDA][HIP] Block until the event is ready to start profiling. (#9938)
* Call to `hipEventElapsedTime` return `hipErrorNotReady` when the timestamp has not yet been `recorded` on one or both events. Calling `hipEventSynchronize` block until the event is ready. * The issue showed itself when profiling sycl-blas benchmark. * Enable support for cuda / hip in event_profiling_info.cpp
1 parent 5f22cfc commit 24d46d8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

device.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ int getAttribute(ur_device_handle_t device, CUdevice_attribute attribute) {
2323
uint64_t ur_device_handle_t_::getElapsedTime(CUevent ev) const {
2424
float Milliseconds = 0.0f;
2525

26+
// cuEventSynchronize waits till the event is ready for call to
27+
// cuEventElapsedTime.
28+
UR_CHECK_ERROR(cuEventSynchronize(EvBase));
29+
UR_CHECK_ERROR(cuEventSynchronize(ev));
2630
UR_CHECK_ERROR(cuEventElapsedTime(&Milliseconds, EvBase, ev));
2731

2832
return static_cast<uint64_t>(Milliseconds * 1.0e6);

0 commit comments

Comments
 (0)