-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[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
base: main
Are you sure you want to change the base?
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. |
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. |
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. |
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
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.