-
Notifications
You must be signed in to change notification settings - Fork 12.3k
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
libomp 12.0.0 introduces assertion failure when running OpenMP from a background thread #49923
Comments
I cannot reproduce the issue on my Linux system. Looking at the code location for the assertion, my suspicion is that the issue might come from the hidden helper threads. https://github.com/llvm/llvm-project/blob/llvmorg-12.0.0/openmp/runtime/src/kmp_runtime.cpp#L3689 Nathan, can you please test with: Also, which C++ library do you use libstdc++ or libc++ (see output of |
With those environment variables, the test application works as expected.
I am using libc++: |
I cannot reproduce the issue on Linux either. Is it on macOS as I see Homebrew was being used? |
Oh, yeah, it is macOS. I’ll try locally on my Mac. |
mentioned in issue #51489 |
The deadline for requesting fixes for the release has passed. This bug is being removed from the LLVM 13.0.1 release milestone. If you have a fix or think this bug is important enough to block the release, please explain why in a comment and add the bug back to the LLVM 13.0.1 release milestone. |
I cannot reproduce the failure on macOS with trunk as well. Besides, helper thread should be disabled on macOS. I don't know if the latest HomeBrew version has already covered newer code base. Please let me know if the problem still exists. |
Hi @shiltian, I can confirm this problem still exisits on my mac, background is:
then I encountered segmentation fault just like microsoft/LightGBM#4229 and dmlc/xgboost#7106. In the end I downgrade the version of libomp to 11.1.0 to get rid of this issue. Please let me know if I should provide more information. Thank you. |
Still cannot reproduce the failure on macOS 12.1. Here is what I did:
I also tried to build OpenMP from scratch using Home-brew formula, and I cannot see the crash as well.
The way I compile the test case is:
|
@zychen423 I feel the failure might only happen with a specific number of threads. Probably to reproduce the failure, I need to know how many cores and threads do you have on your Mac? |
@shiltian, I am on an M1 macbook pro with 8 cores and threads
btw segmentation fault happened when I use xgboost in my code, here is a minimal example that would work under libomp 11, but crash with libomp 12 and 13:
I would like to see if you can run this script. Thanks in advanced! |
@zychen423 I can run the script but cannot reproduce the crash. My Mac has 16 cores so I created a VM w/ 8C8T. I installed
I ran the Python script, and it simply exits w/o any error. |
The M1 is an ARM chip, if this is llvm running natively then it may be more vulnerable to concurrency bugs than x64. (TSO hides various mistakes than ARM in general, and I guess Apple's M1, are not as tolerant of) |
@shiltian I see. I've asked others who encounter this issue to take a look. Is there anything more I can do to help the situation? Thank you |
@zychen423 If the issue is ARM specific, like Jon suggested, I can't do too much for now because mine is Intel based. If I can know how to reproduce it on an Intel based processor, that would be great. Thanks again for your info. |
As I just posted on xgboost#7039, I have a very simple reproduction for a libomp/xgboost segmentation fault at |
@andy-brainome Thanks for the info, but unfortunately it exits w/o any error on my Mac. Does your Mac have M1 processor? And how many cores and thread does it have? |
No M1 here - I have a 2019 MacBook Pro running Big Sur 11.2.3 on a 6 core Intel 1.7 with 12 threads. I'm glad this crash got someone's attention - as I recall, the execution stack was slightly off and python was trying to execute the string parameter of the adjacent logging statement just prior to returning. Didn't know python could do that. Very nasty hole in the vm. If someone could post a url for brewing libomp v12.0.0, I'll plug it into my ci/cd and reproduce the unit tests. |
The `llvm-openmp` package has a Numba relevant bug that only manifests when using that package on M1 silicon (new Apple chips) in version 12. This will allow building Numba (the headers are needed) but dissallow running it with `llvm-openmp` in version 12.* on Apple M1 silicon. The `llvm-openmp` bug is here: llvm/llvm-project#49923 This will also be future proof and allow `llvm-openmp` to be installed in version 13 as soon as that becomes available from `main/defaults of if people want to use `conda-forge`, since that already has version 13.
Version 12 is no longer maintained. Close this issue. Feel free to open and edit it if anyone can still observe the issue with the latest version. |
…M side llvm hav moved to github issues, here's the corresponding github issue: llvm/llvm-project#49923 which was closed because they couldn't repro. see also microsoft/LightGBM#4229 (comment) let us keep the pin until someone confirms it's fixed
Extended Description
Overview:
Our application runs OpenMP from a background thread and multiple threads may end up doing that. This has worked fine using OpemMP 11.0.0 from homebrew. However, upgrading to OpenMP 12.0.0 has introduced OMP: Error #13: Assertion failure at kmp_runtime.cpp(3689).
Steps to reproduce:
I have attached a minimum working example.
To ease switching between OpenMP versions using brew I performed the following steps:
$ brew unlink libomp
$ cp -R /usr/local/Cellar/libomp /usr/local/Cellar/libomp@12.0.0
$ mv /usr/local/Cellar/libomp /usr/local/Cellar/libomp@11.0.0
$ rm -r /usr/local/Cellar/libomp@12.0.0/11.0.0
$ rm -r /usr/local/Cellar/libomp@11.0.0/12.0.0
$ brew link libomp@11.0.0
Compiling simply with:
$ tar xvf nested-openmp.tgz && cd nested-openmp
$ mkdir build && cd build
$ cmake ..
$ make
Running with libomp@11.0.0 cause no issues. Switching results in the attached crash
$ ./nested-openmp
$ brew unlink libomp@11.0.0 && brew link libomp@12.0.0
$ ./nested-openmp
OMP: Error #13: Assertion failure at kmp_runtime.cpp(3689).
OMP: Hint Please submit a bug report with this message, compile and run commands used, and machine configuration info including native compiler and operating system versions. Faster response will be obtained by including all program sources. For information on submitting this issue, please see https://bugs.llvm.org/.
[1] 15285 abort ./nested-openmp
$ brew unlink libomp@11.0.0 &&
The text was updated successfully, but these errors were encountered: