llvm-project/openmp/runtime/test/tasking
Shilei Tian 2df65f87c1 [OpenMP] Fixed a crash in hidden helper thread
It is reported that after enabling hidden helper thread, the program
can hit the assertion `new_gtid < __kmp_threads_capacity` sometimes. The root
cause is explained as follows. Let's say the default `__kmp_threads_capacity` is
`N`. If hidden helper thread is enabled, `__kmp_threads_capacity` will be offset
to `N+8` by default. If the number of threads we need exceeds `N+8`, e.g. via
`num_threads` clause, we need to expand `__kmp_threads`. In
`__kmp_expand_threads`, the expansion starts from `__kmp_threads_capacity`, and
repeatedly doubling it until the new capacity meets the requirement. Let's
assume the new requirement is `Y`.  If `Y` happens to meet the constraint
`(N+8)*2^X=Y` where `X` is the number of iterations, the new capacity is not
enough because we have 8 slots for hidden helper threads.

Here is an example.
```
#include <vector>

int main(int argc, char *argv[]) {
  constexpr const size_t N = 1344;
  std::vector<int> data(N);

#pragma omp parallel for
  for (unsigned i = 0; i < N; ++i) {
    data[i] = i;
  }

#pragma omp parallel for num_threads(N)
  for (unsigned i = 0; i < N; ++i) {
    data[i] += i;
  }

  return 0;
}
```
My CPU is 20C40T, then `__kmp_threads_capacity` is 160. After offset,
`__kmp_threads_capacity` becomes 168. `1344 = (160+8)*2^3`, then the assertions
hit.

Reviewed By: protze.joachim

Differential Revision: https://reviews.llvm.org/D98838
2021-03-18 18:25:36 -04:00
..
hidden_helper_task [OpenMP] Fixed a crash in hidden helper thread 2021-03-18 18:25:36 -04:00
bug_36720.c
bug_nested_proxy_task.c [openmp] Disable tests flaky on Debian 2020-04-01 21:58:05 -07:00
bug_proxy_task_dep_waiting.c [openmp] Disable tests flaky on Debian 2020-04-01 21:58:05 -07:00
bug_serial_taskgroup.c
bug_taskwait_detach.cpp [OpenMP] Fixed an issue that taskwait doesn't work on detachable task 2021-02-03 13:12:43 -05:00
kmp_detach_tasks_t1.c New implementation of OpenMP 5.0 detached tasks. 2019-06-19 13:23:28 +00:00
kmp_detach_tasks_t2.c New implementation of OpenMP 5.0 detached tasks. 2019-06-19 13:23:28 +00:00
kmp_detach_tasks_t3.c New implementation of OpenMP 5.0 detached tasks. 2019-06-19 13:23:28 +00:00
kmp_task_modifier_simple_par_new.cpp [OpenMP] NFC: Fix trivial typo 2020-04-04 12:06:54 +09:00
kmp_task_modifier_simple_par_old.cpp [OpenMP] NFC: Fix trivial typo 2020-04-04 12:06:54 +09:00
kmp_task_modifier_simple_ws_new.cpp [OpenMP] NFC: Fix trivial typo 2020-04-04 12:06:54 +09:00
kmp_task_modifier_simple_ws_old.cpp [OpenMP] NFC: Fix trivial typo 2020-04-04 12:06:54 +09:00
kmp_task_reduction_nest.cpp [OpenMP] Remove OMP spec versioning 2019-07-12 21:45:36 +00:00
kmp_taskloop.c Remove REQUIRES OMP spec version within lit tests 2019-07-17 15:41:00 +00:00
kmp_taskloop_5.c [OpenMP] Add strict mode in num_tasks and grainsize 2020-12-09 16:46:30 -06:00
nested_parallel_tasking.c
nested_task_creation.c
omp50_task_depend_mtx.c
omp50_task_depend_mtx2.c
omp50_task_depend_mtx3.c [OpenMP] Introduce GOMP mutexinoutset in the runtime 2020-09-24 09:45:13 -05:00
omp50_taskwait_depend.c [OpenMP] Introduce GOMP taskwait depend in the runtime 2020-09-24 09:45:14 -05:00
omp_detach_taskwait.c [OpenMP][Tests] Flag compatibility of OpenMP runtime tests with GCC versions 2020-07-05 22:49:54 +02:00
omp_fill_taskqueue.c [OpenMP][Tests] fix data race in an OpenMP runtime test 2020-06-15 18:48:35 +02:00
omp_task.c
omp_task_depend_resize_hashmap.c [openmp] Disable tests flaky on Debian 2020-04-01 21:58:05 -07:00
omp_task_final.c
omp_task_firstprivate.c
omp_task_if.c
omp_task_imp_firstprivate.c
omp_task_priority.c Remove REQUIRES OMP spec version within lit tests 2019-07-17 15:41:00 +00:00
omp_task_private.c
omp_task_red_taskloop.c [OpenMP] fix race condition in test 2021-02-18 02:27:49 +03:00
omp_task_shared.c
omp_taskloop_grainsize.c [OpenMP] NFC: Fix trivial typos in comments 2020-01-03 22:03:42 -05:00
omp_taskloop_num_tasks.c [OpenMP] NFC: Fix trivial typos in comments 2020-01-03 22:03:42 -05:00
omp_taskloop_taskwait.c [openmp] Fixed taskloop recursive splitting so that taskloop tasks have 2020-06-01 17:51:02 +03:00
omp_taskwait.c
omp_taskyield.c
taskdep_if0.c [OpenMP] Fix if0 task with dependencies in the runtime 2020-09-24 09:47:53 -05:00
taskdep_if0_2.c [OpenMP] Fix if0 task with dependencies in the runtime 2020-09-24 09:47:53 -05:00