@@ -448,11 +448,12 @@ EventImplPtr queue_impl::submit_kernel_scheduler_bypass(
448448#ifdef XPTI_ENABLE_INSTRUMENTATION
449449 xpti_td *CmdTraceEvent = nullptr ;
450450 uint64_t InstanceID = 0 ;
451- auto StreamID = detail::getActiveXPTIStreamID () ;
451+ uint8_t StreamID = 0 ;
452452 // Only enable instrumentation if there are subscribes to the SYCL
453453 // stream
454- const bool xptiEnabled = xptiCheckTraceEnabled (StreamID );
454+ const bool xptiEnabled = xptiTraceEnabled ( );
455455 if (xptiEnabled) {
456+ StreamID = detail::getActiveXPTIStreamID ();
456457 std::tie (CmdTraceEvent, InstanceID) = emitKernelInstrumentationData (
457458 StreamID, KernelImplPtr, CodeLoc, IsTopCodeLoc,
458459 *KData.getDeviceKernelInfoPtr (), this , KData.getNDRDesc (),
@@ -843,8 +844,12 @@ void queue_impl::wait(const detail::code_location &CodeLoc) {
843844 void *TelemetryEvent = nullptr ;
844845 uint64_t IId;
845846 std::string Name;
846- auto StreamID = detail::getActiveXPTIStreamID ();
847- TelemetryEvent = instrumentationProlog (CodeLoc, Name, StreamID, IId);
847+ uint8_t StreamID = 0 ;
848+ const bool xptiEnabled = xptiTraceEnabled ();
849+ if (xptiEnabled) {
850+ StreamID = detail::getActiveXPTIStreamID ();
851+ TelemetryEvent = instrumentationProlog (CodeLoc, Name, StreamID, IId);
852+ }
848853#endif
849854
850855 if (!MGraph.expired ()) {
@@ -926,7 +931,9 @@ void queue_impl::wait(const detail::code_location &CodeLoc) {
926931#ifdef XPTI_ENABLE_INSTRUMENTATION
927932 // There is an early return in instrumentationEpilog() if no subscribers are
928933 // subscribing to queue.wait().
929- instrumentationEpilog (TelemetryEvent, Name, StreamID, IId);
934+ if (xptiEnabled) {
935+ instrumentationEpilog (TelemetryEvent, Name, StreamID, IId);
936+ }
930937#endif
931938}
932939
0 commit comments