public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tobias Burnus <tobias@codesourcery.com>
To: Julian Brown <julian@codesourcery.com>
Cc: <gcc-patches@gcc.gnu.org>, <fortran@gcc.gnu.org>, <jakub@redhat.com>
Subject: Re: [PATCH v7 2/5] OpenMP/OpenACC: Rework clause expansion and nested struct handling
Date: Wed, 29 Nov 2023 17:03:33 +0100	[thread overview]
Message-ID: <ac0994b6-e498-4f32-8d13-b01127377516@codesourcery.com> (raw)
In-Reply-To: <20231129114212.21f7b62d@squid.athome>

Hi Julian,

On 29.11.23 12:43, Julian Brown wrote:
> Here is a patch incorporating your initial review comments
> (hopefully!).

Thanks.

The patch LGTM - with the two remarks below addressed.

(i.e. fixing one testcase and filing two PRs (or common PR) about the features
missing and exposed by the two test cases, referencing also to those testcases
- and for the lvalues mentioning the OpenMP spec issue number.)

* * *

BTW: The 1/5 has been several times approved and is just reindenting - and
is obviously still OK.


(Review wise, 3/5, 4/5 and 5/5 still has to be done.

I think the patch can go in before - given the huge improvements, even though
it regresses for a few cases (xfail added for 2 Fortran testcases). 3/5 un-xfails
one and a half of the textcases, 5/5 un-xfails the remaining half and all of {3,4,5}/5
contain very useful improvements besides this. - But maybe waiting for at least 3/5
makes sense.

In either case, I try to review the remaining patches soon.)

* * *

Question regarding the following:
(a) The dg-xfail-run-if looks bogus as this an OpenMP test and not an OpenACC test
(b) If there is shared memory, using 'omp target' should be fine.

Namely, given that:

> --- /dev/null +++ b/libgomp/testsuite/libgomp.c++/target-49.C @@ -0,0
> +1,37 @@ +#include <cstring> +#include <cassert> + +struct s { + int
> (&a)[10]; + s(int (&a0)[10]) : a(a0) {} +}; + +int +main (int argc,
> char *argv[]) +{ + int la[10]; + s v_real(la); + s *v = &v_real; + +
> memset (la, 0, sizeof la); + + #pragma omp target enter data map(to:
> v) + + /* Copying the whole v[0] here DOES NOT WORK yet because the
> reference 'a' is + not copied "as if" it was mapped explicitly as a
> member. FIXME. */ + #pragma omp target enter data map(to: v[0]) + +
> //#pragma omp target + { + v->a[5]++; + } + + #pragma omp target exit
> data map(release: v[0]) + #pragma omp target exit data map(from: v) +
> + assert (v->a[5] == 1); + + return 0; +} + +// { dg-xfail-run-if
> "TODO" { *-*-* } { "-DACC_MEM_SHARED=0" } }
Shouldn't the XFAIL not be based on '{ target offload_device_nonshared_as }'
and the 'omp target' be uncommented?

And I wonder whether we need to file a PR about this issue - I guess it is not
addressed by any of the follow-up issues and might get forgotten unless there is PR.


* * *
> libgomp/testsuite/libgomp.c++/baseptrs-4.C ... // Needs map clause
> "lvalue"-parsing support. //#define REF2ARRAY_DECL_BASE

There is an open OpenMP issue to disallow some lvalues, namely:
OpenMP Issue 2618 ("Clarify behavior of mapping lvalues on target construct")
talks about code like the following

   map(*p = 10)
   map(x = 20)
   map(x ? y[0] : p[1])
   map(f(y))

is valid or not. The sentiment was to require that a 'map' clause list item
must have a base pointer or a base variable.


However, it looks as your examples would be valid in this regard. Can you file
a PR about this one? Referencing both to this testcase and to the OpenMP issue?

(I do note that Clang and GCC reject the lvalue examples from the OpenMP issue
but not your reference examples; those are accepted by clang++-14.)


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

  reply	other threads:[~2023-11-29 16:03 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-18 22:47 [PATCH v7 0/5] OpenMP/OpenACC: map clause and OMP gimplify rework Julian Brown
2023-08-18 22:47 ` [PATCH v7 1/5] OpenMP/OpenACC: Reindent TO/FROM/_CACHE_ stanza in {c_}finish_omp_clause Julian Brown
2023-08-18 22:47 ` [PATCH v7 2/5] OpenMP/OpenACC: Rework clause expansion and nested struct handling Julian Brown
2023-11-14 10:21   ` Tobias Burnus
2023-11-29 11:43     ` Julian Brown
2023-11-29 16:03       ` Tobias Burnus [this message]
2023-12-14  7:14       ` [committed] testsuite: Fix up target-enter-data-1.c on 32-bit targets Jakub Jelinek
2023-12-14 10:09         ` Julian Brown
2023-08-18 22:47 ` [PATCH v7 3/5] OpenMP: Pointers and member mappings Julian Brown
2023-12-06 11:36   ` Tobias Burnus
2023-12-07 17:24     ` Julian Brown
2023-12-11 11:44       ` Tobias Burnus
2023-08-18 22:47 ` [PATCH v7 4/5] OpenMP/OpenACC: Unordered/non-constant component offset runtime diagnostic Julian Brown
2023-12-14 14:26   ` Tobias Burnus
2023-12-15 13:00     ` Thomas Schwinge
2023-08-18 22:47 ` [PATCH v7 5/5] OpenMP/OpenACC: Reorganise OMP map clause handling in gimplify.cc Julian Brown
     [not found]   ` <20231216132507.5991c79e@squid.athome>
2023-12-19 15:41     ` Tobias Burnus
2023-12-20 21:29       ` Julian Brown
2023-12-21  8:51         ` 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=ac0994b6-e498-4f32-8d13-b01127377516@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).