This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 7/n] OpenMP 4.0 offloading infrastructure: testsuite


On 17 Oct 16:14, Jakub Jelinek wrote:
> > -volatile int v;
> > +volatile int v = 0;
> 
> Why?

Ok, I'll revert it back.

> > --- a/libgomp/testsuite/libgomp.c/target-7.c
> > +++ b/libgomp/testsuite/libgomp.c/target-7.c
> > @@ -1,7 +1,9 @@
> > +// { dg-require-effective-target offload_device }
> > +
> 
> Why?  The test was specially written such that it tests
> host fallback (if f is true) too.

> >  void
> >  foo (int f)
> > @@ -18,7 +20,7 @@ foo (int f)
> >    if (omp_get_level () != 0 || !omp_is_initial_device ())
> >      abort ();
> >    #pragma omp target if (v <= 1)
> > -  if (omp_get_level () != 0 || (f && !omp_is_initial_device ()))
> > +  if (omp_get_level () != 0 || omp_is_initial_device ())
> >      abort ();
> >    #pragma omp target device (d) if (v <= 1)
> >    if (omp_get_level () != 0 || (f && !omp_is_initial_device ()))
> > @@ -30,7 +32,7 @@ foo (int f)
> >    if (omp_get_level () != 0 || !omp_is_initial_device ())
> >      abort ();
> >    #pragma omp target if (1)
> > -  if (omp_get_level () != 0 || (f && !omp_is_initial_device ()))
> > +  if (omp_get_level () != 0 || omp_is_initial_device ())
> >      abort ();
> >    #pragma omp target device (d) if (1)
> >    if (omp_get_level () != 0 || (f && !omp_is_initial_device ()))
> > @@ -59,7 +61,7 @@ foo (int f)
> >    #pragma omp target data if (v <= 1) map (to: h)
> >    {
> >      #pragma omp target if (v <= 1)
> > -    if (omp_get_level () != 0 || (f && !omp_is_initial_device ()) || h++ != 8)
> > +    if (omp_get_level () != 0 || omp_is_initial_device () || h++ != 8)
> >        abort ();
> >      #pragma omp target update if (v <= 1) from (h)
> >    }
> > @@ -87,7 +89,7 @@ foo (int f)
> >    #pragma omp target data if (1) map (to: h)
> >    {
> >      #pragma omp target if (1)
> > -    if (omp_get_level () != 0 || (f && !omp_is_initial_device ()) || h++ != 12)
> > +    if (omp_get_level () != 0 || omp_is_initial_device () || h++ != 12)
> >        abort ();
> >      #pragma omp target update if (1) from (h)
> >    }
> 
> I don't understand any of these changes.

Here in the original test you have:

  #pragma omp target if (v <= 1)
  if (omp_get_level () != 0 || (f && !omp_is_initial_device ()))
    abort ();
  #pragma omp target device (d) if (v <= 1)
  if (omp_get_level () != 0 || (f && !omp_is_initial_device ()))
    abort ();

There are 2 same if-statements, but target pragmas have different clauses.
The second depends on device (d), and (f && !omp_is_initial_device ()) works
fine.  But the first one doesn't depend on 'f', and if we have offload device,
this check will fail.

So, to have this test working both with offloading and fallback, we need to
remove all pragmas without device-clause.

  -- Ilya


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]