From: Thomas Schwinge <thomas@codesourcery.com>
To: <gcc-patches@gcc.gnu.org>
Cc: <jakub@redhat.com>
Subject: Re: [gomp4 3/6] Initial support for OpenACC memory mapping semantics.
Date: Fri, 21 Feb 2014 19:48:00 -0000 [thread overview]
Message-ID: <877g8os0vx.fsf@kepler.schwinge.homeip.net> (raw)
In-Reply-To: <1389712208-416-3-git-send-email-thomas@codesourcery.com>
[-- Attachment #1: Type: text/plain, Size: 8797 bytes --]
Hi!
On Tue, 14 Jan 2014 16:10:05 +0100, I wrote:
> --- gcc/gimplify.c
> +++ gcc/gimplify.c
> @@ -86,7 +92,11 @@ enum omp_region_type
> ORT_UNTIED_TASK = 5,
> ORT_TEAMS = 8,
> ORT_TARGET_DATA = 16,
> - ORT_TARGET = 32
> + ORT_TARGET = 32,
> +
> + /* Flags for ORT_TARGET. */
> + /* Default to GOVD_MAP_FORCE for implicit mappings in this region. */
> + ORT_TARGET_MAP_FORCE = 64
> };
Continuing on that route, I have now applied the following to
gomp-4_0-branch in r208014:
commit dee2965ae547af0bc90d618e7fa40fbf2f5292b4
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Fri Feb 21 19:45:12 2014 +0000
Gimplification: New flag ORT_TARGET_OFFLOAD replaces !ORT_TARGET_DATA.
gcc/
* gimplify.c (enum omp_region_type): Make ORT_TARGET_OFFLOAD a
flag for ORT_TARGET, in its negation replacing ORT_TARGET_DATA.
Update all users.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@208014 138bc75d-0d04-0410-961f-82ee72b054a4
diff --git gcc/ChangeLog.gomp gcc/ChangeLog.gomp
index 1ce952d..bf8ec96 100644
--- gcc/ChangeLog.gomp
+++ gcc/ChangeLog.gomp
@@ -1,5 +1,9 @@
2014-02-21 Thomas Schwinge <thomas@codesourcery.com>
+ * gimplify.c (enum omp_region_type): Make ORT_TARGET_OFFLOAD a
+ flag for ORT_TARGET, in its negation replacing ORT_TARGET_DATA.
+ Update all users.
+
* omp-low.c (gimple_code_is_oacc): Move to...
* gimple.h (is_gimple_omp_oacc_specifically): ... here. Update
users, and also use it in more places where currently we've only
diff --git gcc/gimplify.c gcc/gimplify.c
index 51a1b73..9aa9301c 100644
--- gcc/gimplify.c
+++ gcc/gimplify.c
@@ -100,10 +100,11 @@ enum omp_region_type
ORT_TASK = 4,
ORT_UNTIED_TASK = 5,
ORT_TEAMS = 8,
- ORT_TARGET_DATA = 16,
- ORT_TARGET = 32,
+ ORT_TARGET = 16,
/* Flags for ORT_TARGET. */
+ /* Prepare this region for offloading. */
+ ORT_TARGET_OFFLOAD = 32,
/* Default to GOVD_MAP_FORCE for implicit mappings in this region. */
ORT_TARGET_MAP_FORCE = 64
};
@@ -2202,7 +2203,7 @@ gimplify_arg (tree *arg_p, gimple_seq *pre_p, location_t call_location)
return gimplify_expr (arg_p, pre_p, NULL, test, fb);
}
-/* Don't fold STMT inside ORT_TARGET, because it can break code by adding decl
+/* Don't fold inside offloading regsion: it can break code by adding decl
references that weren't in the source. We'll do it during omplower pass
instead. */
@@ -2211,7 +2212,8 @@ maybe_fold_stmt (gimple_stmt_iterator *gsi)
{
struct gimplify_omp_ctx *ctx;
for (ctx = gimplify_omp_ctxp; ctx; ctx = ctx->outer_context)
- if (ctx->region_type & ORT_TARGET)
+ if (ctx->region_type & ORT_TARGET
+ && ctx->region_type & ORT_TARGET_OFFLOAD)
return false;
return fold_stmt (gsi);
}
@@ -5388,10 +5390,12 @@ omp_firstprivatize_variable (struct gimplify_omp_ctx *ctx, tree decl)
return;
}
else if (ctx->region_type & ORT_TARGET)
- omp_add_variable (ctx, decl, GOVD_MAP | GOVD_MAP_TO_ONLY);
+ {
+ if (ctx->region_type & ORT_TARGET_OFFLOAD)
+ omp_add_variable (ctx, decl, GOVD_MAP | GOVD_MAP_TO_ONLY);
+ }
else if (ctx->region_type != ORT_WORKSHARE
- && ctx->region_type != ORT_SIMD
- && ctx->region_type != ORT_TARGET_DATA)
+ && ctx->region_type != ORT_SIMD)
omp_add_variable (ctx, decl, GOVD_FIRSTPRIVATE);
ctx = ctx->outer_context;
@@ -5580,7 +5584,8 @@ omp_notice_threadprivate_variable (struct gimplify_omp_ctx *ctx, tree decl,
struct gimplify_omp_ctx *octx;
for (octx = ctx; octx; octx = octx->outer_context)
- if (octx->region_type & ORT_TARGET)
+ if ((octx->region_type & ORT_TARGET)
+ && (octx->region_type & ORT_TARGET_OFFLOAD))
{
gcc_assert (!(octx->region_type & ORT_TARGET_MAP_FORCE));
@@ -5643,7 +5648,8 @@ omp_notice_variable (struct gimplify_omp_ctx *ctx, tree decl, bool in_code)
}
n = splay_tree_lookup (ctx->variables, (splay_tree_key)decl);
- if (ctx->region_type & ORT_TARGET)
+ if ((ctx->region_type & ORT_TARGET)
+ && (ctx->region_type & ORT_TARGET_OFFLOAD))
{
unsigned map_force;
if (ctx->region_type & ORT_TARGET_MAP_FORCE)
@@ -5695,7 +5701,8 @@ omp_notice_variable (struct gimplify_omp_ctx *ctx, tree decl, bool in_code)
if (ctx->region_type == ORT_WORKSHARE
|| ctx->region_type == ORT_SIMD
- || ctx->region_type == ORT_TARGET_DATA)
+ || ((ctx->region_type & ORT_TARGET)
+ && !(ctx->region_type & ORT_TARGET_OFFLOAD)))
goto do_outer;
/* ??? Some compiler-generated variables (like SAVE_EXPRs) could be
@@ -5746,7 +5753,7 @@ omp_notice_variable (struct gimplify_omp_ctx *ctx, tree decl, bool in_code)
{
splay_tree_node n2;
- if ((octx->region_type & (ORT_TARGET_DATA | ORT_TARGET)) != 0)
+ if (octx->region_type & ORT_TARGET)
continue;
n2 = splay_tree_lookup (octx->variables, (splay_tree_key) decl);
if (n2 && (n2->value & GOVD_DATA_SHARE_CLASS) != GOVD_SHARED)
@@ -5899,7 +5906,7 @@ omp_check_private (struct gimplify_omp_ctx *ctx, tree decl, bool copyprivate)
|| (!copyprivate
&& lang_hooks.decls.omp_privatize_by_reference (decl)));
- if ((ctx->region_type & (ORT_TARGET | ORT_TARGET_DATA)) != 0)
+ if (ctx->region_type & ORT_TARGET)
continue;
n = splay_tree_lookup (ctx->variables, (splay_tree_key) decl);
@@ -6456,7 +6463,9 @@ gimplify_adjust_omp_clauses (tree *list_p)
if (!DECL_P (decl))
break;
n = splay_tree_lookup (ctx->variables, (splay_tree_key) decl);
- if ((ctx->region_type & ORT_TARGET) && !(n->value & GOVD_SEEN))
+ if ((ctx->region_type & ORT_TARGET)
+ && (ctx->region_type & ORT_TARGET_OFFLOAD)
+ && !(n->value & GOVD_SEEN))
remove = true;
else if (DECL_SIZE (decl)
&& TREE_CODE (DECL_SIZE (decl)) != INTEGER_CST
@@ -6574,8 +6583,9 @@ gimplify_oacc_parallel (tree *expr_p, gimple_seq *pre_p)
tree expr = *expr_p;
gimple g;
gimple_seq body = NULL;
- enum omp_region_type ort =
- (enum omp_region_type) (ORT_TARGET | ORT_TARGET_MAP_FORCE);
+ enum omp_region_type ort = (enum omp_region_type) (ORT_TARGET
+ | ORT_TARGET_OFFLOAD
+ | ORT_TARGET_MAP_FORCE);
gimplify_scan_omp_clauses (&OACC_PARALLEL_CLAUSES (expr), pre_p, ort);
@@ -7031,11 +7041,11 @@ gimplify_omp_workshare (tree *expr_p, gimple_seq *pre_p)
case OMP_SINGLE:
break;
case OMP_TARGET:
+ ort = (enum omp_region_type) (ORT_TARGET | ORT_TARGET_OFFLOAD);
+ break;
+ case OMP_TARGET_DATA:
ort = ORT_TARGET;
break;
- case OMP_TARGET_DATA:
- ort = ORT_TARGET_DATA;
- break;
case OMP_TEAMS:
ort = ORT_TEAMS;
break;
@@ -7043,7 +7053,7 @@ gimplify_omp_workshare (tree *expr_p, gimple_seq *pre_p)
gcc_unreachable ();
}
gimplify_scan_omp_clauses (&OMP_CLAUSES (expr), pre_p, ort);
- if ((ort & ORT_TARGET) || ort == ORT_TARGET_DATA)
+ if (ort & ORT_TARGET)
{
push_gimplify_context ();
gimple g = gimplify_and_return_first (OMP_BODY (expr), &body);
@@ -7051,7 +7061,7 @@ gimplify_omp_workshare (tree *expr_p, gimple_seq *pre_p)
pop_gimplify_context (g);
else
pop_gimplify_context (NULL);
- if (ort == ORT_TARGET_DATA)
+ if (!(ort & ORT_TARGET_OFFLOAD))
{
gimple_seq cleanup = NULL;
tree fn = builtin_decl_explicit (BUILT_IN_GOMP_TARGET_END_DATA);
@@ -8697,7 +8707,9 @@ gimplify_body (tree fndecl, bool do_parms)
{
gcc_assert (gimplify_omp_ctxp == NULL);
if (lookup_attribute ("omp declare target", DECL_ATTRIBUTES (fndecl)))
- gimplify_omp_ctxp = new_omp_context (ORT_TARGET);
+ gimplify_omp_ctxp
+ = new_omp_context ((enum omp_region_type) (ORT_TARGET
+ | ORT_TARGET_OFFLOAD));
}
/* Unshare most shared trees in the body and in that of any nested functions.
diff --git gcc/omp-low.c gcc/omp-low.c
index b975dad..9fef4c1 100644
--- gcc/omp-low.c
+++ gcc/omp-low.c
@@ -10858,8 +10858,8 @@ lower_omp (gimple_seq *body, omp_context *ctx)
gimple_stmt_iterator gsi;
for (gsi = gsi_start (*body); !gsi_end_p (gsi); gsi_next (&gsi))
lower_omp_1 (&gsi, ctx);
- /* During gimplification, we have not always invoked fold_stmt
- (gimplify.c:maybe_fold_stmt); call it now. */
+ /* During gimplification, we haven't folded statments inside offloading
+ regions (gimplify.c:maybe_fold_stmt); do that now. */
if (target_nesting_level)
for (gsi = gsi_start (*body); !gsi_end_p (gsi); gsi_next (&gsi))
fold_stmt (&gsi);
Grüße,
Thomas
[-- Attachment #2: Type: application/pgp-signature, Size: 489 bytes --]
next prev parent reply other threads:[~2014-02-21 19:48 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-14 15:09 [gomp4] Initial support for OpenACC data clauses Thomas Schwinge
2014-01-14 15:10 ` [gomp4 1/6] During gimplification, allow additional flags next to ORT_TARGET thomas
2014-01-14 15:10 ` [gomp4 2/6] Prepare for extending omp_clause_map_kind thomas
2014-01-14 15:10 ` [gomp4 3/6] Initial support for OpenACC memory mapping semantics thomas
2014-01-14 15:10 ` [gomp4 4/6] C front end infrastructure for OpenACC clauses parsing thomas
2014-01-14 15:10 ` [gomp4 5/6] Initial support in the C front end for OpenACC data clauses thomas
2014-01-14 15:10 ` [gomp4 6/6] Enable initial " thomas
2014-02-12 11:17 ` [gomp4 5/6] Initial " Thomas Schwinge
2014-02-21 19:48 ` Thomas Schwinge [this message]
2014-02-21 20:32 ` [gomp4 1/3] Clarify to/from/map clauses usage in context of GF_OMP_TARGET_KIND_UPDATE Thomas Schwinge
2014-02-21 20:32 ` [gomp4 2/3] OpenACC data construct implementation in terms of GF_OMP_TARGET_KIND_OACC_DATA Thomas Schwinge
2014-02-21 20:32 ` [gomp4 3/3] OpenACC data construct support in the C front end Thomas Schwinge
2014-03-12 13:48 ` [gomp4 2/3] OpenACC data construct implementation in terms of GF_OMP_TARGET_KIND_OACC_DATA Thomas Schwinge
2014-03-20 14:39 ` [gomp4] Nesting of OpenACC constructs inside of OpenACC data constructs (was: [gomp4 2/3] OpenACC data construct implementation in terms of GF_OMP_TARGET_KIND_OACC_DATA.) Thomas Schwinge
[not found] ` <538DF785.3050206@mentor.com>
[not found] ` <87egz645j4.fsf@schwinge.name>
2014-11-13 12:21 ` [gomp4 3/6] Initial support for OpenACC memory mapping semantics Thomas Schwinge
2014-11-13 13:13 ` Jakub Jelinek
2014-11-13 13:39 ` gomp-constants.h (was: [gomp4 3/6] Initial support for OpenACC memory mapping semantics.) Thomas Schwinge
2014-11-13 13:57 ` Jakub Jelinek
2014-01-28 9:44 ` [gomp4] Initial support for OpenACC data clauses Thomas Schwinge
2014-06-05 14:00 ` [GOMP4, COMMITTED] OpenACC present data clause Thomas Schwinge
2014-06-05 14:00 ` [GOMP4, COMMITTED] OpenACC deviceptr clause Thomas Schwinge
[not found] ` <5460F49F.3040904@mentor.com>
2014-11-11 21:30 ` Thomas Schwinge
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877g8os0vx.fsf@kepler.schwinge.homeip.net \
--to=thomas@codesourcery.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).