public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: Jakub Jelinek <jakub@redhat.com>,
	Tobias Burnus <tobias@codesourcery.com>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [Patch] + [nvptx RFH/RFC]: OpenMP: Fix SIMT for complex/float reduction with && and ||
Date: Thu, 6 May 2021 16:05:45 +0200	[thread overview]
Message-ID: <70729ed4-80b2-c64e-7c99-abf415b23ca9@suse.de> (raw)
In-Reply-To: <5d23ae62-4812-e80b-2f4b-95be9603bcee@suse.de>

On 5/6/21 3:12 PM, Tom de Vries wrote:
> On 5/6/21 12:30 PM, Jakub Jelinek wrote:
>> On Thu, May 06, 2021 at 12:17:03PM +0200, Tobias Burnus wrote:
>>> OpenMP: Fix SIMT for complex/float reduction with && and ||
>>>
>>> gcc/ChangeLog:
>>>
>>> 	* omp-low.c (lower_rec_input_clauses): Also handle SIMT part
>>> 	for complex/float recution with && and ||.
>>>
>>> libgomp/ChangeLog:
>>>
>>> 	* testsuite/libgomp.c-c++-common/reduction-5.c: New test, testing
>>> 	complex/floating-point || + && recduction with 'omp target'.
>>
>> As the float/complex ||/&& reductions are IMHO just conformance issues, not
>> something anyone would actually use in meaningful code - floats or complex
>> aren't the most obvious or efficient holders of boolean values - I think
>> punting SIMT on those isn't a workaround, but the right solution.
>>
> 
> Ack.
> 
> WIP patch below tries that approach and fixes the ICE, but this simple
> example still doesn't work:
> ...
> int
> main ()
> {
>   float andf = 1;
> 
>   #pragma omp target parallel reduction(&&: andf)
>   for (int i=0; i < 1024; ++i)
>     andf = andf && 0.0;
> 
>   if ((int)andf != 0)
>     __builtin_abort ();
> 
>   return 0;
> }
> ...

Hm, after rewriting things like this:
...
  #pragma omp target map (tofrom: andf)
  #pragma omp parallel reduction(&&: andf)
  for (int i=0; i < 1024; ++i)
    andf = andf && 0.0;
...
it does work.

My limited openmp knowledge is not enough to decide whether the fail of
the first variant is a test-case issue, or a gcc issue.

Thanks,
- Tom

  parent reply	other threads:[~2021-05-06 14:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-06 10:17 Tobias Burnus
2021-05-06 10:30 ` Jakub Jelinek
2021-05-06 13:12   ` Tom de Vries
2021-05-06 13:22     ` Jakub Jelinek
2021-05-06 14:05     ` Tom de Vries [this message]
2021-05-06 14:21     ` Tobias Burnus
2021-05-06 14:32       ` Jakub Jelinek
2021-05-07 10:05         ` Tobias Burnus
2021-05-07 10:06           ` Jakub Jelinek
2021-05-07 10:08           ` Tom de Vries
2021-05-18 11:07           ` 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=70729ed4-80b2-c64e-7c99-abf415b23ca9@suse.de \
    --to=tdevries@suse.de \
    --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).