Skip to content

Commit d55a487

Browse files
committed
fix tests
Signed-off-by: Mateusz P. Nowak <[email protected]>
1 parent adf4977 commit d55a487

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

unified-runtime/source/adapters/level_zero/v2/event_provider_counter.cpp

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,22 @@ std::unique_ptr<event_provider> createProvider(ur_platform_handle_t platform,
100100
queue_type queueType,
101101
ur_device_handle_t device,
102102
event_flags_t flags) {
103-
// Try to create a counter-based event provider first
104-
try {
105-
return std::make_unique<provider_counter>(platform, context, queueType,
106-
device, flags);
107-
} catch (...) {
108-
// If counter-based events are not supported, fall back to normal events
109-
// Remove the counter flag as the normal provider doesn't support it
110-
event_flags_t normalFlags = flags & ~EVENT_FLAGS_COUNTER;
111-
return std::make_unique<provider_normal>(context, queueType, normalFlags);
103+
// Only try counter-based events if the flag is set
104+
if (flags & EVENT_FLAGS_COUNTER) {
105+
// Try to create a counter-based event provider first
106+
try {
107+
return std::make_unique<provider_counter>(platform, context, queueType,
108+
device, flags);
109+
} catch (...) {
110+
// If counter-based events are not supported, fall back to normal events
111+
// Remove the counter flag as the normal provider doesn't support it
112+
event_flags_t normalFlags = flags & ~EVENT_FLAGS_COUNTER;
113+
return std::make_unique<provider_normal>(context, queueType, normalFlags);
114+
}
112115
}
116+
117+
// Counter-based events not requested, use normal events
118+
return std::make_unique<provider_normal>(context, queueType, flags);
113119
}
114120

115121
} // namespace v2

0 commit comments

Comments
 (0)