diff --git a/sycl/source/detail/event_impl.hpp b/sycl/source/detail/event_impl.hpp index 38609e82ed14c..db275248578da 100644 --- a/sycl/source/detail/event_impl.hpp +++ b/sycl/source/detail/event_impl.hpp @@ -50,7 +50,13 @@ class event_impl { /// a device event. event_impl(std::optional 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::get(); + } /// Constructs an event instance from a plug-in event handle. ///