@@ -113,16 +113,22 @@ void ur_event_handle_t_::resetQueueAndCommand(ur_queue_t_ *hQueue,
113
113
ur_command_t commandType) {
114
114
this ->hQueue = hQueue;
115
115
this ->commandType = commandType;
116
+
117
+ if (hQueue) {
118
+ UR_CALL_THROWS (hQueue->queueGetInfo (UR_QUEUE_INFO_DEVICE, sizeof (hDevice),
119
+ reinterpret_cast <void *>(&hDevice),
120
+ nullptr ));
121
+ } else {
122
+ hDevice = nullptr ;
123
+ }
124
+
116
125
profilingData.reset ();
117
126
}
118
127
119
128
void ur_event_handle_t_::recordStartTimestamp () {
120
- assert (hQueue); // queue must be set before calling this
121
-
122
- ur_device_handle_t hDevice;
123
- UR_CALL_THROWS (hQueue->queueGetInfo (UR_QUEUE_INFO_DEVICE, sizeof (hDevice),
124
- reinterpret_cast <void *>(&hDevice),
125
- nullptr ));
129
+ // queue and device must be set before calling this
130
+ assert (hQueue);
131
+ assert (hDevice);
126
132
127
133
profilingData.recordStartTimestamp (hDevice);
128
134
}
@@ -188,6 +194,8 @@ ur_context_handle_t ur_event_handle_t_::getContext() const { return hContext; }
188
194
189
195
ur_command_t ur_event_handle_t_::getCommandType () const { return commandType; }
190
196
197
+ ur_device_handle_t ur_event_handle_t_::getDevice () const { return hDevice; }
198
+
191
199
ur_event_handle_t_::ur_event_handle_t_ (
192
200
ur_context_handle_t hContext,
193
201
v2::raii::cache_borrowed_event eventAllocation, v2::event_pool *pool)
@@ -312,19 +320,14 @@ ur_result_t urEventGetProfilingInfo(
312
320
}
313
321
}
314
322
315
- auto hQueue = hEvent->getQueue ();
316
- if (!hQueue ) {
323
+ auto hDevice = hEvent->getDevice ();
324
+ if (!hDevice ) {
317
325
// no command has been enqueued with this event yet
318
326
return UR_RESULT_ERROR_PROFILING_INFO_NOT_AVAILABLE;
319
327
}
320
328
321
329
ze_kernel_timestamp_result_t tsResult;
322
330
323
- ur_device_handle_t hDevice;
324
- UR_CALL_THROWS (hQueue->queueGetInfo (UR_QUEUE_INFO_DEVICE, sizeof (hDevice),
325
- reinterpret_cast <void *>(&hDevice),
326
- nullptr ));
327
-
328
331
auto zeTimerResolution = hDevice->ZeDeviceProperties ->timerResolution ;
329
332
auto timestampMaxValue = hDevice->getTimestampMask ();
330
333
0 commit comments