This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 7/n] OpenMP 4.0 offloading infrastructure: testsuite
- From: Ilya Verbin <iverbin at gmail dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org, Bernd Schmidt <bernds at codesourcery dot com>, Thomas Schwinge <thomas at codesourcery dot com>, Kirill Yukhin <kirill dot yukhin at gmail dot com>, Andrey Turetskiy <andrey dot turetskiy at gmail dot com>
- Date: Fri, 17 Oct 2014 18:58:17 +0400
- Subject: Re: [PATCH 7/n] OpenMP 4.0 offloading infrastructure: testsuite
- Authentication-results: sourceware.org; auth=none
- References: <20141015145752 dot GB46277 at msticlxl57 dot ims dot intel dot com> <20141015150543 dot GR10376 at tucnak dot redhat dot com> <20141015152837 dot GC46277 at msticlxl57 dot ims dot intel dot com> <20141015153518 dot GS10376 at tucnak dot redhat dot com> <20141017140211 dot GA28310 at msticlxl57 dot ims dot intel dot com> <20141017141455 dot GY10376 at tucnak dot redhat dot com>
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