* Re: [gomp4] declare directive [3/5]
[not found] ` <5575AEEB.6020902@codesourcery.com>
@ 2015-06-17 9:59 ` Thomas Schwinge
2015-06-18 16:02 ` James Norris
2015-10-30 13:27 ` Thomas Schwinge
1 sibling, 1 reply; 3+ messages in thread
From: Thomas Schwinge @ 2015-06-17 9:59 UTC (permalink / raw)
To: James Norris; +Cc: Tobias Burnus, gcc-patches, fortran
[-- Attachment #1: Type: text/plain, Size: 3749 bytes --]
Hi Jim!
I had mentioned that the Fortran front end changes cause regressions in a
few libgomp execution tests, if configured for Intel MIC (emulation)
offloading. I have now located *where* this is coming from, but would
you please work on figuring out *why*?
Fortunately, you'll be able to work on the problem even without Intel MIC
(emulation) offloading configured: to reproduce, just look at the
difference in -fdump-tree-original without and with your patch applied.
You'll notice that clauses are getting "lost" from OpenMP target update
directives; for example, for
libgomp/testsuite/libgomp.fortran/declare-target-1.f90 I see:
--- GOOD/declare-target-2.f90.003t.original 2015-06-16 18:16:07.472763339 +0200
+++ ./declare-target-2.f90.003t.original 2015-06-16 19:28:22.706845250 +0200
@@ -3,14 +3,14 @@
extern integer(kind=4) var_x;
var_x = 10;
- #pragma omp target update to(var_x)
+ #pragma omp target update
#pragma omp target
{
{
var_x = var_x * 2;
}
}
- #pragma omp target update from(var_x)
+ #pragma omp target update
if (var_x != 20)
{
_gfortran_abort ();
(This is the only test case that I looked at, so far.)
I tracked this down to:
On Mon, 8 Jun 2015 10:04:11 -0500, James Norris <jnorris@codesourcery.com> wrote:
> --- a/gcc/fortran/trans-decl.c
> +++ b/gcc/fortran/trans-decl.c
> +static void
> +find_module_oacc_declare_clauses (gfc_symbol *sym)
> +{
> + if (sym->attr.use_assoc)
> + {
> + gfc_omp_map_op map_op;
> +
> + sym->attr.referenced = sym->attr.oacc_declare_create
> + | sym->attr.oacc_declare_copyin
> + | sym->attr.oacc_declare_deviceptr
> + | sym->attr.oacc_declare_device_resident;
> +
> + if (sym->attr.oacc_declare_create)
> + map_op = OMP_MAP_FORCE_ALLOC;
> +
> + if (sym->attr.oacc_declare_copyin)
> + map_op = OMP_MAP_FORCE_TO;
> +
> + if (sym->attr.oacc_declare_deviceptr)
> + map_op = OMP_MAP_FORCE_DEVICEPTR;
> +
> + if (sym->attr.oacc_declare_device_resident)
> + map_op = OMP_MAP_DEVICE_RESIDENT;
> +
> + if (sym->attr.referenced)
> + add_clause (sym, map_op);
> + }
> +}
... this function apparently doing "something inappropriate". It gets
(unconditionally) called from:
> +finish_oacc_declare (gfc_namespace *ns, enum sym_flavor flavor)
> {
> [...]
> + gfc_traverse_ns (ns, find_module_oacc_declare_clauses);
... here, which in turn gets (unconditionally) called from:
> @@ -5946,8 +6237,7 @@ gfc_generate_function_code (gfc_namespace * ns)
> add_argument_checking (&body, sym);
>
> /* Generate !$ACC DECLARE directive. */
> - if (ns->oacc_declare)
> - insert_oacc_declare (ns);
> + finish_oacc_declare (ns, sym->attr.flavor);
>
> tmp = gfc_trans_code (ns->code);
> gfc_add_expr_to_block (&body, tmp);
... here, and:
> --- a/gcc/fortran/trans-stmt.c
> +++ b/gcc/fortran/trans-stmt.c
> @@ -1588,8 +1588,7 @@ gfc_trans_block_construct (gfc_code* code)
> code->exit_label = exit_label;
>
> /* Generate !$ACC DECLARE directive. */
> - if (ns->oacc_declare)
> - insert_oacc_declare (ns);
> + finish_oacc_declare (ns, FL_UNKNOWN);
>
> gfc_add_expr_to_block (&body, gfc_trans_code (ns->code));
> gfc_add_expr_to_block (&body, build1_v (LABEL_EXPR, exit_label));
... here.
Is that sufficient information for you to reproduce the problem?
As soon as you have a patch to bring back the lost clauses in the
-fdump-tree-original, I'll be happy to test it in my Intel MIC (emulated)
offloading build.
Grüße,
Thomas
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [gomp4] declare directive [3/5]
2015-06-17 9:59 ` [gomp4] declare directive [3/5] Thomas Schwinge
@ 2015-06-18 16:02 ` James Norris
0 siblings, 0 replies; 3+ messages in thread
From: James Norris @ 2015-06-18 16:02 UTC (permalink / raw)
To: Thomas Schwinge; +Cc: Tobias Burnus, gcc-patches, fortran
[-- Attachment #1: Type: text/plain, Size: 1170 bytes --]
Hi Thomas!
On 06/17/2015 04:59 AM, Thomas Schwinge wrote:
> Hi Jim!
>
> I had mentioned that the Fortran front end changes cause regressions in a
> few libgomp execution tests, if configured for Intel MIC (emulation)
> offloading. I have now located *where* this is coming from, but would
> you please work on figuring out *why*?
>
There are actually two bugs in find_module_oacc_declare_clauses which
are causing the issues you are seeing.
With the first bug, if none of the 'oacc_declare_*' bits were asserted,
then the referenced field within the attribute structure was set to
zero. If the referenced field was already set to one prior to
find_module_oacc_declare_clauses being called, then the field gets
incorrectly set to zero, if none of the 'oacc_declare_*' bits were
asserted.
With the second bug, if the referenced field within the attribute
structure is already set to one prior to
find_module_oacc_declare_clauses being called, then the subroutine
add_clause was called. The subroutine add_clause should only be
called if one of the 'oacc_declare_*' bits are asserted.
The attached patch resolves the above issues.
Committed to gomp-4_0-branch
Jim
[-- Attachment #2: declare.patch --]
[-- Type: text/x-patch, Size: 1013 bytes --]
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 77fdc8b..7387a80 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -5848,11 +5848,6 @@ find_module_oacc_declare_clauses (gfc_symbol *sym)
{
gfc_omp_map_op map_op;
- sym->attr.referenced = sym->attr.oacc_declare_create
- | sym->attr.oacc_declare_copyin
- | sym->attr.oacc_declare_deviceptr
- | sym->attr.oacc_declare_device_resident;
-
if (sym->attr.oacc_declare_create)
map_op = OMP_MAP_FORCE_ALLOC;
@@ -5865,8 +5860,14 @@ find_module_oacc_declare_clauses (gfc_symbol *sym)
if (sym->attr.oacc_declare_device_resident)
map_op = OMP_MAP_DEVICE_RESIDENT;
- if (sym->attr.referenced)
- add_clause (sym, map_op);
+ if (sym->attr.oacc_declare_create
+ || sym->attr.oacc_declare_copyin
+ || sym->attr.oacc_declare_deviceptr
+ || sym->attr.oacc_declare_device_resident)
+ {
+ sym->attr.referenced = 1;
+ add_clause (sym, map_op);
+ }
}
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [gomp4] declare directive [3/5]
[not found] ` <5575AEEB.6020902@codesourcery.com>
2015-06-17 9:59 ` [gomp4] declare directive [3/5] Thomas Schwinge
@ 2015-10-30 13:27 ` Thomas Schwinge
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Schwinge @ 2015-10-30 13:27 UTC (permalink / raw)
To: James Norris, gcc-patches, fortran; +Cc: Tobias Burnus
[-- Attachment #1: Type: text/plain, Size: 2245 bytes --]
Hi!
On Mon, 8 Jun 2015 10:04:11 -0500, James Norris <jnorris@codesourcery.com> wrote:
> --- a/gcc/fortran/gfortran.h
> +++ b/gcc/fortran/gfortran.h
> @@ -1174,6 +1183,7 @@ enum
> OMP_LIST_FROM,
> OMP_LIST_REDUCTION,
> OMP_LIST_DEVICE_RESIDENT,
> + OMP_LIST_LINK,
> OMP_LIST_USE_DEVICE,
> OMP_LIST_CACHE,
> OMP_LIST_NUM
I noticed (my means of hitting a segmentation fault) that this was
missing an update to the clause_names in
gcc/fortran/openmp.c:resolve_omp_clauses. (Yes, I agree that is a
strange, non-obvious dependency that this function needs to be updated
for OMP_LIST_* changes...) Fixed on gomp-4_0-branch in r229576:
commit a5246d7b6c91e0800eeb6355bf5e4c63d27aafb2
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Fri Oct 30 13:24:35 2015 +0000
Fix OMP_LIST_LINK handling
gcc/fortran/
* openmp.c (resolve_omp_clauses): Add "LINK" to clause_names.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@229576 138bc75d-0d04-0410-961f-82ee72b054a4
---
gcc/fortran/ChangeLog.gomp | 4 ++++
gcc/fortran/openmp.c | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git gcc/fortran/ChangeLog.gomp gcc/fortran/ChangeLog.gomp
index 7fe3eac..592dd8d 100644
--- gcc/fortran/ChangeLog.gomp
+++ gcc/fortran/ChangeLog.gomp
@@ -1,3 +1,7 @@
+2015-10-30 Thomas Schwinge <thomas@codesourcery.com>
+
+ * openmp.c (resolve_omp_clauses): Add "LINK" to clause_names.
+
2015-10-29 Thomas Schwinge <thomas@codesourcery.com>
* openmp.c (gfc_match_omp_map_clause): Remove allow_sections
diff --git gcc/fortran/openmp.c gcc/fortran/openmp.c
index a2c5105..32779f7 100644
--- gcc/fortran/openmp.c
+++ gcc/fortran/openmp.c
@@ -3197,7 +3197,7 @@ resolve_omp_clauses (gfc_code *code, gfc_omp_clauses *omp_clauses,
static const char *clause_names[]
= { "PRIVATE", "FIRSTPRIVATE", "LASTPRIVATE", "COPYPRIVATE", "SHARED",
"COPYIN", "UNIFORM", "ALIGNED", "LINEAR", "DEPEND", "MAP",
- "TO", "FROM", "REDUCTION", "DEVICE_RESIDENT", "USE_DEVICE",
+ "TO", "FROM", "REDUCTION", "DEVICE_RESIDENT", "LINK", "USE_DEVICE",
"CACHE" };
if (omp_clauses == NULL)
Grüße
Thomas
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-10-30 13:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <5575ADCB.6030107@codesourcery.com>
[not found] ` <5575AEEB.6020902@codesourcery.com>
2015-06-17 9:59 ` [gomp4] declare directive [3/5] Thomas Schwinge
2015-06-18 16:02 ` James Norris
2015-10-30 13:27 ` Thomas Schwinge
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).