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 15:12:59 +0200 [thread overview]
Message-ID: <5d23ae62-4812-e80b-2f4b-95be9603bcee@suse.de> (raw)
In-Reply-To: <20210506103019.GZ1179226@tucnak>
[-- Attachment #1: Type: text/plain, Size: 1103 bytes --]
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;
}
...
Thanks,
- Tom
[-- Attachment #2: tmp.patch --]
[-- Type: text/x-patch, Size: 1184 bytes --]
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 26ceaf74b2d..d8f2487054f 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -4389,14 +4389,28 @@ lower_rec_simd_input_clauses (tree new_var, omp_context *ctx,
{
for (tree c = gimple_omp_for_clauses (ctx->stmt); c;
c = OMP_CLAUSE_CHAIN (c))
- if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_REDUCTION
- && OMP_CLAUSE_REDUCTION_PLACEHOLDER (c))
- {
- /* UDR reductions are not supported yet for SIMT, disable
- SIMT. */
- sctx->max_vf = 1;
- break;
- }
+ {
+ if (OMP_CLAUSE_CODE (c) != OMP_CLAUSE_REDUCTION)
+ continue;
+
+ if (OMP_CLAUSE_REDUCTION_PLACEHOLDER (c))
+ {
+ /* UDR reductions are not supported yet for SIMT, disable
+ SIMT. */
+ sctx->max_vf = 1;
+ break;
+ }
+
+ if (truth_value_p (OMP_CLAUSE_REDUCTION_CODE (c))
+ && TREE_CODE (TREE_TYPE (new_var)) != BOOLEAN_TYPE)
+ {
+ /* Doing boolean operations on non-boolean types is
+ for conformance only, it's not worth supporting this
+ for SIMT. */
+ sctx->max_vf = 1;
+ break;
+ }
+ }
}
if (maybe_gt (sctx->max_vf, 1U))
{
next prev parent reply other threads:[~2021-05-06 13:13 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 [this message]
2021-05-06 13:22 ` Jakub Jelinek
2021-05-06 14:05 ` Tom de Vries
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=5d23ae62-4812-e80b-2f4b-95be9603bcee@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).