Skip to content

Commit

Permalink
[SYCL] event() fail fast (intel#13419)
Browse files Browse the repository at this point in the history
making event() constructor fail fast if ONEAPI_DEVICE_SELECTOR is
malformed.
The config::get() call checks/parses env var exactly once, so there
should not be any performance penalty for any event but the first.
  • Loading branch information
cperkinsintel authored Apr 19, 2024
1 parent 144c2bc commit 014004c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion sycl/source/detail/event_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,13 @@ class event_impl {
/// a device event.
event_impl(std::optional<HostEventState> State = HES_Complete)
: MIsInitialized(false), MHostEvent(State), MIsFlushed(true),
MState(State.value_or(HES_Complete)) {}
MState(State.value_or(HES_Complete)) {
// Need to fail in event() constructor if there are problems with the
// ONEAPI_DEVICE_SELECTOR. Deferring may lead to conficts with noexcept
// event methods. This ::get() call uses static vars to read and parse the
// ODS env var exactly once.
SYCLConfig<ONEAPI_DEVICE_SELECTOR>::get();
}

/// Constructs an event instance from a plug-in event handle.
///
Expand Down

0 comments on commit 014004c

Please sign in to comment.