public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Chung-Lin Tang <cltang@codesourcery.com>
To: Jakub Jelinek <jakub@redhat.com>,
	Tobias Burnus <tobias@codesourcery.com>,
	 gcc-patches <gcc-patches@gcc.gnu.org>,
	Hafiz Abid Qadeer <abid_qadeer@mentor.com>,
	Andrew Stubbs <ams@codesourcery.com>
Subject: Re: [PATCH, OpenMP, v2] Implement uses_allocators clause for target regions
Date: Mon, 6 Jun 2022 21:19:18 +0800	[thread overview]
Message-ID: <58c6df9a-467a-1dc3-9386-b44af5515894@codesourcery.com> (raw)
In-Reply-To: <YpXnyzEwWa6x7xVc@tucnak>

On 2022/5/31 6:02 PM, Jakub Jelinek wrote:
> 5) for C++, we should handle FIELD_DECLs, but it shouldn't be hard, just
>     look how it is handled for private too
> 
> 	Jakub

About private() for non-static members, is it really working right now?
A simple test:

struct C {
   omp_allocator_handle_t a;
   void foo (void) {
     #pragma omp target private (a)
      a = (omp_allocator_handle_t) 0;
   }
};

int main (void)
{
   C c;
   c.foo ();
   return 0;
}

After C++ front-end processing we get:

{
     omp_allocator_handle_t D.2823 [value-expr: ((struct C *) this)->a];
   #pragma omp target private(D.2823)
     {
       {
         <<cleanup_point <<< Unknown tree: expr_stmt
           (void) (D.2823 = 0) >>>>>;
       }
     }
}

The OMP field privatization seems to be doing something here.
However gimplify turns this into:

void C::foo (struct C * const this)
{
   omp_allocator_handle_t a [value-expr: ((struct C *) this)->a];

   #pragma omp target num_teams(1) thread_limit(0) private(a) \
       map(alloc:MEM[(char *)this] [len: 0]) map(firstprivate:this [pointer assign, bias: 0])
     {
       this->a = 0;
     }
}

This doesn't look quite right for private clause. I don't quite expect a zero-length mapping of this[:0],
nor reverting the gimple to use "this->a" for a private copy.

Chung-Lin

  reply	other threads:[~2022-06-06 13:19 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-06 13:20 [PATCH, OpenMP] " Chung-Lin Tang
2022-05-06 16:40 ` Tobias Burnus
2022-05-10 11:29   ` [PATCH, OpenMP, v2] " Chung-Lin Tang
2022-05-19 16:00     ` Jakub Jelinek
2022-05-19 17:02       ` Andrew Stubbs
2022-05-19 17:55         ` Jakub Jelinek
2022-05-20  6:59       ` Tobias Burnus
2022-05-19 17:46     ` Jakub Jelinek
2022-05-30 14:43       ` Chung-Lin Tang
2022-05-30 17:23         ` Jakub Jelinek
2022-05-31 10:02           ` Jakub Jelinek
2022-06-06 13:19             ` Chung-Lin Tang [this message]
2022-06-06 13:22               ` Jakub Jelinek
2022-06-06 13:38                 ` Chung-Lin Tang
2022-06-06 13:42                   ` Jakub Jelinek
2022-06-09  6:21             ` [PATCH, OpenMP, v4] " Chung-Lin Tang
2022-06-09 12:22               ` Jakub Jelinek
2022-06-13 13:29                 ` Chung-Lin Tang
2022-06-13 14:04                   ` Jakub Jelinek
2023-02-09 11:26 ` [og12] '{c-c++-common,gfortran.dg}/gomp/uses_allocators-*' -> 'libgomp.{c-c++-common,fortran}/uses_allocators-*' (was: [PATCH, OpenMP] Implement uses_allocators clause for target regions) Thomas Schwinge

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=58c6df9a-467a-1dc3-9386-b44af5515894@codesourcery.com \
    --to=cltang@codesourcery.com \
    --cc=abid_qadeer@mentor.com \
    --cc=ams@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=tobias@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).