-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[OpenMP] avoid segv for a lock that has already been destroyed #145625
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
[OpenMP] avoid segv for a lock that has already been destroyed #145625
Conversation
|
Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be notified. If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers. If you have further questions, they may be answered by the LLVM GitHub User Guide. You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums. |
|
@TerryLWilmarth @jpeyton52 could you please review this? I realize it is a point fix but it addresses a use case in RAJA and seems like a nice user-friendly thing to do. It shows up with AMD's rocprof-sdk which implements its own OMPT client tool. |
TerryLWilmarth
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.
LGTM
@hansangbae Does this look okay to you too?
|
Looks fine to me. |
|
Can someone please approve the workflow? |
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
jprotze
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 add a test case for this?
Will do. |
|
Thanks! Also, thanks for working on this and coming up with a fix! Some performance tool folks also complained to me about this before. |
You're welcome. Yes, it came from RAJA . There are probably some others lurking but this one seemed to be likely enough that it was worth a point fix. |
This can happen in static destructors when called after the runtime is already shutdown (e.g., by ompt_finalize_tool). Even though it is technically an error to call omp_destroy_lock after shutdown, the application doesn't necessarily know that omp_destroy_lock was already called. This is safe becaues all indirect locks are destoryed in __kmp_cleanup_indirect_user_locks so the return value will always be valid or a nullptr, not garbage.
6619553 to
511cfaf
Compare
|
@jprotze OK, test is added and I fixed the formatting issue. I guess there's another workflow approval required. |
jprotze
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.
Lgtm
|
@lfmeadow Congratulations on having your first Pull Request (PR) merged into the LLVM Project! Your changes will be combined with recent changes from other authors, then tested by our build bots. If there is a problem with a build, you may receive a report in an email or a comment on this PR. Please check whether problems have been caused by your change specifically, as the builds can include changes from many authors. It is not uncommon for your change to be included in a build that fails due to someone else's changes, or infrastructure issues. How to do this, and the rest of the post-merge process, is covered in detail here. If your change does cause a problem, it may be reverted, or you can revert it yourself. This is a normal part of LLVM development. You can fix your changes and open a new PR to merge them again. If you don't get any reports, no action is required from you. Your changes are working as expected, well done! |
|
It looks like the test |
|
@kwk: I'm wondering, why this only fails for this specific test, but not for ompt/misc/interoperability.cpp |
…#145625) This can happen in static destructors when called after the runtime is already shutdown (e.g., by ompt_finalize_tool). Even though it is technically an error to call omp_destroy_lock after shutdown, the application doesn't necessarily know that omp_destroy_lock was already called. This is safe becaues all indirect locks are destoryed in __kmp_cleanup_indirect_user_locks so the return value will always be valid or a nullptr, not garbage.
|
The C++ related output are just warnings. |
The test added with PR #145625 fails with certain build configurations of libomp, disabling the test until the issue in the runtime is fixed.
|
I pushed this change as 23384cd with the goal to enable the test when similar fixes as implemented in this PR are applied to the other code paths in |
This can happen in static destructors when called after the
runtime is already shutdown (e.g., by ompt_finalize_tool). Even
though it is technically an error to call omp_destroy_lock after
shutdown, the application doesn't necessarily know that omp_destroy_lock
was already called. This is safe becaues all indirect locks are
destoryed in __kmp_cleanup_indirect_user_locks so the return
value will always be valid or a nullptr, not garbage.