Re: [gomp4.5] Handle #pragma omp declare target link

2019-06-26 Thread Thomas Schwinge
Hi! On Mon, 14 Dec 2015 20:17:33 +0300, Ilya Verbin wrote: > Here is an updated patch [for "#pragma omp declare target link"] ..., that got committed long ago (trunk r231655), with additional changes later on. As has later been filed in PR81689, the test case added "libgomp.c/target-link-1.c fa

Re: [gomp4.5] Handle #pragma omp declare target link

2015-12-16 Thread Thomas Schwinge
Hi! On Mon, 14 Dec 2015 20:17:33 +0300, Ilya Verbin wrote: > [updated patch] This regresses libgomp.oacc-c-c++-common/declare-4.c compilation for nvptx offloading: spawn [...]/build-gcc/gcc/xgcc -B[...]/build-gcc/gcc/ [...]/source-gcc/libgomp/testsuite/libgomp.oacc-c/../libgomp.oacc-c-c++-

gomp_target_fini (was: [gomp4.5] Handle #pragma omp declare target link)

2015-12-16 Thread Thomas Schwinge
Hi! On Mon, 14 Dec 2015 19:47:36 +0300, Ilya Verbin wrote: > On Fri, Dec 11, 2015 at 18:27:13 +0100, Jakub Jelinek wrote: > > On Tue, Dec 08, 2015 at 05:45:59PM +0300, Ilya Verbin wrote: > > > +/* This function finalizes all initialized devices. */ > > > + > > > +static void > > > +gomp_target_f

Re: [gomp4.5] Handle #pragma omp declare target link

2015-12-15 Thread Jakub Jelinek
On Mon, Dec 14, 2015 at 08:17:33PM +0300, Ilya Verbin wrote: > Here is an updated patch. Now MSB is set in both tables, and > gomp_unload_image_from_device is changed. I've verified using simple DSO > testcase, that memory on target is freed after dlclose. > bootstrap and make check on x86_64-lin

Re: [gomp4.5] Handle #pragma omp declare target link

2015-12-14 Thread Ilya Verbin
On Mon, Nov 30, 2015 at 21:49:02 +0100, Jakub Jelinek wrote: > On Mon, Nov 30, 2015 at 11:29:34PM +0300, Ilya Verbin wrote: > > > This looks wrong, both of these clearly could affect anything with > > > DECL_HAS_VALUE_EXPR_P, not just the link vars. > > > So, if you need to handle the "omp declare

Re: [gomp4.5] Handle #pragma omp declare target link

2015-12-14 Thread Ilya Verbin
On Fri, Dec 11, 2015 at 18:27:13 +0100, Jakub Jelinek wrote: > On Tue, Dec 08, 2015 at 05:45:59PM +0300, Ilya Verbin wrote: > > @@ -356,6 +361,11 @@ gomp_map_vars (struct gomp_device_descr *devicep, > > size_t mapnum, > > } > > > >gomp_mutex_lock (&devicep->lock); > > + if (devicep->st

Re: [gomp4.5] Handle #pragma omp declare target link

2015-12-11 Thread Ilya Verbin
On Fri, Dec 11, 2015 at 18:27:13 +0100, Jakub Jelinek wrote: > On Tue, Dec 08, 2015 at 05:45:59PM +0300, Ilya Verbin wrote: > > --- a/libgomp/oacc-init.c > > +++ b/libgomp/oacc-init.c > > @@ -306,10 +306,11 @@ acc_shutdown_1 (acc_device_t d) > > { > >struct gomp_device_descr *acc_dev =

Re: [gomp4.5] Handle #pragma omp declare target link

2015-12-11 Thread Jakub Jelinek
On Tue, Dec 08, 2015 at 05:45:59PM +0300, Ilya Verbin wrote: > --- a/libgomp/oacc-init.c > +++ b/libgomp/oacc-init.c > @@ -306,10 +306,11 @@ acc_shutdown_1 (acc_device_t d) > { >struct gomp_device_descr *acc_dev = &base_dev[i]; >gomp_mutex_lock (&acc_dev->lock); > - if (ac

Re: [gomp4.5] Handle #pragma omp declare target link

2015-12-08 Thread Ilya Verbin
On Tue, Dec 01, 2015 at 20:05:04 +0100, Jakub Jelinek wrote: > This is racy, tsan would tell you so. > Instead of a global var, I'd just change the devicep->is_initialized > field from bool into a 3 state field (perhaps enum), with states > uninitialized, initialized, finalized, and then say in re

Re: [gomp4.5] Handle #pragma omp declare target link

2015-12-01 Thread Jakub Jelinek
On Tue, Dec 01, 2015 at 08:29:27PM +0300, Ilya Verbin wrote: > libgomp/ > * target.c (finalized): New static variable. > (resolve_device): Do nothing when finalized is true. > (GOMP_offload_register_ver): Likewise. > (GOMP_offload_unregister_ver): Likewise. > (gomp_tar

Re: [gomp4.5] Handle #pragma omp declare target link

2015-12-01 Thread Ilya Verbin
On Tue, Dec 01, 2015 at 14:15:59 +0100, Jakub Jelinek wrote: > On Tue, Dec 01, 2015 at 11:48:51AM +0300, Ilya Verbin wrote: > > > On 01 Dec 2015, at 11:18, Jakub Jelinek wrote: > > >> On Mon, Nov 30, 2015 at 11:55:20PM +0300, Ilya Verbin wrote: > > >> Ok, but it doesn't solve the issue with doing

Re: [gomp4.5] Handle #pragma omp declare target link

2015-12-01 Thread Jakub Jelinek
On Tue, Dec 01, 2015 at 11:48:51AM +0300, Ilya Verbin wrote: > > > On 01 Dec 2015, at 11:18, Jakub Jelinek wrote: > > > >> On Mon, Nov 30, 2015 at 11:55:20PM +0300, Ilya Verbin wrote: > >> Ok, but it doesn't solve the issue with doing it for the executable, > >> because > >> gomp_unmap_tgt (n->

Re: [gomp4.5] Handle #pragma omp declare target link

2015-12-01 Thread Ilya Verbin
> On 01 Dec 2015, at 11:18, Jakub Jelinek wrote: > >> On Mon, Nov 30, 2015 at 11:55:20PM +0300, Ilya Verbin wrote: >> Ok, but it doesn't solve the issue with doing it for the executable, because >> gomp_unmap_tgt (n->tgt) will want to run free_func on uninitialized device. > > ?? You mean that

Re: [gomp4.5] Handle #pragma omp declare target link

2015-12-01 Thread Jakub Jelinek
On Mon, Nov 30, 2015 at 11:55:20PM +0300, Ilya Verbin wrote: > Ok, but it doesn't solve the issue with doing it for the executable, because > gomp_unmap_tgt (n->tgt) will want to run free_func on uninitialized device. ?? You mean that the devicep->unload_image_func (devicep->target_id, version, ta

Re: [gomp4.5] Handle #pragma omp declare target link

2015-11-30 Thread Ilya Verbin
On Mon, Nov 30, 2015 at 21:49:02 +0100, Jakub Jelinek wrote: > On Mon, Nov 30, 2015 at 11:29:34PM +0300, Ilya Verbin wrote: > > You're right, it doesn't deallocate memory on the device if DSO leaves > > nonzero > > refcount. And currently host compiler doesn't set MSB in host_var_table, > > it's

Re: [gomp4.5] Handle #pragma omp declare target link

2015-11-30 Thread Jakub Jelinek
On Mon, Nov 30, 2015 at 11:29:34PM +0300, Ilya Verbin wrote: > > This looks wrong, both of these clearly could affect anything with > > DECL_HAS_VALUE_EXPR_P, not just the link vars. > > So, if you need to handle the "omp declare target link" vars specially, > > you should only handle those special

Re: [gomp4.5] Handle #pragma omp declare target link

2015-11-30 Thread Ilya Verbin
On Mon, Nov 30, 2015 at 13:04:59 +0100, Jakub Jelinek wrote: > On Fri, Nov 27, 2015 at 07:50:09PM +0300, Ilya Verbin wrote: > > + /* Most significant bit of the size marks such vars. */ > > + unsigned HOST_WIDE_INT isize = tree_to_uhwi (size); > > + isize |= 1ULL << (int_size_in_bytes

Re: [gomp4.5] Handle #pragma omp declare target link

2015-11-30 Thread Jakub Jelinek
On Fri, Nov 27, 2015 at 07:50:09PM +0300, Ilya Verbin wrote: > On Thu, Nov 19, 2015 at 16:31:15 +0100, Jakub Jelinek wrote: > > On Mon, Nov 16, 2015 at 06:40:43PM +0300, Ilya Verbin wrote: > > > @@ -2009,7 +2010,8 @@ scan_sharing_clauses (tree clauses, omp_context > > > *ctx) > > > decl = OMP_

Re: [gomp4.5] Handle #pragma omp declare target link

2015-11-27 Thread Ilya Verbin
On Thu, Nov 19, 2015 at 16:31:15 +0100, Jakub Jelinek wrote: > On Mon, Nov 16, 2015 at 06:40:43PM +0300, Ilya Verbin wrote: > > @@ -2009,7 +2010,8 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) > > decl = OMP_CLAUSE_DECL (c); > > /* Global variables with "omp declare target" a

Re: [gomp4.5] Handle #pragma omp declare target link

2015-11-19 Thread Jakub Jelinek
On Mon, Nov 16, 2015 at 06:40:43PM +0300, Ilya Verbin wrote: > Here is WIP patch, not for check-in. There are still many FIXMEs, which I am > going to resolve, however target-link-1.c testcase pass. > Is this approach correct? Any comments on FIXMEs? > > > diff --git a/gcc/c/c-parser.c b/gcc/c/

[gomp4.5] Handle #pragma omp declare target link

2015-11-16 Thread Ilya Verbin
Hi! On Mon, Oct 26, 2015 at 20:49:40 +0100, Jakub Jelinek wrote: > On Mon, Oct 26, 2015 at 10:39:04PM +0300, Ilya Verbin wrote: > > > Without declare target link or to, you can't use the global variables > > > in orphaned accelerated routines (unless you e.g. take the address of the > > > mapped v