Hi!

On Thu, 11 Jun 2015 14:14:20 +0200, Jakub Jelinek <ja...@redhat.com> wrote:
> On Tue, Jun 09, 2015 at 09:36:08PM +0300, Ilya Verbin wrote:
> > On Wed, Apr 29, 2015 at 14:06:44 +0200, Jakub Jelinek wrote:
> > > [...] The draft requires only alloc or to
> > > (or always, variants) for enter data and only from or delete (or always,
> > > variants) for exit data, so in theory it is possible to figure that from
> > > the call without extra args, but not so for update - enter data is 
> > > supposed
> > > to increment reference counts, exit data decrement. [...]
> > 
> > TR3.pdf also says about 'release' map-type for exit data, but it is not
> > described in the document.
> 
> So, I've committed a patch to add parsing release map-kind, and fix up or add
> verification in C/C++ FE what map-kinds are used.
> 
> Furthermore, it seems the OpenMP 4.1 always modifier is something completely
> unrelated to the OpenACC force flag, in OpenMP 4.1 everything is reference
> count based, and always seems to make a difference only for from/to/tofrom,
> where it says that the copying is done unconditionally; thus the patch uses
> a different bit for that.

Aha, I see.  (The poor OpenACC/OpenMP users, having to remember so may
small yet intricate details...)

> include/
>       * gomp-constants.h (GOMP_MAP_FLAG_ALWAYS): Define.
>       (enum gomp_map_kind): Add GOMP_MAP_ALWAYS_TO, GOMP_MAP_ALWAYS_FROM,
>       GOMP_MAP_ALWAYS_TOFROM, GOMP_MAP_DELETE, GOMP_MAP_RELEASE.

> --- include/gomp-constants.h.jj       2015-05-21 11:12:09.000000000 +0200
> +++ include/gomp-constants.h  2015-06-11 11:24:32.041654947 +0200
> @@ -41,6 +41,8 @@
>  #define GOMP_MAP_FLAG_SPECIAL_1              (1 << 3)
>  #define GOMP_MAP_FLAG_SPECIAL                (GOMP_MAP_FLAG_SPECIAL_1 \
>                                        | GOMP_MAP_FLAG_SPECIAL_0)
> +/* OpenMP always flag.  */
> +#define GOMP_MAP_FLAG_ALWAYS         (1 << 6)
>  /* Flag to force a specific behavior (or else, trigger a run-time error).  */
>  #define GOMP_MAP_FLAG_FORCE          (1 << 7)
>  
> @@ -77,7 +79,21 @@ enum gomp_map_kind
>      /* ..., and copy from device.  */
>      GOMP_MAP_FORCE_FROM =            (GOMP_MAP_FLAG_FORCE | GOMP_MAP_FROM),
>      /* ..., and copy to and from device.  */
> -    GOMP_MAP_FORCE_TOFROM =          (GOMP_MAP_FLAG_FORCE | GOMP_MAP_TOFROM)
> +    GOMP_MAP_FORCE_TOFROM =          (GOMP_MAP_FLAG_FORCE | GOMP_MAP_TOFROM),
> +    /* If not already present, allocate.  And unconditionally copy to
> +       device.  */
> +    GOMP_MAP_ALWAYS_TO =             (GOMP_MAP_FLAG_ALWAYS | GOMP_MAP_TO),
> +    /* If not already present, allocate.  And unconditionally copy from
> +       device.  */
> +    GOMP_MAP_ALWAYS_FROM =           (GOMP_MAP_FLAG_ALWAYS | GOMP_MAP_FROM),
> +    /* If not already present, allocate.  And unconditionally copy to and 
> from
> +       device.  */
> +    GOMP_MAP_ALWAYS_TOFROM =         (GOMP_MAP_FLAG_ALWAYS | 
> GOMP_MAP_TOFROM),
> +    /* OpenMP 4.1 alias for forced deallocation.  */
> +    GOMP_MAP_DELETE =                        GOMP_MAP_FORCE_DEALLOC,

To avoid confusion about two different identifiers naming the same
functionality, I'd prefer to avoid such aliases ("GOMP_MAP_DELETE =
GOMP_MAP_FORCE_DEALLOC"), and instead just rename GOMP_MAP_FORCE_DEALLOC
to GOMP_MAP_DELETE, if that's the name you prefer.

By the way, looking at GCC 6 libgomp compatibility regarding
OpenACC/nvptx offloading for executables compiled with GCC 5, for the
legacy entry point libgomp/oacc-parallel.c:GOACC_parallel only supports
host-fallback execution, which doesn't pay attention to data clause at
all (sizes and kinds formal parameters), so you're free to renumber
GOMP_MAP_* if/where that makes sense.

> +    /* Decrement usage count and deallocate if zero.  */
> +    GOMP_MAP_RELEASE =                       (GOMP_MAP_FLAG_ALWAYS
> +                                      | GOMP_MAP_FORCE_DEALLOC)
>    };

I have not yet read the OpenMP 4.1/4.5 standard, but it's not obvious to
me here how the GOMP_MAP_FLAG_ALWAYS flag relates to the OpenMP release
clause (GOMP_MAP_RELEASE here)?  Shouldn't GOMP_MAP_RELEASE be
"(GOMP_MAP_FLAG_SPECIAL_1 | 3)" or similar?


Grüße
 Thomas

Attachment: signature.asc
Description: PGP signature

Reply via email to