From: Tobias Burnus <tobias@codesourcery.com>
To: Julian Brown <julian@codesourcery.com>
Cc: <gcc-patches@gcc.gnu.org>, Jakub Jelinek <jakub@redhat.com>,
<fortran@gcc.gnu.org>
Subject: Re: [PATCH 2/2] OpenMP: Duplicate checking for map clauses in Fortran (PR107214)
Date: Thu, 8 Dec 2022 13:04:20 +0100 [thread overview]
Message-ID: <a965df2f-5670-8739-0c90-dbb16289ea48@codesourcery.com> (raw)
In-Reply-To: <20221207191355.2e43ea14@squid.athome>
Hi Julian:
On 07.12.22 20:13, Julian Brown wrote:
>> 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.
Thanks for doing so.
>> 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.)
> ...and this patch avoids the error for combined directives, and
> reorders the gfc_symbol bitfields.
All in all, I am fine with the patch - but I spotted some issues.
First, I think you need to set for some error cases mark = 0 to avoid duplicated errors.
Namely:
! Outputs the error twice ('Symbol ‘y’ present on multiple clauses')
!$omp target has_device_addr(y) firstprivate(y)
block; end block
* * *
Additionally, I think it would be good to have besides 'target' + map/firstprivate (→ error)
also a testcase for 'target simd' + map/firstprivate → error
And I think also gives-no-error checks all combined 'target ...' that take firstprivate
should be added, cf. your own patch - possibly with looking at the original dump (scan-tree-dump)
to see that the clause is properly attached correctly. Example for 'target teams':
!$omp target teams map(x) firstprivate(x)
block; end block
(Works but no testcase.)
* * *
The following is not diagnosed and gives an ICE:
!$omp target in_reduction(+: x) private(x)
block; end block
end
The C testcase properly has:
error: ‘x’ appears more than once in data-sharing clauses
Note: Using 'firstprivate' instead of 'private' shows the proper error also in Fortran.
The following does not ICE but does not make sense (and is rejected in C):
4 | #pragma omp target private(x) map(x)
vs.
!$omp target map(x) private(x)
block; end block
(The latter produces "#pragma omp target private(x.0) map(tofrom:*x.0)", ups!)
* * *
I also note that 'simd' accepts private such that
#pragma omp target simd private(x) map(x)
for (int i=0; i < 0; i++)
;
!$omp target simd map(x) private(x)
do i = 1, 0; end do
is valid. (It is accepted by gcc and gfortran, i.e. it just needs to be added as testcase.)
* * *
I note that C rejects {map(x),firstprivate(x)} + {has_device_addr(x),is_device_ptr(x)}',
but gfortran + your patch accepts:
!$omp target map(x) has_device_addr(x)
!$omp target map(x) is_device_ptr(x)
while
!$omp target firstprivate(x) has_device_addr(x)
!$omp target firstprivate(x) is_device_ptr(x)
is rejected – showing the error message twice.
Expected: I think it should show an error in all four cases - but only once.
> 2022-12-06 Julian Brown <julian@codesourcery.com>
>
> gcc/fortran/
> PR fortran/107214
> * gfortran.h (gfc_symbol): Add data_mark, dev_mark, gen_mark and
> reduc_mark bitfields.
> * openmp.cc (resolve_omp_clauses): Use above bitfields to improve
> duplicate clause detection.
>
> gcc/testsuite/
> PR fortran/107214
> * gfortran.dg/gomp/pr107214.f90: New test.
Thanks,
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-12-08 12:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-20 16:14 [PATCH] " Julian Brown
2022-10-26 10:39 ` Tobias Burnus
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 [this message]
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=a965df2f-5670-8739-0c90-dbb16289ea48@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).