The clause makes any device code use the local memory address for each
of the variables specified unless the given variable is already present
on the current device.
2018-12-19 Julian Brown <julian@codesourcery.com>
Maciej W. Rozycki <macro@codesourcery.com>
gcc/
* omp-low.c (lower_omp_target): Support GOMP_MAP_NO_ALLOC.
* tree-pretty-print.c (dump_omp_clause): Likewise.
gcc/c-family/
* c-pragma.h (pragma_omp_clause): Add
PRAGMA_OACC_CLAUSE_NO_CREATE.
gcc/c/
* c-parser.c (c_parser_omp_clause_name): Support no_create.
(c_parser_oacc_data_clause): Likewise.
(c_parser_oacc_all_clauses): Likewise.
(OACC_DATA_CLAUSE_MASK, OACC_KERNELS_CLAUSE_MASK)
(OACC_PARALLEL_CLAUSE_MASK, OACC_SERIAL_CLAUSE_MASK): Add
PRAGMA_OACC_CLAUSE_NO_CREATE.
* c-typeck.c (handle_omp_array_sections): Support
GOMP_MAP_NO_ALLOC.
gcc/cp/
* parser.c (cp_parser_omp_clause_name): Support no_create.
(cp_parser_oacc_data_clause): Likewise.
(cp_parser_oacc_all_clauses): Likewise.
(OACC_DATA_CLAUSE_MASK, OACC_KERNELS_CLAUSE_MASK)
(OACC_PARALLEL_CLAUSE_MASK, OACC_SERIAL_CLAUSE_MASK): Add
PRAGMA_OACC_CLAUSE_NO_CREATE.
* semantics.c (handle_omp_array_sections): Support no_create.
gcc/fortran/
* gfortran.h (gfc_omp_map_op): Add OMP_MAP_NO_ALLOC.
* openmp.c (omp_mask2): Add OMP_CLAUSE_NO_CREATE.
(gfc_match_omp_clauses): Support no_create.
(OACC_PARALLEL_CLAUSES, OACC_KERNELS_CLAUSES)
(OACC_SERIAL_CLAUSES, OACC_DATA_CLAUSES): Add
OMP_CLAUSE_NO_CREATE.
* trans-openmp.c (gfc_trans_omp_clauses_1): Support
OMP_MAP_NO_ALLOC.
include/
* gomp-constants.h (gomp_map_kind): Support GOMP_MAP_NO_ALLOC.
libgomp/
* target.c (gomp_map_vars_async): Support GOMP_MAP_NO_ALLOC.
* testsuite/libgomp.oacc-c-c++-common/nocreate-1.c: New test.
* testsuite/libgomp.oacc-c-c++-common/nocreate-2.c: New test.
* testsuite/libgomp.oacc-c-c++-common/nocreate-3.c: New test.
* testsuite/libgomp.oacc-c-c++-common/nocreate-4.c: New test.
* testsuite/libgomp.oacc-fortran/nocreate-1.f90: New test.
* testsuite/libgomp.oacc-fortran/nocreate-2.f90: New test.
(cherry picked from openacc-gcc-9-branch commit
8e74c2ec2b90819c995444370e742864a685209f)
+2018-12-19 Julian Brown <julian@codesourcery.com>
+ Maciej W. Rozycki <macro@codesourcery.com>
+
+ * omp-low.c (lower_omp_target): Support GOMP_MAP_NO_ALLOC.
+ * tree-pretty-print.c (dump_omp_clause): Likewise.
+
2018-12-20 Maciej W. Rozycki <macro@codesourcery.com>
* gimple.h (gf_mask): Add GF_OMP_TARGET_KIND_OACC_SERIAL
+2018-12-19 Julian Brown <julian@codesourcery.com>
+ Maciej W. Rozycki <macro@codesourcery.com>
+
+ * c-pragma.h (pragma_omp_clause): Add
+ PRAGMA_OACC_CLAUSE_NO_CREATE.
+
2018-12-20 Maciej W. Rozycki <macro@codesourcery.com>
* c-pragma.h (pragma_kind): Add PRAGMA_OACC_SERIAL enumeration
PRAGMA_OACC_CLAUSE_GANG,
PRAGMA_OACC_CLAUSE_HOST,
PRAGMA_OACC_CLAUSE_INDEPENDENT,
+ PRAGMA_OACC_CLAUSE_NO_CREATE,
PRAGMA_OACC_CLAUSE_NOHOST,
PRAGMA_OACC_CLAUSE_NUM_GANGS,
PRAGMA_OACC_CLAUSE_NUM_WORKERS,
+2018-12-19 Julian Brown <julian@codesourcery.com>
+ Maciej W. Rozycki <macro@codesourcery.com>
+
+ * c-parser.c (c_parser_omp_clause_name): Support no_create.
+ (c_parser_oacc_data_clause): Likewise.
+ (c_parser_oacc_all_clauses): Likewise.
+ (OACC_DATA_CLAUSE_MASK, OACC_KERNELS_CLAUSE_MASK)
+ (OACC_PARALLEL_CLAUSE_MASK, OACC_SERIAL_CLAUSE_MASK): Add
+ PRAGMA_OACC_CLAUSE_NO_CREATE.
+ * c-typeck.c (handle_omp_array_sections): Support
+ GOMP_MAP_NO_ALLOC.
+
2018-12-20 Maciej W. Rozycki <macro@codesourcery.com>
* c-parser.c (OACC_SERIAL_CLAUSE_MASK): New macro.
result = PRAGMA_OMP_CLAUSE_MERGEABLE;
break;
case 'n':
- if (!strcmp ("nogroup", p))
+ if (!strcmp ("no_create", p))
+ result = PRAGMA_OACC_CLAUSE_NO_CREATE;
+ else if (!strcmp ("nogroup", p))
result = PRAGMA_OMP_CLAUSE_NOGROUP;
else if (!strcmp ("nontemporal", p))
result = PRAGMA_OMP_CLAUSE_NONTEMPORAL;
create ( variable-list )
delete ( variable-list )
detach ( variable-list )
- present ( variable-list ) */
+ present ( variable-list )
+
+ OpenACC 2.6:
+ no_create ( variable-list ) */
static tree
c_parser_oacc_data_clause (c_parser *parser, pragma_omp_clause c_kind,
case PRAGMA_OACC_CLAUSE_LINK:
kind = GOMP_MAP_LINK;
break;
+ case PRAGMA_OACC_CLAUSE_NO_CREATE:
+ kind = GOMP_MAP_NO_ALLOC;
+ break;
case PRAGMA_OACC_CLAUSE_PRESENT:
kind = GOMP_MAP_FORCE_PRESENT;
break;
clauses = c_parser_oacc_data_clause (parser, c_kind, clauses);
c_name = "link";
break;
+ case PRAGMA_OACC_CLAUSE_NO_CREATE:
+ clauses = c_parser_oacc_data_clause (parser, c_kind, clauses);
+ c_name = "no_create";
+ break;
case PRAGMA_OACC_CLAUSE_NOHOST:
clauses = c_parser_oacc_simple_clause (here, OMP_CLAUSE_NOHOST,
clauses);
| (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_CREATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_DEVICEPTR) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_IF) \
+ | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_NO_CREATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_PRESENT))
static tree
| (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_DEFAULT) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_DEVICEPTR) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_IF) \
+ | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_NO_CREATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_NUM_GANGS) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_NUM_WORKERS) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_PRESENT) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_DEFAULT) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_DEVICEPTR) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_IF) \
+ | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_NO_CREATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_PRIVATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_FIRSTPRIVATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_NUM_GANGS) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_DEFAULT) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_DEVICEPTR) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_IF) \
+ | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_NO_CREATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_PRIVATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_FIRSTPRIVATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_PRESENT) \
switch (OMP_CLAUSE_MAP_KIND (c))
{
case GOMP_MAP_ALLOC:
+ case GOMP_MAP_NO_ALLOC:
case GOMP_MAP_TO:
case GOMP_MAP_FROM:
case GOMP_MAP_TOFROM:
+2018-12-19 Julian Brown <julian@codesourcery.com>
+ Maciej W. Rozycki <macro@codesourcery.com>
+
+ * parser.c (cp_parser_omp_clause_name): Support no_create.
+ (cp_parser_oacc_data_clause): Likewise.
+ (cp_parser_oacc_all_clauses): Likewise.
+ (OACC_DATA_CLAUSE_MASK, OACC_KERNELS_CLAUSE_MASK)
+ (OACC_PARALLEL_CLAUSE_MASK, OACC_SERIAL_CLAUSE_MASK): Add
+ PRAGMA_OACC_CLAUSE_NO_CREATE.
+ * semantics.c (handle_omp_array_sections): Support no_create.
+
2018-12-20 Maciej W. Rozycki <macro@codesourcery.com>
* constexpr.c (potential_constant_expression_1): Handle
result = PRAGMA_OMP_CLAUSE_MERGEABLE;
break;
case 'n':
- if (!strcmp ("nogroup", p))
+ if (!strcmp ("no_create", p))
+ result = PRAGMA_OACC_CLAUSE_NO_CREATE;
+ else if (!strcmp ("nogroup", p))
result = PRAGMA_OMP_CLAUSE_NOGROUP;
else if (!strcmp ("nohost", p))
result = PRAGMA_OACC_CLAUSE_NOHOST;
create ( variable-list )
delete ( variable-list )
detach ( variable-list )
- present ( variable-list ) */
+ present ( variable-list )
+
+ OpenACC 2.6:
+ no_create ( variable-list ) */
static tree
cp_parser_oacc_data_clause (cp_parser *parser, pragma_omp_clause c_kind,
case PRAGMA_OACC_CLAUSE_LINK:
kind = GOMP_MAP_LINK;
break;
+ case PRAGMA_OACC_CLAUSE_NO_CREATE:
+ kind = GOMP_MAP_NO_ALLOC;
+ break;
case PRAGMA_OACC_CLAUSE_PRESENT:
kind = GOMP_MAP_FORCE_PRESENT;
break;
clauses = cp_parser_oacc_data_clause (parser, c_kind, clauses);
c_name = "link";
break;
+ case PRAGMA_OACC_CLAUSE_NO_CREATE:
+ clauses = cp_parser_oacc_data_clause (parser, c_kind, clauses);
+ c_name = "no_create";
+ break;
case PRAGMA_OACC_CLAUSE_NOHOST:
clauses = cp_parser_oacc_simple_clause (here, OMP_CLAUSE_NOHOST,
clauses);
| (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_DETACH) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_DEVICEPTR) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_IF) \
+ | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_NO_CREATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_PRESENT) )
static tree
| (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_DEFAULT) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_DEVICEPTR) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_IF) \
+ | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_NO_CREATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_NUM_GANGS) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_NUM_WORKERS) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_PRESENT) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_DEVICEPTR) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_FIRSTPRIVATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_IF) \
+ | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_NO_CREATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_NUM_GANGS) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_NUM_WORKERS) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_PRESENT) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_DEFAULT) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_DEVICEPTR) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_IF) \
+ | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_NO_CREATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_PRIVATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_FIRSTPRIVATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_PRESENT) \
switch (OMP_CLAUSE_MAP_KIND (c))
{
case GOMP_MAP_ALLOC:
+ case GOMP_MAP_NO_ALLOC:
case GOMP_MAP_TO:
case GOMP_MAP_FROM:
case GOMP_MAP_TOFROM:
+2018-12-19 Julian Brown <julian@codesourcery.com>
+ Maciej W. Rozycki <macro@codesourcery.com>
+
+ * gfortran.h (gfc_omp_map_op): Add OMP_MAP_NO_ALLOC.
+ * openmp.c (omp_mask2): Add OMP_CLAUSE_NO_CREATE.
+ (gfc_match_omp_clauses): Support no_create.
+ (OACC_PARALLEL_CLAUSES, OACC_KERNELS_CLAUSES)
+ (OACC_SERIAL_CLAUSES, OACC_DATA_CLAUSES): Add
+ OMP_CLAUSE_NO_CREATE.
+ * trans-openmp.c (gfc_trans_omp_clauses_1): Support
+ OMP_MAP_NO_ALLOC.
+
2018-12-20 Maciej W. Rozycki <macro@codesourcery.com>
* gfortran.h (gfc_statement): Add ST_OACC_SERIAL_LOOP,
enum gfc_omp_map_op
{
OMP_MAP_ALLOC,
+ OMP_MAP_NO_ALLOC,
OMP_MAP_ATTACH,
OMP_MAP_TO,
OMP_MAP_FROM,
OMP_CLAUSE_COPY,
OMP_CLAUSE_COPYOUT,
OMP_CLAUSE_CREATE,
+ OMP_CLAUSE_NO_CREATE,
OMP_CLAUSE_PRESENT,
OMP_CLAUSE_DEVICEPTR,
OMP_CLAUSE_GANG,
}
break;
case 'n':
+ if ((mask & OMP_CLAUSE_NO_CREATE)
+ && gfc_match ("no_create ( ") == MATCH_YES
+ && gfc_match_omp_map_clause (&c->lists[OMP_LIST_MAP],
+ OMP_MAP_NO_ALLOC, true,
+ allow_derived))
+ continue;
if ((mask & OMP_CLAUSE_NOGROUP)
&& !c->nogroup
&& gfc_match ("nogroup") == MATCH_YES)
(omp_mask (OMP_CLAUSE_IF) | OMP_CLAUSE_ASYNC | OMP_CLAUSE_NUM_GANGS \
| OMP_CLAUSE_NUM_WORKERS | OMP_CLAUSE_VECTOR_LENGTH | OMP_CLAUSE_REDUCTION \
| OMP_CLAUSE_COPY | OMP_CLAUSE_COPYIN | OMP_CLAUSE_COPYOUT \
- | OMP_CLAUSE_CREATE | OMP_CLAUSE_PRESENT | OMP_CLAUSE_DEVICEPTR \
- | OMP_CLAUSE_PRIVATE | OMP_CLAUSE_FIRSTPRIVATE | OMP_CLAUSE_DEFAULT \
- | OMP_CLAUSE_WAIT | OMP_CLAUSE_ATTACH)
+ | OMP_CLAUSE_CREATE | OMP_CLAUSE_NO_CREATE | OMP_CLAUSE_PRESENT \
+ | OMP_CLAUSE_DEVICEPTR | OMP_CLAUSE_PRIVATE | OMP_CLAUSE_FIRSTPRIVATE \
+ | OMP_CLAUSE_DEFAULT | OMP_CLAUSE_WAIT | OMP_CLAUSE_ATTACH)
#define OACC_KERNELS_CLAUSES \
(omp_mask (OMP_CLAUSE_IF) | OMP_CLAUSE_ASYNC | OMP_CLAUSE_NUM_GANGS \
| OMP_CLAUSE_NUM_WORKERS | OMP_CLAUSE_VECTOR_LENGTH | OMP_CLAUSE_DEVICEPTR \
| OMP_CLAUSE_COPY | OMP_CLAUSE_COPYIN | OMP_CLAUSE_COPYOUT \
- | OMP_CLAUSE_CREATE | OMP_CLAUSE_PRESENT | OMP_CLAUSE_DEFAULT \
- | OMP_CLAUSE_WAIT | OMP_CLAUSE_ATTACH)
+ | OMP_CLAUSE_CREATE | OMP_CLAUSE_NO_CREATE | OMP_CLAUSE_PRESENT \
+ | OMP_CLAUSE_DEFAULT | OMP_CLAUSE_WAIT | OMP_CLAUSE_ATTACH)
#define OACC_SERIAL_CLAUSES \
(omp_mask (OMP_CLAUSE_ASYNC) | OMP_CLAUSE_WAIT \
| OMP_CLAUSE_IF \
| OMP_CLAUSE_REDUCTION \
| OMP_CLAUSE_COPY | OMP_CLAUSE_COPYIN | OMP_CLAUSE_COPYOUT \
- | OMP_CLAUSE_CREATE | OMP_CLAUSE_PRESENT \
+ | OMP_CLAUSE_CREATE | OMP_CLAUSE_NO_CREATE | OMP_CLAUSE_PRESENT \
| OMP_CLAUSE_DEVICEPTR \
| OMP_CLAUSE_PRIVATE | OMP_CLAUSE_FIRSTPRIVATE \
| OMP_CLAUSE_DEFAULT | OMP_CLAUSE_ATTACH)
#define OACC_DATA_CLAUSES \
(omp_mask (OMP_CLAUSE_IF) | OMP_CLAUSE_DEVICEPTR | OMP_CLAUSE_COPY \
| OMP_CLAUSE_COPYIN | OMP_CLAUSE_COPYOUT | OMP_CLAUSE_CREATE \
- | OMP_CLAUSE_PRESENT | OMP_CLAUSE_ATTACH)
+ | OMP_CLAUSE_NO_CREATE | OMP_CLAUSE_PRESENT | OMP_CLAUSE_ATTACH)
#define OACC_LOOP_CLAUSES \
(omp_mask (OMP_CLAUSE_COLLAPSE) | OMP_CLAUSE_GANG | OMP_CLAUSE_WORKER \
| OMP_CLAUSE_VECTOR | OMP_CLAUSE_SEQ | OMP_CLAUSE_INDEPENDENT \
case OMP_MAP_ALLOC:
OMP_CLAUSE_SET_MAP_KIND (node, GOMP_MAP_ALLOC);
break;
+ case OMP_MAP_NO_ALLOC:
+ OMP_CLAUSE_SET_MAP_KIND (node, GOMP_MAP_NO_ALLOC);
+ break;
case OMP_MAP_ATTACH:
OMP_CLAUSE_SET_MAP_KIND (node, GOMP_MAP_ATTACH);
break;
case GOMP_MAP_STRUCT:
case GOMP_MAP_ALWAYS_POINTER:
break;
+ case GOMP_MAP_NO_ALLOC:
case GOMP_MAP_FORCE_ALLOC:
case GOMP_MAP_FORCE_TO:
case GOMP_MAP_FORCE_FROM:
switch (tkind)
{
case GOMP_MAP_ALLOC:
+ case GOMP_MAP_NO_ALLOC:
case GOMP_MAP_TO:
case GOMP_MAP_FROM:
case GOMP_MAP_TOFROM:
case GOMP_MAP_POINTER:
pp_string (pp, "alloc");
break;
+ case GOMP_MAP_NO_ALLOC:
+ pp_string (pp, "no_alloc");
+ break;
case GOMP_MAP_TO:
case GOMP_MAP_TO_PSET:
pp_string (pp, "to");
+2018-12-19 Julian Brown <julian@codesourcery.com>
+ Maciej W. Rozycki <macro@codesourcery.com>
+
+ * gomp-constants.h (gomp_map_kind): Support GOMP_MAP_NO_ALLOC.
+
2018-12-21 Gergö Barany <gergo@codesourcery.com>
* gomp-constants.h (GOACC_FLAG_HOST_DATA_IF_PRESENT): New constant.
GOMP_MAP_DEVICE_RESIDENT = (GOMP_MAP_FLAG_SPECIAL_1 | 1),
/* OpenACC link. */
GOMP_MAP_LINK = (GOMP_MAP_FLAG_SPECIAL_1 | 2),
+ /* Use device data if present, fall back to host address otherwise. */
+ GOMP_MAP_NO_ALLOC = (GOMP_MAP_FLAG_SPECIAL_1 | 3),
/* Allocate. */
GOMP_MAP_FIRSTPRIVATE = (GOMP_MAP_FLAG_SPECIAL | 0),
/* Similarly, but store the value in the pointer rather than
+2018-12-19 Julian Brown <julian@codesourcery.com>
+ Maciej W. Rozycki <macro@codesourcery.com>
+
+ * target.c (gomp_map_vars_async): Support GOMP_MAP_NO_ALLOC.
+
+ * testsuite/libgomp.oacc-c-c++-common/nocreate-1.c: New test.
+ * testsuite/libgomp.oacc-c-c++-common/nocreate-2.c: New test.
+ * testsuite/libgomp.oacc-c-c++-common/nocreate-3.c: New test.
+ * testsuite/libgomp.oacc-c-c++-common/nocreate-4.c: New test.
+ * testsuite/libgomp.oacc-fortran/nocreate-1.f90: New test.
+ * testsuite/libgomp.oacc-fortran/nocreate-2.f90: New test.
+
2018-12-20 Maciej W. Rozycki <macro@codesourcery.com>
* testsuite/libgomp.oacc-c-c++-common/serial-dims.c: New test.
has_firstprivate = true;
continue;
}
+ else if ((kind & typemask) == GOMP_MAP_NO_ALLOC)
+ {
+ tgt->list[i].key = NULL;
+ tgt->list[i].offset = 0;
+ continue;
+ }
cur_node.host_start = (uintptr_t) hostaddrs[i];
if (!GOMP_MAP_POINTER_P (kind & typemask)
&& (kind & typemask) != GOMP_MAP_ATTACH)
cbufp);
continue;
}
+ case GOMP_MAP_NO_ALLOC:
+ {
+ cur_node.host_start = (uintptr_t) hostaddrs[i];
+ cur_node.host_end = cur_node.host_start + sizes[i];
+ splay_tree_key n = splay_tree_lookup (mem_map, &cur_node);
+ if (n != NULL)
+ {
+ tgt->list[i].key = n;
+ tgt->list[i].offset = cur_node.host_start - n->host_start;
+ tgt->list[i].length = n->host_end - n->host_start;
+ tgt->list[i].copy_from = false;
+ tgt->list[i].always_copy_from = false;
+ tgt->list[i].do_detach = false;
+ n->refcount++;
+ }
+ else
+ {
+ tgt->list[i].key = NULL;
+ tgt->list[i].offset = OFFSET_INLINED;
+ tgt->list[i].length = sizes[i];
+ tgt->list[i].copy_from = false;
+ tgt->list[i].always_copy_from = false;
+ tgt->list[i].do_detach = false;
+ if (i + 1 < mapnum)
+ {
+ int kind2 = get_kind (short_mapkind, kinds, i + 1);
+ switch (kind2 & typemask)
+ {
+ case GOMP_MAP_ATTACH:
+ case GOMP_MAP_POINTER:
+ /* The data is not present but we have an attach
+ or pointer clause next. Skip over it. */
+ i++;
+ tgt->list[i].key = NULL;
+ tgt->list[i].offset = OFFSET_INLINED;
+ tgt->list[i].length = sizes[i];
+ tgt->list[i].copy_from = false;
+ tgt->list[i].always_copy_from = false;
+ tgt->list[i].do_detach = false;
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ continue;
+ }
default:
break;
}
--- /dev/null
+/* Test no_create clause when data is present on the device. */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <openacc.h>
+
+#define N 128
+
+int
+main (int argc, char *argv[])
+{
+ int *arr = (int *) malloc (N * sizeof (*arr));
+ int *devptr;
+
+ acc_copyin (arr, N * sizeof (*arr));
+
+ #pragma acc parallel no_create(arr[0:N]) copyout(devptr)
+ {
+ devptr = &arr[2];
+ }
+
+#if !ACC_MEM_SHARED
+ if (acc_hostptr (devptr) != (void *) &arr[2])
+ __builtin_abort ();
+#endif
+
+ acc_delete (arr, N * sizeof (*arr));
+
+#if ACC_MEM_SHARED
+ if (&arr[2] != devptr)
+ __builtin_abort ();
+#else
+ if (&arr[2] == devptr)
+ __builtin_abort ();
+#endif
+
+ free (arr);
+
+ return 0;
+}
--- /dev/null
+/* Test no_create clause when data is not present on the device. */
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#define N 128
+
+int
+main (int argc, char *argv[])
+{
+ int *arr = (int *) malloc (N * sizeof (*arr));
+ int *devptr;
+
+ #pragma acc data no_create(arr[0:N])
+ {
+ #pragma acc parallel copyout(devptr)
+ {
+ devptr = &arr[2];
+ }
+ }
+
+ if (devptr != &arr[2])
+ __builtin_abort ();
+
+ free (arr);
+
+ return 0;
+}
--- /dev/null
+/* Test no_create clause with attach/detach when data is not present on the
+ device. */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <openacc.h>
+
+#define N 128
+
+typedef struct {
+ int x;
+ int *y;
+} mystruct;
+
+int
+main (int argc, char *argv[])
+{
+ int *devptr;
+ mystruct s;
+
+ s.x = 5;
+ s.y = (int *) malloc (N * sizeof (int));
+
+ #pragma acc data copyin(s)
+ {
+ #pragma acc parallel no_create(s.y[0:N]) copyout(devptr)
+ {
+ devptr = &s.y[2];
+ }
+ }
+
+ if (devptr != &s.y[2])
+ __builtin_abort ();
+
+ free (s.y);
+
+ return 0;
+}
--- /dev/null
+/* Test no_create clause with attach/detach when data is present on the
+ device. */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <openacc.h>
+
+#define N 128
+
+typedef struct {
+ int x;
+ int *y;
+} mystruct;
+
+int
+main (int argc, char *argv[])
+{
+ int *devptr;
+ mystruct s;
+
+ s.x = 5;
+ s.y = (int *) malloc (N * sizeof (int));
+
+ #pragma acc data copyin(s)
+ {
+ #pragma acc enter data copyin(s.y[0:N])
+
+ #pragma acc parallel no_create(s.y[0:N]) copyout(devptr)
+ {
+ devptr = &s.y[2];
+ }
+ }
+
+ if (devptr != acc_deviceptr (&s.y[2]))
+ __builtin_abort ();
+
+ #pragma acc exit data delete(s.y[0:N])
+
+ free (s.y);
+
+ return 0;
+}
--- /dev/null
+! { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } }
+
+! Test no_create clause with data construct when data is present/not present.
+
+program nocreate
+ use openacc
+ implicit none
+ integer, parameter :: n = 512
+ integer :: myarr(n)
+ integer i
+
+ do i = 1, n
+ myarr(i) = 0
+ end do
+
+ !$acc data no_create (myarr)
+ if (acc_is_present (myarr)) stop 1
+ !$acc end data
+
+ !$acc enter data copyin (myarr)
+ !$acc data no_create (myarr)
+ if (acc_is_present (myarr) .eqv. .false.) stop 2
+ !$acc end data
+ !$acc exit data copyout (myarr)
+
+ do i = 1, n
+ if (myarr(i) .ne. 0) stop 3
+ end do
+end program nocreate
--- /dev/null
+! { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } }
+
+! Test no_create clause with data/parallel constructs.
+
+program nocreate
+ use openacc
+ implicit none
+ integer, parameter :: n = 512
+ integer :: myarr(n)
+ integer i
+
+ do i = 1, n
+ myarr(i) = 0
+ end do
+
+ call do_on_target(myarr, n)
+
+ do i = 1, n
+ if (myarr(i) .ne. i) stop 1
+ end do
+
+ do i = 1, n
+ myarr(i) = 0
+ end do
+
+ !$acc enter data copyin(myarr)
+ call do_on_target(myarr, n)
+ !$acc exit data copyout(myarr)
+
+ do i = 1, n
+ if (myarr(i) .ne. i * 2) stop 2
+ end do
+end program nocreate
+
+subroutine do_on_target (arr, n)
+ use openacc
+ implicit none
+ integer :: n, arr(n)
+ integer :: i
+
+!$acc data no_create (arr)
+
+if (acc_is_present(arr)) then
+ ! The no_create clause is meant for partially shared-memory machines. This
+ ! test is written to work on non-shared-memory machines, though this is not
+ ! necessarily a useful way to use the no_create clause in practice.
+
+ !$acc parallel loop no_create (arr)
+ do i = 1, n
+ arr(i) = i * 2
+ end do
+ !$acc end parallel loop
+else
+ do i = 1, n
+ arr(i) = i
+ end do
+end if
+
+!$acc end data
+
+end subroutine do_on_target