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

Reply via email to