diff mbox

[1/5] OpenACC 2.0 support for libgomp - OpenACC runtime, NVidia PTX/CUDA plugin (repost)

Message ID 871tnrzio8.fsf@kepler.schwinge.homeip.net
State New
Headers show

Commit Message

Thomas Schwinge Dec. 22, 2014, 5:41 p.m. UTC
Hi!

On Tue, 11 Nov 2014 13:53:23 +0000, Julian Brown <julian@codesourcery.com> wrote:
> On Tue, 23 Sep 2014 19:19:31 +0100
> Julian Brown <julian@codesourcery.com> wrote:
> 
> > This patch contains the bulk of the OpenACC 2.0 runtime support,
> > building around, or on top of, the OpenMP 4.0 support (as previously
> > posted or already extant upstream) where we could. [...]
> 
> Here is a new version of the OpenACC support patch for libgomp, rebased
> on top of a version of Ilya Verbin's patches that I merged to a local
> clone of trunk, and tested as far as possible without the
> middle/front-end pieces, since those are not ready yet.

> --- a/libgomp/target.c
> +++ b/libgomp/target.c

Code is split off of gomp_init_device into the new gomp_init_tables:

>  gomp_init_device (struct gomp_device_descr *devicep)
>  {
> +  /* Initialize the target device.  */
>    devicep->init_device_func (devicep->target_id);
> +  
> +  devicep->is_initialized = true;
> +}
>  
> +attribute_hidden void
> +gomp_init_tables (const struct gomp_device_descr *devicep,
> +		  struct gomp_memory_mapping *mm)
> +{
>    /* Get address mapping table for device.  */
>    struct mapping_table *table = NULL;
> [...]

..., and a new function gomp_init_dev_tables added to call both of them:

> +static void
> +gomp_init_dev_tables (struct gomp_device_descr *devicep)
> +{
> +  gomp_init_device (devicep);
> +  gomp_init_tables (devicep, &devicep->mem_map);
> +}

..., which is then used in GOMP_target:

> @@ -673,7 +753,12 @@ GOMP_target (int device, void (*fn) (void *), const void *openmp_target,

> +  if (devicep != NULL && !devicep->is_initialized)
> +    gomp_init_dev_tables (devicep);

..., and GOMP_target_data:

> @@ -724,7 +818,12 @@ GOMP_target_data (int device, const void *openmp_target, size_t mapnum,

> +  if (devicep != NULL && !devicep->is_initialized)
> +    gomp_init_dev_tables (devicep);

..., but not in GOMP_target_update:

> @@ -771,15 +871,18 @@ GOMP_target_update (int device, const void *openmp_target, size_t mapnum,

> +  if (devicep != NULL && !devicep->is_initialized)
>      gomp_init_device (devicep);

Committed to gomp-4_0-branch in r219023:

commit 0020b7972a6f7f422bd9d4782021ff5b8e2b0f50
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Mon Dec 22 17:40:37 2014 +0000

    libgomp: Restore code that initializes the address mapping tables in GOMP_target_update.
    
    	libgomp/
    	* target.c (GOMP_target_update): To initialize, call
    	gomp_init_dev_tables instead of gomp_init_device.
    
    With Intel MIC offloading (emulation), this fixes cases of "#pragma omp declare
    target" of variables, followed by "#pragma omp target update to([...])" before
    any "#pragma omp target" or "#pragma omp target data" is called:
    
        FAIL: libgomp.c/examples-4/e.53.3.c execution test
        FAIL: libgomp.c/examples-4/e.53.4.c execution test
        FAIL: libgomp.c/examples-4/e.53.5.c execution test
        FAIL: libgomp.fortran/examples-4/e.53.3.f90   -O0  execution test
        FAIL: libgomp.fortran/examples-4/e.53.3.f90   -O1  execution test
        FAIL: libgomp.fortran/examples-4/e.53.3.f90   -O2  execution test
        FAIL: libgomp.fortran/examples-4/e.53.3.f90   -O3 -fomit-frame-pointer  execution test
        FAIL: libgomp.fortran/examples-4/e.53.3.f90   -O3 -fomit-frame-pointer -funroll-loops  execution test
        FAIL: libgomp.fortran/examples-4/e.53.3.f90   -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions  execution test
        FAIL: libgomp.fortran/examples-4/e.53.3.f90   -O3 -g  execution test
        FAIL: libgomp.fortran/examples-4/e.53.3.f90   -Os  execution test
        FAIL: libgomp.fortran/examples-4/e.53.4.f90   -O0  execution test
        FAIL: libgomp.fortran/examples-4/e.53.4.f90   -O1  execution test
        FAIL: libgomp.fortran/examples-4/e.53.4.f90   -O2  execution test
        FAIL: libgomp.fortran/examples-4/e.53.4.f90   -O3 -fomit-frame-pointer  execution test
        FAIL: libgomp.fortran/examples-4/e.53.4.f90   -O3 -fomit-frame-pointer -funroll-loops  execution test
        FAIL: libgomp.fortran/examples-4/e.53.4.f90   -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions  execution test
        FAIL: libgomp.fortran/examples-4/e.53.4.f90   -O3 -g  execution test
        FAIL: libgomp.fortran/examples-4/e.53.4.f90   -Os  execution test
        FAIL: libgomp.fortran/examples-4/e.53.5.f90   -O0  execution test
        FAIL: libgomp.fortran/examples-4/e.53.5.f90   -O1  execution test
        FAIL: libgomp.fortran/examples-4/e.53.5.f90   -O2  execution test
        FAIL: libgomp.fortran/examples-4/e.53.5.f90   -O3 -fomit-frame-pointer  execution test
        FAIL: libgomp.fortran/examples-4/e.53.5.f90   -O3 -fomit-frame-pointer -funroll-loops  execution test
        FAIL: libgomp.fortran/examples-4/e.53.5.f90   -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions  execution test
        FAIL: libgomp.fortran/examples-4/e.53.5.f90   -O3 -g  execution test
        FAIL: libgomp.fortran/examples-4/e.53.5.f90   -Os  execution test
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@219023 138bc75d-0d04-0410-961f-82ee72b054a4
---
 libgomp/ChangeLog.gomp | 3 +++
 libgomp/target.c       | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)



Grüße,
 Thomas
diff mbox

Patch

diff --git libgomp/ChangeLog.gomp libgomp/ChangeLog.gomp
index 26fdfe6..3aa9bf4 100644
--- libgomp/ChangeLog.gomp
+++ libgomp/ChangeLog.gomp
@@ -1,5 +1,8 @@ 
 2014-12-22  Thomas Schwinge  <thomas@codesourcery.com>
 
+	* target.c (GOMP_target_update): To initialize, call
+	gomp_init_dev_tables instead of gomp_init_device.
+
 	* target.c (gomp_map_vars) <GOMP_MAP_TO_PSET>: Revert earlier
 	changes.
 
diff --git libgomp/target.c libgomp/target.c
index 423bbee..8517a84 100644
--- libgomp/target.c
+++ libgomp/target.c
@@ -891,7 +891,7 @@  GOMP_target_update (int device, const void *offload_table, size_t mapnum,
   struct gomp_memory_mapping *mm = &devicep->mem_map;
   gomp_mutex_lock (&mm->lock);
   if (!devicep->is_initialized)
-    gomp_init_device (devicep);
+    gomp_init_dev_tables (devicep);
   gomp_mutex_unlock (&mm->lock);
 
   if (!(devicep->capabilities & GOMP_OFFLOAD_CAP_OPENMP_400))