
* Serial teams now use a stack (similar to dispatch buffers) * Serial teams always use `t_task_team[0]` as the task team and the second pointer is a next pointer for the stack `t_task_team[1]` is interpreted as a stack of task teams where each level is a nested level ``` inner serial team outer serial team [ t_task_team[0] ] -> (task_team) [ t_task_team[0] ] -> (task_team) [ next ] ----------------> [ next ] -> ... ``` * Remove the task state memo stack from thread structure. * Instead of a thread-private stack, use team structure to store th_task_state of the primary thread. When coming out of a parallel, restore the primary thread's task state. The new field in the team structure doesn't cause sizeof(team) to change and is in the cache line which is only read/written by the primary thread. Fixes: #50602 Fixes: #69368 Fixes: #69733 Fixes: #79416
34 lines
571 B
C
34 lines
571 B
C
// RUN: %libomp-compile-and-run
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
int a;
|
|
|
|
void run(int nteams, int nth) {
|
|
a = 0;
|
|
#pragma omp teams num_teams(nteams)
|
|
{
|
|
#pragma omp parallel num_threads(nth)
|
|
{
|
|
#pragma omp task
|
|
{
|
|
#pragma omp atomic
|
|
a++;
|
|
}
|
|
}
|
|
}
|
|
if (a == 0)
|
|
exit(EXIT_FAILURE);
|
|
}
|
|
|
|
int main() {
|
|
int i, nteams, nth;
|
|
for (nteams = 1; nteams <= 2; ++nteams)
|
|
for (nth = 1; nth <= 3; ++nth)
|
|
for (i = 0; i < 10; ++i) {
|
|
printf("run(%d, %d)\n", nteams, nth);
|
|
run(nteams, nth);
|
|
}
|
|
return EXIT_SUCCESS;
|
|
}
|