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] Fix deadlock in Scheduler on Windows (#1703)
There was a deadlock in Scheduler on Windows only. This deadlock happens in implementation of std::shared_timed_mutex of MSVC's C++ std library.
The deadlock on Windows happens because lock ordering is not specified in C++ spec when we do lock and lock_shared simultaneously, and lock and lock_shared both wait.
It can be fixed in 2 ways:
1. upgrade DPC++ runtime to C++17 and change std::shared_timed_mutex to std::shared_mutex, there will be no deadlock on Windows out of the box. No regression on Linux.
2. implement spinlock
We can't upgrade to C++17 yet, so spinlock was implemented. It fixed the deadlock on Windows. But it creates another deadlock, this time on Linux only in implementation of lock and shared_lock in pthread. To fix this, added #ifdef _WIN32 to separate Windows and Linux parts of code.
Signed-off-by: Dmitry Vodopyanov <[email protected]>
0 commit comments