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] Optimize creation of global objects in GlobalHandler (#17740)
This PR optimizes global object singleton creation by removing the
`getOrCreate()` from the hot path for most of the global objects.
- `getOrCreate()` method locks mutex on every call
- We cannot just use the C++11 way of creating static singleton
variables inside corresponding methods because we need to control the
destruction order of global objects. Therefore, we use static variables
to cache the result of the `getOrCreate()` method so that it calls only
once per global object.
- The optimization is not done for the
`GlobalHandler::getPlatformToDefaultContextCache` method because there
are public methods of the `GlobalHandler` that can set the
`MPlatformToDefaultContextCache` back to `nullptr`.
0 commit comments