diff options
author | Thomas Schwinge <thomas@codesourcery.com> | 2017-05-12 11:02:55 +0200 |
---|---|---|
committer | Thomas Schwinge <tschwinge@gcc.gnu.org> | 2017-05-12 11:02:55 +0200 |
commit | 25651634436238d505c586fd308cdd5b6c5db8f9 (patch) | |
tree | 7fddfeb04f28bb8f5eb26dde13c784b149b14de3 /gcc/omp-offload.c | |
parent | ee58b02f1160548513a3d00a04acbad93c423b3f (diff) | |
download | gcc-25651634436238d505c586fd308cdd5b6c5db8f9.tar.gz |
Use "oacc kernels" attribute for OpenACC kernels
gcc/
* omp-expand.c (expand_omp_target) <GF_OMP_TARGET_KIND_OACC_KERNELS>:
Set "oacc kernels" attribute.
* omp-general.c (oacc_set_fn_attrib): Remove is_kernel formal
parameter. Adjust all users.
(oacc_fn_attrib_kernels_p): Remove function.
* omp-offload.c (execute_oacc_device_lower): Look for "oacc
kernels" attribute instead of calling oacc_fn_attrib_kernels_p.
* tree-ssa-loop.c (gate_oacc_kernels): Likewise.
* tree-parloops.c (create_parallel_loop): If oacc_kernels_p,
assert "oacc kernels" attribute is set.
gcc/testsuite/
* c-c++-common/goacc/classify-kernels-unparallelized.c: Adjust.
* c-c++-common/goacc/classify-kernels.c: Likewise.
* c-c++-common/goacc/classify-parallel.c: Likewise.
* c-c++-common/goacc/classify-routine.c: Likewise.
* gfortran.dg/goacc/classify-kernels-unparallelized.f95: Likewise.
* gfortran.dg/goacc/classify-kernels.f95: Likewise.
* gfortran.dg/goacc/classify-parallel.f95: Likewise.
* gfortran.dg/goacc/classify-routine.f95: Likewise.
From-SVN: r247955
Diffstat (limited to 'gcc/omp-offload.c')
-rw-r--r-- | gcc/omp-offload.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/gcc/omp-offload.c b/gcc/omp-offload.c index beeeb71a2eb..d24f1317a3f 100644 --- a/gcc/omp-offload.c +++ b/gcc/omp-offload.c @@ -619,7 +619,6 @@ oacc_validate_dims (tree fn, tree attrs, int *dims, int level, unsigned used) tree purpose[GOMP_DIM_MAX]; unsigned ix; tree pos = TREE_VALUE (attrs); - bool is_kernel = oacc_fn_attrib_kernels_p (attrs); /* Make sure the attribute creator attached the dimension information. */ @@ -666,13 +665,8 @@ oacc_validate_dims (tree fn, tree attrs, int *dims, int level, unsigned used) /* Replace the attribute with new values. */ pos = NULL_TREE; for (ix = GOMP_DIM_MAX; ix--;) - { - pos = tree_cons (purpose[ix], - build_int_cst (integer_type_node, dims[ix]), - pos); - if (is_kernel) - TREE_PUBLIC (pos) = 1; - } + pos = tree_cons (purpose[ix], + build_int_cst (integer_type_node, dims[ix]), pos); oacc_replace_fn_attrib (fn, pos); } } @@ -1455,10 +1449,16 @@ execute_oacc_device_lower () int fn_level = oacc_fn_attrib_level (attrs); if (dump_file) - fprintf (dump_file, oacc_fn_attrib_kernels_p (attrs) - ? "Function is kernels offload\n" - : fn_level < 0 ? "Function is parallel offload\n" - : "Function is routine level %d\n", fn_level); + { + 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 + 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); |