diff options
Diffstat (limited to 'gcc/omp-low.c')
-rw-r--r-- | gcc/omp-low.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 18872f903f2..0fbc3ffcca6 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -13138,7 +13138,7 @@ replace_oacc_fn_attrib (tree fn, tree dims) function attribute. Push any that are non-constant onto the ARGS list, along with an appropriate GOMP_LAUNCH_DIM tag. */ -void +static void set_oacc_fn_attrib (tree fn, tree clauses, vec<tree> *args) { /* Must match GOMP_DIM ordering. */ @@ -21171,6 +21171,13 @@ execute_oacc_device_lower () flag_openacc_dims = (char *)&flag_openacc_dims; } + bool is_oacc_kernels + = (lookup_attribute ("oacc kernels", + DECL_ATTRIBUTES (current_function_decl)) != NULL); + bool is_oacc_kernels_parallelized + = (lookup_attribute ("oacc kernels parallelized", + DECL_ATTRIBUTES (current_function_decl)) != NULL); + /* Discover, partition and process the loops. */ oacc_loop *loops = oacc_loop_discovery (); int fn_level = oacc_fn_attrib_level (attrs); @@ -21180,17 +21187,26 @@ execute_oacc_device_lower () if (fn_level >= 0) fprintf (dump_file, "Function is OpenACC routine level %d\n", fn_level); - else if (lookup_attribute ("oacc kernels", - DECL_ATTRIBUTES (current_function_decl))) - fprintf (dump_file, "Function is OpenACC kernels offload\n"); + else if (is_oacc_kernels) + fprintf (dump_file, "Function is %s OpenACC kernels offload\n", + (is_oacc_kernels_parallelized + ? "parallelized" : "unparallelized")); else fprintf (dump_file, "Function is OpenACC parallel offload\n"); } unsigned outer_mask = fn_level >= 0 ? GOMP_DIM_MASK (fn_level) - 1 : 0; unsigned used_mask = oacc_loop_partition (loops, outer_mask); - int dims[GOMP_DIM_MAX]; + /* OpenACC kernels constructs are special: they currently don't use the + generic oacc_loop infrastructure and attribute/dimension processing. */ + if (is_oacc_kernels && is_oacc_kernels_parallelized) + { + /* Parallelized OpenACC kernels constructs use gang parallelism. See + also tree-parloops.c:create_parallel_loop. */ + used_mask |= GOMP_DIM_MASK (GOMP_DIM_GANG); + } + int dims[GOMP_DIM_MAX]; oacc_validate_dims (current_function_decl, attrs, dims, fn_level, used_mask); if (dump_file) |