<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/openmp/runtime/src/kmp_lock.cpp, branch main</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/'/>
<entry>
<title>[OpenMP] Fixup bugs found during fuzz testing (#143455)</title>
<updated>2025-07-21T21:49:45+00:00</updated>
<author>
<name>Jonathan Peyton</name>
<email>jonathan.l.peyton@intel.com</email>
</author>
<published>2025-07-21T21:49:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=4981bc24cff3344d477af04591b699da466e10b8'/>
<id>4981bc24cff3344d477af04591b699da466e10b8</id>
<content type='text'>
A lot of these only trip when using sanitizers with the library.

* Insert forgotten free()s
* Change (-1) &lt;&lt; amount to 0xffffffffu as left shifting a negative is UB
* Fixup integer parser to return INT_MAX when parsing huge string of
digits. e.g., 452523423423423423 returns INT_MAX
* Fixup range parsing for affinity mask so integer overflow does not
occur
* Don't assert when branch bits are 0, instead warn user that is invalid
and use the default value.
* Fixup kmp_set_defaults() so the C version only uses null terminated
strings and the Fortran version uses the string + size version.
* Make sure the KMP_ALIGN_ALLOC is power of two, otherwise use
CACHE_LINE.
* Disallow ability to set KMP_TASKING=1 (task barrier) this doesn't work
and hasn't worked for a long time.
* Limit KMP_HOT_TEAMS_MAX_LEVEL to 1024, an array is allocated based on
this value.
* Remove integer values for OMP_PROC_BIND. The specification only allows
strings and CSV of strings.
* Fix setting KMP_AFFINITY=disabled + OMP_DISPLAY_AFFINITY=TRUE</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
A lot of these only trip when using sanitizers with the library.

* Insert forgotten free()s
* Change (-1) &lt;&lt; amount to 0xffffffffu as left shifting a negative is UB
* Fixup integer parser to return INT_MAX when parsing huge string of
digits. e.g., 452523423423423423 returns INT_MAX
* Fixup range parsing for affinity mask so integer overflow does not
occur
* Don't assert when branch bits are 0, instead warn user that is invalid
and use the default value.
* Fixup kmp_set_defaults() so the C version only uses null terminated
strings and the Fortran version uses the string + size version.
* Make sure the KMP_ALIGN_ALLOC is power of two, otherwise use
CACHE_LINE.
* Disallow ability to set KMP_TASKING=1 (task barrier) this doesn't work
and hasn't worked for a long time.
* Limit KMP_HOT_TEAMS_MAX_LEVEL to 1024, an array is allocated based on
this value.
* Remove integer values for OMP_PROC_BIND. The specification only allows
strings and CSV of strings.
* Fix setting KMP_AFFINITY=disabled + OMP_DISPLAY_AFFINITY=TRUE</pre>
</div>
</content>
</entry>
<entry>
<title>[OpenMP] Improve performance of ticket lock (x86) (#143557)</title>
<updated>2025-07-21T13:26:35+00:00</updated>
<author>
<name>Jonathan Peyton</name>
<email>jonathan.l.peyton@intel.com</email>
</author>
<published>2025-07-21T13:26:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=c9fe19a99bf41c165524dcb3e9ff939527b5178b'/>
<id>c9fe19a99bf41c165524dcb3e9ff939527b5178b</id>
<content type='text'>
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) &amp;&amp; (KMP_TRY_YIELD))                                             \
      __kmp_yield();                                                           \
  }
