This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [gomp4] Questions about "declare target" and "target update" pragmas
- From: Ilya Verbin <iverbin at gmail dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: GCC Development <gcc at gcc dot gnu dot org>
- Date: Tue, 8 Jul 2014 22:31:17 +0400
- Subject: Re: [gomp4] Questions about "declare target" and "target update" pragmas
- Authentication-results: sourceware.org; auth=none
- References: <20140122155151 dot GA50489 at msticlxl57 dot ims dot intel dot com> <20140122160209 dot GV892 at tucnak dot redhat dot com> <CADG=Z0HfieHLep+CQCxdyVe5_bSHT6K08YW+qGwvds5c8tBOyA at mail dot gmail dot com> <20140128213855 dot GO892 at tucnak dot redhat dot com>
Hi Jakub,
I discovered an issue related to global variables.
In this testcase the 'omp target' child fn uses the local copy of glob_var.
But the 'omp parallel' child fn tries to use the glob_var directly and therefore
crashes.
int glob_var;
void
foo (void)
{
glob_var = 1;
#pragma omp target map(to: glob_var)
{
glob_var = 2;
#pragma omp parallel
{
glob_var = 3;
}
}
}
In the spec I found only that if a variable is not present in the enclosing
device data environment, then it is allocated in the device data environment
associated with the construct. Effectively this means glob_var become a
non-global variable within the omp_target construct. Then it's not quite clear
what type of glob_var should be in case target is not present and we fallback to
host execution.
Should we forbid 'omp target' to map global vars that are not defined as target?
Or force 'omp parallel' to use local copies inside the target regions?
(ICC reports an error about mapping glob_var for this testcase)
-- Ilya