You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[SYCL] Keep platform_impl's device_impls alive until shutdown (#18251)
After that devices are never destroyed until the SYCL RT library
shutdown. In practice, that means that before the change a simple
```
int main() { sycl::device d; }
```
went into `platform` ctor, then queried all the platform's devices to
check that it has some, returned from ctor and those `sycl::device`s
created on stack were already destroyed. After that, when creating
user's `sycl::device d` we were re-creating device hierarchy for the
platform at SYCL level again (including some calls to `urDeviceGetInfo`
during `device_impl` creation).
After the changes, devices created when veryfing that platform isn't
empty are preserved inside the `platform_impl` object and this existing
SYCL devices hierarchy is used when creating user's device object.
A note on the implementation: `device_impl` has an
`std::shared_ptr<platform_impl>` inside so we can't rely on automatic
resource management just by the nature of `std::shared_ptr` everywhere
(and we haven't changed this aspect in
#18143). As such, we have to perform
some explicit resource release during shutdown procedure (or in
`~UrMock()` for unittests).
0 commit comments