public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/104696] [OpenMP] Implicit mapping breaks struct mapping Date: Thu, 03 Mar 2022 17:18:51 +0000 [thread overview] Message-ID: <bug-104696-4-nMPqkmECkz@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-104696-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104696 Tobias Burnus <burnus at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|[12 Regression][OpenMP] |[OpenMP] Implicit mapping |Implicit mapping breaks |breaks struct mapping |struct mapping | Keywords| |missed-optimization --- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> --- Looking closer at it, I no longer think it is a regression (to be checked if deemed important). But it looks as if there are two problems - one wrong-code one and one missed-optimization one. Namely, I think reason for both issues is that map(to:var3.r[1].d [len: 88]) ... is not turned into map(struct:var3 [len: 1]) map(to:var3.r[1].d [len: 88]) but into 'to' + pointer assign. This does not even work when using the 'always' modifier. ('struct:' appears when using 'Q' instead of 'R(2)'.) That that the struct not detected seems to be because array and component refs are mixed – hiding that the var is memory wise in the same struct. I believe with that fixed, it would work correctly. * * * For C/C++, it "works". But: it still does not detect that the member is part of the whole struct - and allocates pointlessly too much memory. To illustrate this, I added a large 'arr' element. Otherwise, that the reason that it works in C/C++ is that ATTACH and not pointer assign is used. Namely: ------------ test.c-------------- struct s { int *d; }; struct s2 { struct s r[5], q, arr[1024][1024]; }; int main () { struct s2 x; x.q.d = __builtin_malloc(sizeof(int)); x.r[1].d = __builtin_malloc(sizeof(int)); #pragma omp target map(tofrom: x.q.d[:1]) *x.q.d = 2; #pragma omp target map(tofrom: x.r[1].d[:1]) *x.r[1].d = 3; __builtin_printf("%d, %d\n", *x.q.d, *x.r[1].d); return 0; } ------------ test.c-------------- gives: #pragma omp target num_teams(1) thread_limit(0) map(tofrom:x [len: 8388656][implicit]) map(tofrom:*_3 [len: 4]) map(attach:x.q.d [bias: 0]) #pragma omp target num_teams(1) thread_limit(0) map(tofrom:x [len: 8388656][implicit]) map(tofrom:*_4 [len: 4]) map(attach:x.r[1].d [bias: 0])
next prev parent reply other threads:[~2022-03-03 17:18 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-02-26 0:06 [Bug fortran/104696] New: [12 Regression][OpenMP] " burnus at gcc dot gnu.org 2022-03-01 7:35 ` [Bug fortran/104696] " rguenth at gcc dot gnu.org 2022-03-03 17:18 ` burnus at gcc dot gnu.org [this message] 2022-03-07 13:53 ` [Bug fortran/104696] [OpenMP] " burnus at gcc dot gnu.org 2022-03-10 14:27 ` cltang at gcc dot gnu.org 2022-03-10 15:13 ` burnus at gcc dot gnu.org 2022-03-14 14:48 ` [Bug middle-end/104696] [OpenMP] component/array-ref/component (x.r[1].d) should use 'x' for GOMP_MAP_STRUCT (not yield 'x.r[1]' for nonptr 'x.r') burnus at gcc dot gnu.org 2022-05-06 8:32 ` jakub at gcc dot gnu.org 2023-05-08 12:23 ` rguenth at gcc dot gnu.org
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=bug-104696-4-nMPqkmECkz@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /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: linkBe 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).