[all-commits] [llvm/llvm-project] b7b498: [OpenMP][libomp] Hold old __kmp_threads arrays unt...

Jonathan Peyton via All-commits all-commits at lists.llvm.org
Wed Jun 22 08:33:23 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b7b498657685d7a305987b9140253523e77fd4e1
  Author: Jonathan Peyton <jonathan.l.peyton at intel.com>
  Date:   2022-06-22 (Wed, 22 Jun 2022)

  Changed paths:
    M openmp/runtime/src/kmp.h
    M openmp/runtime/src/kmp_global.cpp
    M openmp/runtime/src/kmp_runtime.cpp

  Log Message:
  [OpenMP][libomp] Hold old __kmp_threads arrays until library shutdown

When many nested teams are formed, __kmp_threads may be reallocated
to accommodate new threads. This reallocation causes a data
race when another existing team's thread simultaneously references
__kmp_threads. This patch keeps the old thread arrays around until library
shutdown so these lingering references can complete without issue and
access to __kmp_threads remains a simple array reference.

Fixes: https://github.com/llvm/llvm-project/issues/54708
Differential Revision: https://reviews.llvm.org/D125013

More information about the All-commits mailing list