Re: [gomp4] Questions about "declare target" and "target update" pragmas

2015-03-19 Thread Jakub Jelinek
On Thu, Mar 19, 2015 at 09:42:58PM +0300, Ilya Verbin wrote: > Ok, got it. > > And what about global allocatable fortran arrays? I didn't find any > restrictions in the specification. Here is a reduced testcase: This really can't be supported. If you have global allocatables, you really should

Re: [gomp4] Questions about "declare target" and "target update" pragmas

2015-03-19 Thread Ilya Verbin
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

Re: [gomp4] Questions about "declare target" and "target update" pragmas

2015-03-19 Thread Jakub Jelinek
On Thu, Mar 19, 2015 at 05:49:47PM +0300, Ilya Verbin wrote: > > > void foo (int a1[]) > > > { > > > #pragma omp target > > > { > > > a1[10]++; > > > a2[10]++; > > > } > > > } > > > > That is a buggy test. int a1[] function argument is changed > > into int *a1, so it is actu

Re: [gomp4] Questions about "declare target" and "target update" pragmas

2015-03-19 Thread Ilya Verbin
On Thu, Mar 19, 2015 at 14:47:44 +0100, Jakub Jelinek wrote: > Here is untested patch. I'm going to check it in after bootstrap/regtest. Thanks. > > I am investigating run-fails on some benchmark, and have found a second > > questionable place, where a function argument overrides a global array.

Re: [gomp4] Questions about "declare target" and "target update" pragmas

2015-03-19 Thread Jakub Jelinek
On Mon, Mar 16, 2015 at 09:41:53PM +0300, Ilya Verbin wrote: > On Tue, Mar 10, 2015 at 19:52:52 +0300, Ilya Verbin wrote: > > Hi Jakub, > > > > I have one more question :) > > This testcase seems to be correct... or not? > > > > #pragma omp declare target > > extern int G; > > #pragma omp end dec

Re: [gomp4] Questions about "declare target" and "target update" pragmas

2015-03-16 Thread Ilya Verbin
On Tue, Mar 10, 2015 at 19:52:52 +0300, Ilya Verbin wrote: > Hi Jakub, > > I have one more question :) > This testcase seems to be correct... or not? > > #pragma omp declare target > extern int G; > #pragma omp end declare target > > int G; > > int main () > { > #pragma omp target update to(G

Re: [gomp4] Questions about "declare target" and "target update" pragmas

2015-03-10 Thread Ilya Verbin
Hi Jakub, I have one more question :) This testcase seems to be correct... or not? #pragma omp declare target extern int G; #pragma omp end declare target int G; int main () { #pragma omp target update to(G) return 0; } If yes, then we have a problem that the decl of G in varpool_node::ge

Re: [gomp4] Questions about "declare target" and "target update" pragmas

2014-07-08 Thread Ilya Verbin
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

Fwd: [gomp4] Questions about "declare target" and "target update" pragmas

2014-01-30 Thread Ilya Verbin
One more question. Is it valid to use arr[MAX/2..MAX] on target? #define MAX 20 void foo () { int arr[MAX]; #pragma omp target map(from: arr[0:MAX/2]) { int i; for (i = 0; i < MAX; i++) arr[i] = i; } } In this case GOMP_target gets sizes[0]==40 as input. Due to t

Re: [gomp4] Questions about "declare target" and "target update" pragmas

2014-01-28 Thread Jakub Jelinek
On Tue, Jan 28, 2014 at 09:54:09PM +0400, Ilya Verbin wrote: > Yes, when G is global variable marked with 'declare target', everything works > fine. But this testcase crashes at runtime in GOMP_target_update: > > int main () > { > int G = 2; > #pragma omp target update to(G) > G = 3; > in

Re: [gomp4] Questions about "declare target" and "target update" pragmas

2014-01-28 Thread Ilya Verbin
2014/1/22 Jakub Jelinek : > This can print 3 (if doing host fallback or device shares address space > with host), or 2 (otherwise). It shouldn't print 1 ever, and yes, > the target update is then well defined. All variables from omp declare > target are allocated on the device sometime before > t

Re: [gomp4] Questions about "declare target" and "target update" pragmas

2014-01-22 Thread Jakub Jelinek
On Wed, Jan 22, 2014 at 07:51:51PM +0400, Ilya Verbin wrote: > I have 2 questions concerning OpenMP 4.0 specification. > > > 1. Do I understand correctly that every "declare target" directive should be > closed with "end declare target"? E.g. in this example GCC marks both foo1 > and > foo2 wi

[gomp4] Questions about "declare target" and "target update" pragmas

2014-01-22 Thread Ilya Verbin
Hi Jakub, I have 2 questions concerning OpenMP 4.0 specification. 1. Do I understand correctly that every "declare target" directive should be closed with "end declare target"? E.g. in this example GCC marks both foo1 and foo2 with "omp declare target" attribute: #pragma omp declare target in