aboutsummaryrefslogtreecommitdiff
path: root/libgomp/icv.c
diff options
context:
space:
mode:
authorKwok Cheung Yeung <kcy@codesourcery.com>2020-11-18 11:24:36 -0800
committerKwok Cheung Yeung <kcy@codesourcery.com>2020-11-18 11:24:36 -0800
commit6fae7eda968db658c280ad6f94fe6906a15af0c9 (patch)
tree0453cb6dd1c52f71b96326f558695408e62e4607 /libgomp/icv.c
parent965e0cc371b292190f69f23ab9d35c8a20b13076 (diff)
downloadgcc-6fae7eda968db658c280ad6f94fe6906a15af0c9.zip
gcc-6fae7eda968db658c280ad6f94fe6906a15af0c9.tar.gz
gcc-6fae7eda968db658c280ad6f94fe6906a15af0c9.tar.bz2
openmp: Retire nest-var ICV for OpenMP 5.1
This removes the nest-var ICV, expressing nesting in terms of the max-active-levels-var ICV instead. The max-active-levels-var ICV is now per data environment rather than per device. 2020-11-18 Kwok Cheung Yeung <kcy@codesourcery.com> libgomp/ * env.c (gomp_global_icv): Remove nest_var field. Add max_active_levels_var field. (gomp_max_active_levels_var): Remove. (parse_boolean): Return true on success. (handle_omp_display_env): Express OMP_NESTED in terms of max_active_levels_var. Change format specifier for max_active_levels_var. (initialize_env): Set max_active_levels_var from OMP_MAX_ACTIVE_LEVELS, OMP_NESTED, OMP_NUM_THREADS and OMP_PROC_BIND. * icv.c (omp_set_nested): Express in terms of max_active_levels_var. (omp_get_nested): Likewise. (omp_set_max_active_levels): Use max_active_levels_var field instead of gomp_max_active_levels_var. (omp_get_max_active_levels): Likewise. * libgomp.h (struct gomp_task_icv): Remove nest_var field. Add max_active_levels_var field. (gomp_supported_active_levels): Set to UCHAR_MAX. (gomp_max_active_levels_var): Delete. * libgomp.texi (omp_get_nested): Update documentation. (omp_set_nested): Likewise. (OMP_MAX_ACTIVE_LEVELS): Likewise. (OMP_NESTED): Likewise. (OMP_NUM_THREADS): Likewise. (OMP_PROC_BIND): Likewise. * parallel.c (gomp_resolve_num_threads): Replace reference to nest_var with max_active_levels_var. Use max_active_levels_var field instead of gomp_max_active_levels_var.
Diffstat (limited to 'libgomp/icv.c')
-rw-r--r--libgomp/icv.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/libgomp/icv.c b/libgomp/icv.c
index 8df15e3..c0c0305 100644
--- a/libgomp/icv.c
+++ b/libgomp/icv.c
@@ -57,14 +57,18 @@ void
omp_set_nested (int val)
{
struct gomp_task_icv *icv = gomp_icv (true);
- icv->nest_var = val;
+ if (val)
+ icv->max_active_levels_var = gomp_supported_active_levels;
+ else if (icv->max_active_levels_var > 1)
+ icv->max_active_levels_var = 1;
}
int
omp_get_nested (void)
{
struct gomp_task_icv *icv = gomp_icv (false);
- return icv->nest_var;
+ return (icv->max_active_levels_var > 1
+ && icv->max_active_levels_var > omp_get_active_level ());
}
#pragma GCC diagnostic pop
@@ -120,17 +124,20 @@ omp_set_max_active_levels (int max_levels)
{
if (max_levels >= 0)
{
+ struct gomp_task_icv *icv = gomp_icv (true);
+
if (max_levels <= gomp_supported_active_levels)
- gomp_max_active_levels_var = max_levels;
+ icv->max_active_levels_var = max_levels;
else
- gomp_max_active_levels_var = gomp_supported_active_levels;
+ icv->max_active_levels_var = gomp_supported_active_levels;
}
}
int
omp_get_max_active_levels (void)
{
- return gomp_max_active_levels_var;
+ struct gomp_task_icv *icv = gomp_icv (false);
+ return icv->max_active_levels_var;
}
int