Skip to content

[OpenMP] Improve performance of ticket lock (x86) #143557

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

Merged
merged 2 commits into from
Jul 21, 2025

Conversation

jpeyton52
Copy link
Contributor

@jpeyton52 jpeyton52 commented Jun 10, 2025

Ticket lock has a yield operation (shown below) which degrades performance on larger server machines due to an unconditional pause operation.

#define KMP_YIELD(cond)                                                        \
  {                                                                            \
    KMP_CPU_PAUSE();                                                           \
    if ((cond) && (KMP_TRY_YIELD))                                             \
      __kmp_yield();                                                           \
  }

Ticket lock has a yield operation which degrades performance on larger
server machines due to an unconditional pause operation.
@llvmbot llvmbot added the openmp:libomp OpenMP host runtime label Jun 10, 2025
@TerryLWilmarth
Copy link
Contributor

ping. @hansangbae please review and complete this. Thanks!

Copy link
Collaborator

@jprotze jprotze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, having the KMP_YIELD macro in the commit message would make it easier to understand the actual problem when just looking at the diff of the patch. After checking the define the issue is clear and the patch LGTM.

#define KMP_YIELD(cond)                                                        \
  {                                                                            \
    KMP_CPU_PAUSE();                                                           \
    if ((cond) && (KMP_TRY_YIELD))                                             \
      __kmp_yield();                                                           \
  }

@hansangbae hansangbae merged commit c9fe19a into llvm:main Jul 21, 2025
7 checks passed
@hansangbae
Copy link
Contributor

Merged the change with the suggested commit message.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
openmp:libomp OpenMP host runtime
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants