This is the mail archive of the
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 at gcc dot gnu dot org, Kirill Yukhin <kirill dot yukhin at gmail dot com>
- Date: Thu, 19 Mar 2015 21:42:58 +0300
- 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> <20150310165252 dot GC37666 at msticlxl57 dot ims dot intel dot com> <20150316184153 dot GA42550 at msticlxl57 dot ims dot intel dot com> <20150319134744 dot GW1746 at tucnak dot redhat dot com> <20150319144947 dot GA20881 at msticlxl57 dot ims dot intel dot com> <20150319145710 dot GY1746 at tucnak dot redhat dot com>
On Thu, Mar 19, 2015 at 15:57:10 +0100, Jakub Jelinek wrote:
> On Thu, Mar 19, 2015 at 05:49:47PM +0300, Ilya Verbin wrote:
> > If I understand correctly, it's not allowed to map global target arrays this
> > way, since it's already present in the initial device data environment:
> It of course is allowed. It just means that it doesn't allocate new memory
> (sizeof(int) large in the map(a1) case, sizeof(int)*50 large in the map(a1[0:50])
> case), nor copy the bytes around, all it will do is allocate memory for the
> target copy of the a1 pointer, and do pointer transformation such that the
> a1 pointer on the target will point to the global target a1 array.
> Without the map(a1) or map(a1[0:50]) clauses (i.e. implicit map(tofrom:a1))
> it does similar thing, except it copies the pointer value to the target (and
> back at the end of the region) instead, which is not what you want...
Ok, got it.
And what about global allocatable fortran arrays? I didn't find any
restrictions in the specification. Here is a reduced testcase:
integer, allocatable, target :: x(:)
!$omp declare target(x)
end module test
integer :: n = 1000
!$omp target map(x(1:n))
x(123) = 456
!$omp end target
It crashes on target with NULL-pointer access, however the memory for x(1:n) is
allocated on target. Looks like there's something wrong with pointer
transformation. Is this a wrong testcase or a bug in gcc?