```</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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) &amp;&amp; (KMP_TRY_YIELD))                                             \
      __kmp_yield();                                                           \
  }
```</pre>
</div>
</content>
</entry>
<entry>
<title>  [OpenMP] avoid segv for a lock that has already been destroyed (#145625)</title>
<updated>2025-06-25T19:08:45+00:00</updated>
<author>
<name>Larry Meadows</name>
<email>lmeadows@amd.com</email>
</author>
<published>2025-06-25T19:08:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=aec88679db5f5ac61616e0accc264008690a8ccc'/>
<id>aec88679db5f5ac61616e0accc264008690a8ccc</id>
<content type='text'>
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.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.</pre>
</div>
</content>
</entry>
<entry>
<title>[OpenMP][AIX]Define struct kmp_base_tas_lock with the order of two members swapped for big-endian (#79188)</title>
<updated>2024-02-13T20:11:24+00:00</updated>
<author>
<name>Xing Xue</name>
<email>xingxue@outlook.com</email>
</author>
<published>2024-02-13T20:11:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=ac97562c99c3ae97f063048ccaf08ebdae60ac30'/>
<id>ac97562c99c3ae97f063048ccaf08ebdae60ac30</id>
<content type='text'>
The direct lock data structure has bit `0` (the least significant bit)
of the first 32-bit word set to `1` to indicate it is a direct lock. On
the other hand, the first word (in 32-bit mode) or first two words (in
64-bit mode) of an indirect lock are the address of the entry allocated
from the indirect lock table. The runtime checks bit `0` of the first
32-bit word to tell if this is a direct or an indirect lock. This works
fine for 32-bit and 64-bit little-endian because its memory layout of a
64-bit address is (`low word`, `high word`). However, this causes
problems for big-endian where the memory layout of a 64-bit address is
(`high word`, `low word`). If an address of the indirect lock table
entry is something like `0x110035300`, i.e., (`0x1`, `0x10035300`), it
is treated as a direct lock. This patch defines `struct
kmp_base_tas_lock` with the ordering of the two 32-bit members flipped
for big-endian PPC64 so that when checking/setting tags in member
`poll`, the second word (the low word) is used. This patch also changes
places where `poll` is not already explicitly specified for
checking/setting tags.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The direct lock data structure has bit `0` (the least significant bit)
of the first 32-bit word set to `1` to indicate it is a direct lock. On
the other hand, the first word (in 32-bit mode) or first two words (in
64-bit mode) of an indirect lock are the address of the entry allocated
from the indirect lock table. The runtime checks bit `0` of the first
32-bit word to tell if this is a direct or an indirect lock. This works
fine for 32-bit and 64-bit little-endian because its memory layout of a
64-bit address is (`low word`, `high word`). However, this causes
problems for big-endian where the memory layout of a 64-bit address is
(`high word`, `low word`). If an address of the indirect lock table
entry is something like `0x110035300`, i.e., (`0x1`, `0x10035300`), it
is treated as a direct lock. This patch defines `struct
kmp_base_tas_lock` with the ordering of the two 32-bit members flipped
for big-endian PPC64 so that when checking/setting tags in member
`poll`, the second word (the low word) is used. This patch also changes
places where `poll` is not already explicitly specified for
checking/setting tags.</pre>
</div>
</content>
</entry>
<entry>
<title>[lldb] Fix duplicate word typos; NFC</title>
<updated>2023-09-02T04:32:24+00:00</updated>
<author>
<name>Fangrui Song</name>
<email>i@maskray.me</email>
</author>
<published>2023-09-02T04:32:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=678e3ee12351e525fa9d94e7ff68ba7c1a8ca657'/>
<id>678e3ee12351e525fa9d94e7ff68ba7c1a8ca657</id>
<content type='text'>
Those fixes were taken from https://reviews.llvm.org/D137338
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Those fixes were taken from https://reviews.llvm.org/D137338
</pre>
</div>
</content>
</entry>
<entry>
<title>[OpenMP][libomp] Introduce oneAPI compiler support</title>
<updated>2022-02-14T20:10:33+00:00</updated>
<author>
<name>Jonathan Peyton</name>
<email>jonathan.l.peyton@intel.com</email>
</author>
<published>2022-01-31T16:04:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=1234011b80f835a297482467ca6ca2099677c39c'/>
<id>1234011b80f835a297482467ca6ca2099677c39c</id>
<content type='text'>
Introduce KMP_COMPILER_ICX macro to represent compilation with oneAPI
compiler.

Fixup flag detection and compiler ID detection in CMake. Older CMake's
detect IntelLLVM as Clang.

Fix compiler warnings.

Fixup many of the tests to have non-empty parallel regions as they are
elided by oneAPI compiler.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Introduce KMP_COMPILER_ICX macro to represent compilation with oneAPI
compiler.

Fixup flag detection and compiler ID detection in CMake. Older CMake's
detect IntelLLVM as Clang.

Fix compiler warnings.

Fixup many of the tests to have non-empty parallel regions as they are
elided by oneAPI compiler.
</pre>
</div>
</content>
</entry>
<entry>
<title>[OpenMP] Add use of TPAUSE</title>
<updated>2022-01-18T16:14:32+00:00</updated>
<author>
<name>Terry Wilmarth</name>
<email>terry.l.wilmarth@intel.com</email>
</author>
<published>2021-12-14T21:04:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=2e02579a76cf4ea3acdc0e076f53ff9cb15fa38f'/>
<id>2e02579a76cf4ea3acdc0e076f53ff9cb15fa38f</id>
<content type='text'>
Add use of TPAUSE (from WAITPKG) to the runtime for Intel hardware,
with an envirable to turn it on in a particular C-state.  Always uses
TPAUSE if it is selected and enabled by Intel hardware and presence of
WAITPKG, and if not, falls back to old way of checking
__kmp_use_yield, etc.

Differential Revision: https://reviews.llvm.org/D115758
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add use of TPAUSE (from WAITPKG) to the runtime for Intel hardware,
with an envirable to turn it on in a particular C-state.  Always uses
TPAUSE if it is selected and enabled by Intel hardware and presence of
WAITPKG, and if not, falls back to old way of checking
__kmp_use_yield, etc.

Differential Revision: https://reviews.llvm.org/D115758
</pre>
</div>
</content>
</entry>
<entry>
<title>[OpenMP][host runtime] Introduce kmp_cpuinfo_flags_t to replace integer flags</title>
<updated>2021-10-01T16:08:39+00:00</updated>
<author>
<name>Peyton, Jonathan L</name>
<email>jonathan.l.peyton@intel.com</email>
</author>
<published>2021-09-20T18:24:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=343b9e8590db6bc815df3a3fec5bb25c23261476'/>
<id>343b9e8590db6bc815df3a3fec5bb25c23261476</id>
<content type='text'>
Store CPUID support flags as bits instead of using entire integers.

Differential Revision: https://reviews.llvm.org/D110091
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Store CPUID support flags as bits instead of using entire integers.

Differential Revision: https://reviews.llvm.org/D110091
</pre>
</div>
</content>
</entry>
<entry>
<title>[OpenMP][host runtime] Fix indirect lock table race condition</title>
<updated>2021-09-20T18:01:58+00:00</updated>
<author>
<name>Peyton, Jonathan L</name>
<email>jonathan.l.peyton@intel.com</email>
</author>
<published>2021-09-13T20:44:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=1e45cd75dfb1df61892c1a26654c8997d8aeef66'/>
<id>1e45cd75dfb1df61892c1a26654c8997d8aeef66</id>
<content type='text'>
The indirect lock table can exhibit a race condition during initializing
and setting/unsetting locks. This occurs if the lock table is
resized by one thread (during an omp_init_lock) and accessed (during an
omp_set|unset_lock) by another thread.

The test runtime/test/lock/omp_init_lock.c test exposed this issue and
will fail if run enough times.

This patch restructures the lock table so pointer/iterator validity is
always kept. Instead of reallocating a single table to a larger size, the
lock table begins preallocated to accommodate 8K locks. Each row of the
table is allocated as needed with each row allowing 1K locks. If the 8K
limit is reached for the initial table, then another table, capable of
holding double the number of locks, is allocated and linked
as the next table. The indices stored in the user's locks take this
linked structure into account when finding the lock within the table.

Differential Revision: https://reviews.llvm.org/D109725
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The indirect lock table can exhibit a race condition during initializing
and setting/unsetting locks. This occurs if the lock table is
resized by one thread (during an omp_init_lock) and accessed (during an
omp_set|unset_lock) by another thread.

The test runtime/test/lock/omp_init_lock.c test exposed this issue and
will fail if run enough times.

This patch restructures the lock table so pointer/iterator validity is
always kept. Instead of reallocating a single table to a larger size, the
lock table begins preallocated to accommodate 8K locks. Each row of the
table is allocated as needed with each row allowing 1K locks. If the 8K
limit is reached for the initial table, then another table, capable of
holding double the number of locks, is allocated and linked
as the next table. The indices stored in the user's locks take this
linked structure into account when finding the lock within the table.

Differential Revision: https://reviews.llvm.org/D109725
</pre>
</div>
</content>
</entry>
<entry>
<title>[OpenMP][NFC] libomp: silence warnings on unused variables.</title>
<updated>2021-07-30T14:04:42+00:00</updated>
<author>
<name>AndreyChurbanov</name>
<email>andrey.churbanov@intel.com</email>
</author>
<published>2021-07-30T14:04:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=8b81524c6dd27b8dd7a36d525e5569cdf8d5e188'/>
<id>8b81524c6dd27b8dd7a36d525e5569cdf8d5e188</id>
<content type='text'>
Put declarations/definitions of unused variables under corresponding macros
to silence clang build warnings.

Differential Revision: https://reviews.llvm.org/D106608
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Put declarations/definitions of unused variables under corresponding macros
to silence clang build warnings.

Differential Revision: https://reviews.llvm.org/D106608
</pre>
</div>
</content>
</entry>
</feed>
