-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Provide alternative std::mutex implementation on Windows #3000
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| option(onnxruntime_ENABLE_MEMLEAK_CHECKER "Experimental: Enable memory leak checker in Windows debug build" OFF) | ||
| option(onnxruntime_USE_CUDA "Build with CUDA support" OFF) | ||
| option(onnxruntime_USE_OPENVINO "Build with OpenVINO support" OFF) | ||
| option(onnxruntime_USE_NSYNC "Build with NSYNC support. This option only takes effect on Linux" OFF) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is nsync going to be ON by default? If yes, do we still need #ifdef USE_NSYNC?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NO. We can remove the ifdef
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR sent: #3052
c6a1804 to
d94262a
Compare
skottmckay
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
![]()
Can you paste some perf numbers that show the advantage of this mutex? This will set an example for future PR authors who want to submit perf fixes. Thanks. |
Sent you an email. |
### Description 1. Remove the onnxruntime::OrtMutex class and replace it with ~absl::Mutex~ std::mutex. 2. After this change, most source files will not include <Windows.h> indirectly. ### Motivation and Context To reduce the number of deps we have, and address some Github issues that are related to build ONNX Runtime from source. In PR #3000 , I added a custom implementation of std::mutex . It was mainly because at that time std::mutex's default constructor was not trivial on Windows. If you had such a mutex as a global var, it could not be initialized at compile time. Then VC++ team fixed this issue. Therefore we don't need this custom implementation anymore. This PR also removes nsync. I ran several models tests on Linux. I didn't see any perf difference. This PR also reverts PR #21005 , which is no longer needed since conda has updated its msvc runtime DLL. This PR unblocks #22173 and resolves #22092 . We have a lot of open issues with nsync. This PR can resolve all of them.
Description:
Provide alternative std::mutex implementation on Windows. OrtMutex is no longer an alias of std::mutex.
Motivation and Context
This PR is only for changing the implementation of OrtMutex. In a following PR I'll show how it will simplify things.