[all-commits] [llvm/llvm-project] 85592d: [OpenMP] Fix the issue where `num_threads` still t...
Shilei Tian via All-commits
all-commits at lists.llvm.org
Wed Jun 14 08:46:26 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 85592d3d4d402b99df32bcc711bca56a8a593c97
https://github.com/llvm/llvm-project/commit/85592d3d4d402b99df32bcc711bca56a8a593c97
Author: Shilei Tian <i at tianshilei.me>
Date: 2023-06-14 (Wed, 14 Jun 2023)
Changed paths:
M openmp/runtime/src/kmp_runtime.cpp
A openmp/runtime/test/parallel/bug63197.c
Log Message:
-----------
[OpenMP] Fix the issue where `num_threads` still takes effect incorrectly
This patch fixes the issue that, if we have a compile-time serialized parallel
region (such as `if (0)`) with `num_threads`, followed by a regular parallel
region, the regular parallel region will pick up the value set in the serialized
parallel region incorrectly. The reason is, in the front end, if we can prove a
parallel region has to serialized, instead of emitting `__kmpc_fork_call`, the
front end directly emits `__kmpc_serialized_parallel`, body, and `__kmpc_end_serialized_parallel`.
However, this "optimization" doesn't consider the case where `num_threads` is
used such that `__kmpc_push_num_threads` is still emitted. Since we don't reset
the value in `__kmpc_serialized_parallel`, it will affect the next parallel region
followed by it.
Fix #63197.
Reviewed By: tlwilmar
Differential Revision: https://reviews.llvm.org/D152883
More information about the All-commits
mailing list