@@ -198,28 +198,28 @@ void event_impl::setQueue(queue_impl &Queue) {
198
198
MIsDefaultConstructed = false ;
199
199
}
200
200
201
+ void event_impl::initHostProfilingInfo () {
202
+ assert (isHost () && " This must be a host event" );
203
+ assert (MState == HES_NotComplete &&
204
+ " Host event must be incomplete to initialize profiling info" );
205
+
206
+ std::shared_ptr<queue_impl> QueuePtr = MSubmittedQueue.lock ();
207
+ assert (QueuePtr && " Queue must be valid to initialize host profiling info" );
208
+ assert (QueuePtr->MIsProfilingEnabled && " Queue must have profiling enabled" );
209
+
210
+ MIsProfilingEnabled = true ;
211
+ MHostProfilingInfo.reset (new HostProfilingInfo ());
212
+ if (!MHostProfilingInfo)
213
+ throw sycl::exception (sycl::make_error_code (sycl::errc::runtime),
214
+ " Out of host memory " +
215
+ codeToString (UR_RESULT_ERROR_OUT_OF_HOST_MEMORY));
216
+
217
+ device_impl &Device = QueuePtr->getDeviceImpl ();
218
+ MHostProfilingInfo->setDevice (&Device);
219
+ }
220
+
201
221
void event_impl::setSubmittedQueue (std::weak_ptr<queue_impl> SubmittedQueue) {
202
222
MSubmittedQueue = std::move (SubmittedQueue);
203
- if (isHost ()) {
204
- if (auto QueuePtr = MSubmittedQueue.lock ()) {
205
- // Enable profiling for host events only if the queue where host task was
206
- // submitted has profiling enabled.
207
- MIsProfilingEnabled = QueuePtr->MIsProfilingEnabled ;
208
- if (!MIsProfilingEnabled || MState == HES_Discarded ||
209
- MState == HES_Complete)
210
- return ;
211
-
212
- MHostProfilingInfo.reset (new HostProfilingInfo ());
213
- if (!MHostProfilingInfo)
214
- throw sycl::exception (
215
- sycl::make_error_code (sycl::errc::runtime),
216
- " Out of host memory " +
217
- codeToString (UR_RESULT_ERROR_OUT_OF_HOST_MEMORY));
218
-
219
- device_impl &Device = QueuePtr->getDeviceImpl ();
220
- MHostProfilingInfo->setDevice (&Device);
221
- }
222
- }
223
223
}
224
224
225
225
void *event_impl::instrumentationProlog (std::string &Name, int32_t StreamID,
0 commit comments