Skip to content

Conversation

@jpeyton52
Copy link

A lot of these only trip when using sanitizers with the library.

  • Insert forgotten free()s
  • Change (-1) << 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

A lot of these only trip when using sanitizers with the library.

* Insert forgotten free()s
* Change (-1) << 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
@jpeyton52 jpeyton52 requested a review from TerryLWilmarth June 9, 2025 22:59
@llvmbot llvmbot added the openmp:libomp OpenMP host runtime label Jun 9, 2025
@github-actions
Copy link

github-actions bot commented Jun 9, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

Copy link
Contributor

@TerryLWilmarth TerryLWilmarth left a comment

Choose a reason for hiding this comment

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

LGTM

@TerryLWilmarth TerryLWilmarth merged commit 4981bc2 into llvm:main Jul 21, 2025
7 checks passed
mahesh-attarde pushed a commit to mahesh-attarde/llvm-project that referenced this pull request Jul 28, 2025
A lot of these only trip when using sanitizers with the library.

* Insert forgotten free()s
* Change (-1) << 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
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.

3 participants