[all-commits] [llvm/llvm-project] a4f246: [OpenMP] Fix inconsistent task state if hot team i...

Shilei Tian via All-commits all-commits at lists.llvm.org
Wed Jan 18 15:22:09 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a4f246a83e3df5f2b6c147b5bd69821d6fd17a37
      https://github.com/llvm/llvm-project/commit/a4f246a83e3df5f2b6c147b5bd69821d6fd17a37
  Author: Shilei Tian <i at tianshilei.me>
  Date:   2023-01-18 (Wed, 18 Jan 2023)

  Changed paths:
    M openmp/runtime/src/kmp_runtime.cpp

  Log Message:
  -----------
  [OpenMP] Fix inconsistent task state if hot team is not used

This patch fixes the inconsistent task state when hot team is not used.
When the primary thread executes `__kmp_join_call`, it calls `__kmp_free_team`,
where worker threads will get destroyed if not using hot team. The destroy of
worker threads also reset their task state. However, the primary thread's is not
reset. When the next parallel region is encountered, in `__kmp_task_team_sync`,
the task state of thread will be flipped. Since the state of primary thread is not
reset, it is still 1, but all the worker threads will be 0, this leads to the
inconsistent task state, causing those threads are using completely different
task team.

Fix #59190.

Reviewed By: tlwilmar

Differential Revision: https://reviews.llvm.org/D141979




More information about the All-commits mailing list