From: Tobias Burnus <tobias@codesourcery.com>
To: Julian Brown <julian@codesourcery.com>, <gcc-patches@gcc.gnu.org>,
Jakub Jelinek <jakub@redhat.com>
Cc: <fortran@gcc.gnu.org>, Tobias Burnus <tobias@codesourcery.com>
Subject: Re: [PATCH] OpenMP: Duplicate checking for map clauses in Fortran (PR107214)
Date: Wed, 26 Oct 2022 12:39:39 +0200 [thread overview]
Message-ID: <eab702a7-5198-5f9e-d0c8-fd79257ba188@codesourcery.com> (raw)
In-Reply-To: <20221020161414.7430-1-julian@codesourcery.com>
Hi Julian,
I had a first quick lock at this patch, I should have a closer look
later. However, I stumbled over the following:
On 20.10.22 18:14, Julian Brown wrote:
> typedef struct gfc_symbol
> {
> ...
> struct gfc_symbol *old_symbol;
>
> unsigned mark:1, comp_mark:1, data_mark:1, dev_mark:1, gen_mark:1;
> unsigned reduc_mark:1, gfc_new:1;
>
> struct gfc_symbol *tlink;
>
> unsigned equiv_built:1;
> ...
I know that this was the case before, but can you move the mark:1 etc.
after 'tlink'? In that case all bitfields are grouped together. If I
have not miscounted, we have currently 7 bits before and 9 bits after
'tlink' and grouping them together reduced pointless padding.
* * *
> + else if (n->sym->mark)
> + gfc_error ("Symbol %qs present on both data and map clauses "
> + "at %L", n->sym->name, &n->where);
I wonder whether that also rejects the following – which seems to be
valid. The 'map' goes to 'target' and the 'firstprivate' to 'parallel',
cf. OpenMP 5.2, "17.2 Clauses on Combined and Composite Constructs",
[340:3-4 & 12-14]. (BTW: While some fixes went into 5.1 regarding this section,
a likewise wording is already in 5.0.)
(Testing showed: it give an ICE without the patch and an error with.)
module m
integer :: a = 1
end module m
module m2
contains
subroutine bar()
use m
!$omp declare target
a = a + 5
end subroutine bar
end
program p
use m
!$omp target parallel do map(a) firstprivate(a)
do i = 1, 1
a = 7
call bar()
if (a /= 7) error stop 1
a = a + 8
end do
if (a /= 6) error stop
end
* * *
The ICE seems to be because gcc/fortran/trans-openmp.cc's gfc_split_omp_clauses
mishandles this as the dump shows the following:
#pragma omp target firstprivate(a) map(tofrom:a)
#pragma omp parallel firstprivate(a)
* * *
In contrast, for the C testcase:
void foo(int x) {
#pragma omp target parallel for simd map(x) firstprivate(x)
for (int k = 0; k < 1; ++k)
x = 1;
}
the dump is as follows, which seems to be sensible:
#pragma omp target map(tofrom:x)
#pragma omp parallel firstprivate(x)
#pragma omp for nowait
#pragma omp simd
Tobias
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
next prev parent reply other threads:[~2022-10-26 10:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-20 16:14 Julian Brown
2022-10-26 10:39 ` Tobias Burnus [this message]
2022-12-07 19:09 ` [PATCH 1/2] OpenMP/Fortran: Combined directives with map/firstprivate of same symbol Julian Brown
2022-12-07 19:13 ` [PATCH 2/2] OpenMP: Duplicate checking for map clauses in Fortran (PR107214) Julian Brown
2022-12-08 12:04 ` Tobias Burnus
2022-12-10 12:10 ` Julian Brown
2022-12-10 12:48 ` Tobias Burnus
2022-12-08 10:22 ` [PATCH 1/2] OpenMP/Fortran: Combined directives with map/firstprivate of same symbol Tobias Burnus
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=eab702a7-5198-5f9e-d0c8-fd79257ba188@codesourcery.com \
--to=tobias@codesourcery.com \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=julian@codesourcery.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).