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-expand.c | |
parent | ee58b02f1160548513a3d00a04acbad93c423b3f (diff) | |
download | gcc-25651634436238d505c586fd308cdd5b6c5db8f9.zip gcc-25651634436238d505c586fd308cdd5b6c5db8f9.tar.gz gcc-25651634436238d505c586fd308cdd5b6c5db8f9.tar.bz2 |
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-expand.c')
-rw-r--r-- | gcc/omp-expand.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/gcc/omp-expand.c b/gcc/omp-expand.c index 5c48b78..7a7c747 100644 --- a/gcc/omp-expand.c +++ b/gcc/omp-expand.c @@ -7083,7 +7083,16 @@ expand_omp_target (struct omp_region *region) exit_bb = region->exit; if (gimple_omp_target_kind (entry_stmt) == GF_OMP_TARGET_KIND_OACC_KERNELS) - mark_loops_in_oacc_kernels_region (region->entry, region->exit); + { + mark_loops_in_oacc_kernels_region (region->entry, region->exit); + + /* Further down, both OpenACC kernels and OpenACC parallel constructs + will be mappted to BUILT_IN_GOACC_PARALLEL, and to distinguish the + two, there is an "oacc kernels" attribute set for OpenACC kernels. */ + DECL_ATTRIBUTES (child_fn) + = tree_cons (get_identifier ("oacc kernels"), + NULL_TREE, DECL_ATTRIBUTES (child_fn)); + } if (offloaded) { @@ -7266,7 +7275,6 @@ expand_omp_target (struct omp_region *region) enum built_in_function start_ix; location_t clause_loc; unsigned int flags_i = 0; - bool oacc_kernels_p = false; switch (gimple_omp_target_kind (entry_stmt)) { @@ -7287,8 +7295,6 @@ expand_omp_target (struct omp_region *region) flags_i |= GOMP_TARGET_FLAG_EXIT_DATA; break; case GF_OMP_TARGET_KIND_OACC_KERNELS: - oacc_kernels_p = true; - /* FALLTHROUGH */ case GF_OMP_TARGET_KIND_OACC_PARALLEL: start_ix = BUILT_IN_GOACC_PARALLEL; break; @@ -7450,10 +7456,8 @@ expand_omp_target (struct omp_region *region) args.quick_push (get_target_arguments (&gsi, entry_stmt)); break; case BUILT_IN_GOACC_PARALLEL: - { - oacc_set_fn_attrib (child_fn, clauses, oacc_kernels_p, &args); - tagging = true; - } + oacc_set_fn_attrib (child_fn, clauses, &args); + tagging = true; /* FALLTHRU */ case BUILT_IN_GOACC_ENTER_EXIT_DATA: case BUILT_IN_GOACC_UPDATE: |