@@ -1,5 +1,11 @@
2014-12-17 Thomas Schwinge <thomas@codesourcery.com>
+ * builtins.c (expand_builtin_acc_on_device): Use
+ include/gomp-constants.h.
+ * omp-low.c (expand_omp_target, oacc_process_reduction_data)
+ (lower_omp_target): Likewise.
+ * tree-core.h (enum omp_clause_map_kind): Likewise.
+
* omp-low.c (build_omp_regions_1, make_gimple_omp_edges): Simplify
multi-line if conditions.
@@ -70,6 +70,7 @@ along with GCC; see the file COPYING3. If not see
#include "cgraph.h"
#include "tree-chkp.h"
#include "rtl-chkp.h"
+#include "gomp-constants.h"
static tree do_mpc_arg1 (tree, tree, int (*)(mpc_ptr, mpc_srcptr, mpc_rnd_t));
@@ -5903,11 +5904,11 @@ expand_builtin_acc_on_device (tree exp, rtx target ATTRIBUTE_UNUSED)
/* Build: (arg == v1 || arg == v2) ? 1 : 0. */
#ifdef ACCEL_COMPILER
- v1 = build_int_cst (TREE_TYPE (arg), /* TODO: acc_device_not_host */ 3);
+ v1 = build_int_cst (TREE_TYPE (arg), GOMP_DEVICE_NOT_HOST);
v2 = build_int_cst (TREE_TYPE (arg), ACCEL_COMPILER_acc_device);
#else
- v1 = build_int_cst (TREE_TYPE (arg), /* TODO: acc_device_none */ 0);
- v2 = build_int_cst (TREE_TYPE (arg), /* TODO: acc_device_host */ 2);
+ v1 = build_int_cst (TREE_TYPE (arg), GOMP_DEVICE_NONE);
+ v2 = build_int_cst (TREE_TYPE (arg), GOMP_DEVICE_HOST);
#endif
v1 = fold_build2_loc (loc, EQ_EXPR, integer_type_node, arg, v1);
@@ -1,3 +1,7 @@
+2014-12-17 Thomas Schwinge <thomas@codesourcery.com>
+
+ * c-omp.c (c_finish_oacc_wait): Use include/gomp-constants.h.
+
2014-11-05 James Norris <jnorris@codesourcery.com>
* c-pragma.c (oacc_pragmas): Add "cache".
@@ -30,6 +30,7 @@ along with GCC; see the file COPYING3. If not see
#include "gimple-expr.h"
#include "langhooks.h"
#include "omp-low.h"
+#include "gomp-constants.h"
/* Complete a #pragma oacc wait construct. LOC is the location of
@@ -48,7 +49,7 @@ c_finish_oacc_wait (location_t loc, tree parms, tree clauses)
if (find_omp_clause (clauses, OMP_CLAUSE_ASYNC))
t = OMP_CLAUSE_ASYNC_EXPR (clauses);
else
- t = build_int_cst (integer_type_node, -2); /* TODO: XXX FIX -2. */
+ t = build_int_cst (integer_type_node, GOMP_ASYNC_SYNC);
args->quick_push (t);
args->quick_push (build_int_cst (integer_type_node, nparms));
@@ -1,3 +1,8 @@
+2014-12-17 Thomas Schwinge <thomas@codesourcery.com>
+
+ * c-parser.c (c_parser_oacc_clause_async): Use
+ include/gomp-constants.h.
+
2014-11-05 Thomas Schwinge <thomas@codesourcery.com>
* c-parser.c (c_parser_omp_clause_name) <"host">: Return
@@ -71,6 +71,7 @@ along with GCC; see the file COPYING3. If not see
#include "plugin.h"
#include "omp-low.h"
#include "builtins.h"
+#include "gomp-constants.h"
/* Initialization routine for this file. */
@@ -10682,8 +10683,7 @@ c_parser_oacc_clause_async (c_parser *parser, tree list)
tree c, t;
location_t loc = c_parser_peek_token (parser)->location;
- /* TODO XXX: FIX -1 (acc_async_noval). */
- t = build_int_cst (integer_type_node, -1);
+ t = build_int_cst (integer_type_node, GOMP_ASYNC_NOVAL);
if (c_parser_peek_token (parser)->type == CPP_OPEN_PAREN)
{
@@ -1,3 +1,8 @@
+2014-12-17 Thomas Schwinge <thomas@codesourcery.com>
+
+ * parser.c (cp_parser_oacc_clause_async): Use
+ include/gomp-constants.h.
+
2014-11-05 Thomas Schwinge <thomas@codesourcery.com>
* parser.c (cp_parser_oacc_data_clause): Group
@@ -55,6 +55,7 @@ along with GCC; see the file COPYING3. If not see
#include "parser.h"
#include "type-utils.h"
#include "omp-low.h"
+#include "gomp-constants.h"
/* The lexer. */
@@ -29035,8 +29036,7 @@ cp_parser_oacc_clause_async (cp_parser *parser, tree list)
tree c, t;
location_t loc = cp_lexer_peek_token (parser->lexer)->location;
- /* TODO XXX: FIX -1 (acc_async_noval). */
- t = build_int_cst (integer_type_node, -1);
+ t = build_int_cst (integer_type_node, GOMP_ASYNC_NOVAL);
if (cp_lexer_peek_token (parser->lexer)->type == CPP_OPEN_PAREN)
{
@@ -1,3 +1,7 @@
+2014-12-17 Thomas Schwinge <thomas@codesourcery.com>
+
+ * openmp.c (gfc_match_omp_clauses): Use include/gomp-constants.h.
+
2014-11-20 Cesar Philippidis <cesar@codesourcery.com>
* openmp.c (resolve_oacc_cache): Mark the code parameter as
@@ -28,6 +28,7 @@ along with GCC; see the file COPYING3. If not see
#include "parse.h"
#include "hash-set.h"
#include "diagnostic.h"
+#include "gomp-constants.h"
/* Match an end of OpenMP directive. End of OpenMP directive is optional
whitespace, followed by '\n' or comment '!'. */
@@ -502,8 +503,7 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, uint64_t mask,
c->async_expr = gfc_get_constant_expr (BT_INTEGER,
gfc_default_integer_kind,
&gfc_current_locus);
- /* TODO XXX: FIX -1 (acc_async_noval). */
- mpz_set_si (c->async_expr->value.integer, -1);
+ mpz_set_si (c->async_expr->value.integer, GOMP_ASYNC_NOVAL);
}
continue;
}
@@ -89,6 +89,7 @@ along with GCC; see the file COPYING3. If not see
#include "cilk.h"
#include "context.h"
#include "lto-section-names.h"
+#include "gomp-constants.h"
/* Lowering of OpenMP parallel and workshare constructs proceeds in two
@@ -9032,10 +9033,10 @@ expand_omp_target (struct omp_region *region)
clauses = gimple_omp_target_clauses (entry_stmt);
- /* By default, the value of DEVICE is -1 (let runtime library choose)
- and there is no conditional. */
+ /* By default, the value of DEVICE is GOMP_DEVICE_ICV (let runtime
+ library choose) and there is no conditional. */
cond = NULL_TREE;
- device = build_int_cst (integer_type_node, -1);
+ device = build_int_cst (integer_type_node, GOMP_DEVICE_ICV);
c = find_omp_clause (clauses, OMP_CLAUSE_IF);
if (c)
@@ -9060,7 +9061,7 @@ expand_omp_target (struct omp_region *region)
device = fold_convert_loc (clause_loc, integer_type_node, device);
/* If we found the clause 'if (cond)', build
- (cond ? device : -2). */
+ (cond ? device : GOMP_DEVICE_HOST_FALLBACK). */
if (cond)
{
cond = gimple_boolify (cond);
@@ -9097,7 +9098,8 @@ expand_omp_target (struct omp_region *region)
gsi = gsi_start_bb (else_bb);
stmt = gimple_build_assign (tmp_var,
- build_int_cst (integer_type_node, -2));
+ build_int_cst (integer_type_node,
+ GOMP_DEVICE_HOST_FALLBACK));
gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING);
make_edge (cond_bb, then_bb, EDGE_TRUE_VALUE);
@@ -9188,10 +9190,10 @@ expand_omp_target (struct omp_region *region)
int t_wait_idx;
/* Default values for t_async. */
- /* TODO: XXX FIX -2. */
t_async = fold_convert_loc (gimple_location (entry_stmt),
integer_type_node,
- build_int_cst (integer_type_node, -2));
+ build_int_cst (integer_type_node,
+ GOMP_ASYNC_SYNC));
/* ..., but if present, use the value specified by the respective
clause, making sure that is of the correct type. */
c = find_omp_clause (clauses, OMP_CLAUSE_ASYNC);
@@ -9937,8 +9939,9 @@ oacc_process_reduction_data (gimple_seq *body, gimple_seq *in_stmt_seqp,
/* Set nthreads = 1 for ACC_DEVICE_TYPE=host. */
acc_device_host = create_tmp_var (integer_type_node,
".acc_device_host");
- gimplify_assign (acc_device_host, build_int_cst (integer_type_node,
- 2),
+ gimplify_assign (acc_device_host,
+ build_int_cst (integer_type_node,
+ GOMP_DEVICE_HOST),
in_stmt_seqp);
enter = create_artificial_label (UNKNOWN_LOCATION);
@@ -9954,8 +9957,9 @@ oacc_process_reduction_data (gimple_seq *body, gimple_seq *in_stmt_seqp,
gimple_seq_add_stmt (in_stmt_seqp, gimple_build_label (exit));
/* Also, set nthreads = 1 for ACC_DEVICE_TYPE=host_nonshm. */
- gimplify_assign (acc_device_host, build_int_cst (integer_type_node,
- 3),
+ gimplify_assign (acc_device_host,
+ build_int_cst (integer_type_node,
+ GOMP_DEVICE_HOST_NONSHM),
in_stmt_seqp);
enter = create_artificial_label (UNKNOWN_LOCATION);
@@ -11476,16 +11480,14 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx)
mark_addressable (avar);
enum omp_clause_map_kind map_kind
= OMP_CLAUSE_MAP_KIND (c);
- if ((!(map_kind & OMP_CLAUSE_MAP_SPECIAL)
- && (map_kind & OMP_CLAUSE_MAP_TO))
+ if (GOMP_MAP_COPY_TO_P (map_kind)
|| map_kind == OMP_CLAUSE_MAP_POINTER
|| map_kind == OMP_CLAUSE_MAP_TO_PSET
|| map_kind == OMP_CLAUSE_MAP_FORCE_DEVICEPTR)
gimplify_assign (avar, var, &ilist);
avar = build_fold_addr_expr (avar);
gimplify_assign (x, avar, &ilist);
- if (((!(map_kind & OMP_CLAUSE_MAP_SPECIAL)
- && (map_kind & OMP_CLAUSE_MAP_FROM))
+ if ((GOMP_MAP_COPY_FROM_P (map_kind)
|| map_kind == OMP_CLAUSE_MAP_FORCE_DEVICEPTR)
&& !TYPE_READONLY (TREE_TYPE (var)))
{
@@ -32,6 +32,7 @@ along with GCC; see the file COPYING3. If not see
#include "alias.h"
#include "flags.h"
#include "symtab.h"
+#include "gomp-constants.h"
/* This file contains all the data structures that define the 'tree' type.
There are no accessor macros nor functions in this file. Only the
@@ -1236,45 +1237,41 @@ enum omp_clause_depend_kind
enum omp_clause_map_kind
{
/* If not already present, allocate. */
- OMP_CLAUSE_MAP_ALLOC = 0,
+ OMP_CLAUSE_MAP_ALLOC = GOMP_MAP_ALLOC,
/* ..., and copy to device. */
- OMP_CLAUSE_MAP_TO = 1 << 0,
+ OMP_CLAUSE_MAP_TO = GOMP_MAP_TO,
/* ..., and copy from device. */
- OMP_CLAUSE_MAP_FROM = 1 << 1,
+ OMP_CLAUSE_MAP_FROM = GOMP_MAP_FROM,
/* ..., and copy to and from device. */
- OMP_CLAUSE_MAP_TOFROM = OMP_CLAUSE_MAP_TO | OMP_CLAUSE_MAP_FROM,
- /* Special map kinds. */
- OMP_CLAUSE_MAP_SPECIAL = 1 << 2,
+ OMP_CLAUSE_MAP_TOFROM = GOMP_MAP_TOFROM,
/* The following kind is an internal only map kind, used for pointer based
array sections. OMP_CLAUSE_SIZE for these is not the pointer size,
which is implicitly POINTER_SIZE_UNITS, but the bias. */
- OMP_CLAUSE_MAP_POINTER = OMP_CLAUSE_MAP_SPECIAL,
+ OMP_CLAUSE_MAP_POINTER = GOMP_MAP_POINTER,
/* Also internal, behaves like OMP_CLAUS_MAP_TO, but additionally any
OMP_CLAUSE_MAP_POINTER records consecutive after it which have addresses
falling into that range will not be ignored if OMP_CLAUSE_MAP_TO_PSET
wasn't mapped already. */
- OMP_CLAUSE_MAP_TO_PSET,
+ OMP_CLAUSE_MAP_TO_PSET = GOMP_MAP_TO_PSET,
/* The following are only valid for OpenACC. */
- /* Flag to force a specific behavior (or else, a run-time error). */
- OMP_CLAUSE_MAP_FORCE = 1 << 3,
/* Allocate. */
- OMP_CLAUSE_MAP_FORCE_ALLOC = OMP_CLAUSE_MAP_FORCE | OMP_CLAUSE_MAP_ALLOC,
+ OMP_CLAUSE_MAP_FORCE_ALLOC = GOMP_MAP_FORCE_ALLOC,
/* ..., and copy to device. */
- OMP_CLAUSE_MAP_FORCE_TO = OMP_CLAUSE_MAP_FORCE | OMP_CLAUSE_MAP_TO,
+ OMP_CLAUSE_MAP_FORCE_TO = GOMP_MAP_FORCE_TO,
/* ..., and copy from device. */
- OMP_CLAUSE_MAP_FORCE_FROM = OMP_CLAUSE_MAP_FORCE | OMP_CLAUSE_MAP_FROM,
+ OMP_CLAUSE_MAP_FORCE_FROM = GOMP_MAP_FORCE_FROM,
/* ..., and copy to and from device. */
- OMP_CLAUSE_MAP_FORCE_TOFROM = OMP_CLAUSE_MAP_FORCE | OMP_CLAUSE_MAP_TOFROM,
+ OMP_CLAUSE_MAP_FORCE_TOFROM = GOMP_MAP_FORCE_TOFROM,
/* Must already be present. */
- OMP_CLAUSE_MAP_FORCE_PRESENT = OMP_CLAUSE_MAP_FORCE | OMP_CLAUSE_MAP_SPECIAL,
+ OMP_CLAUSE_MAP_FORCE_PRESENT = GOMP_MAP_FORCE_PRESENT,
/* Deallocate a mapping, without copying from device. */
- OMP_CLAUSE_MAP_FORCE_DEALLOC,
+ OMP_CLAUSE_MAP_FORCE_DEALLOC = GOMP_MAP_FORCE_DEALLOC,
/* Is a device pointer. OMP_CLAUSE_SIZE for these is unused; is implicitly
- POINTER_SIZE / BITS_PER_UNIT. */
- OMP_CLAUSE_MAP_FORCE_DEVICEPTR,
+ POINTER_SIZE_UNITS. */
+ OMP_CLAUSE_MAP_FORCE_DEVICEPTR = GOMP_MAP_FORCE_DEVICEPTR,
/* End marker. */
- OMP_CLAUSE_MAP_LAST
+ OMP_CLAUSE_MAP_LAST = GOMP_MAP_VALUE_LIMIT
};
enum omp_clause_proc_bind_kind
@@ -1,5 +1,7 @@
2014-12-17 Thomas Schwinge <thomas@codesourcery.com>
+ * gomp-constants.h: Update. Change all users.
+
* gomp-constants.h: Don't define GOMP_MAP_FORCE_PRIVATE and
GOMP_MAP_FORCE_FIRSTPRIVATE. Change all users.
@@ -1,4 +1,7 @@
-/* Copyright (C) 2014 Free Software Foundation, Inc.
+/* Communication between GCC and libgomp.
+
+ Copyright (C) 2014 Free Software Foundation, Inc.
+
Contributed by Mentor Embedded.
This file is part of the GNU Offloading and Multi Processing Library
@@ -26,46 +29,66 @@
#ifndef GOMP_CONSTANTS_H
#define GOMP_CONSTANTS_H 1
-/* Enumerated variable mapping types used to communicate between GCC and
- libgomp. These values are used for both OpenMP and OpenACC. */
+/* Memory mapping types. */
-#define _GOMP_MAP_FLAG_SPECIAL (1 << 2)
-#define _GOMP_MAP_FLAG_FORCE (1 << 3)
+/* One byte. */
+#define GOMP_MAP_VALUE_LIMIT (1 << 8)
-#define GOMP_MAP_ALLOC 0x00
-#define GOMP_MAP_ALLOC_TO 0x01
-#define GOMP_MAP_ALLOC_FROM 0x02
-#define GOMP_MAP_ALLOC_TOFROM 0x03
-#define GOMP_MAP_POINTER 0x04
-#define GOMP_MAP_TO_PSET 0x05
-#define GOMP_MAP_FORCE_ALLOC 0x08
-#define GOMP_MAP_FORCE_TO 0x09
-#define GOMP_MAP_FORCE_FROM 0x0a
-#define GOMP_MAP_FORCE_TOFROM 0x0b
-#define GOMP_MAP_FORCE_PRESENT 0x0c
-#define GOMP_MAP_FORCE_DEALLOC 0x0d
-#define GOMP_MAP_FORCE_DEVICEPTR 0x0e
+#define GOMP_MAP_FLAG_TO (1 << 0)
+#define GOMP_MAP_FLAG_FROM (1 << 1)
+/* Special map kinds, enumerated starting here. */
+#define GOMP_MAP_FLAG_SPECIAL_0 (1 << 2)
+#define GOMP_MAP_FLAG_SPECIAL_1 (1 << 3)
+#define GOMP_MAP_FLAG_SPECIAL (GOMP_MAP_FLAG_SPECIAL_1 \
+ | GOMP_MAP_FLAG_SPECIAL_0)
+/* Flag to force a specific behavior (or else, trigger a run-time error). */
+#define GOMP_MAP_FLAG_FORCE (1 << 7)
-#define GOMP_MAP_COPYTO_P(X) \
- ((X) == GOMP_MAP_ALLOC_TO || (X) == GOMP_MAP_FORCE_TO)
+#define GOMP_MAP_ALLOC 0
+#define GOMP_MAP_TO (GOMP_MAP_ALLOC | GOMP_MAP_FLAG_TO)
+#define GOMP_MAP_FROM (GOMP_MAP_ALLOC | GOMP_MAP_FLAG_FROM)
+#define GOMP_MAP_TOFROM (GOMP_MAP_TO | GOMP_MAP_FROM)
+#define GOMP_MAP_POINTER (GOMP_MAP_FLAG_SPECIAL_0 | 0)
+#define GOMP_MAP_TO_PSET (GOMP_MAP_FLAG_SPECIAL_0 | 1)
+#define GOMP_MAP_FORCE_PRESENT (GOMP_MAP_FLAG_SPECIAL_0 | 2)
+#define GOMP_MAP_FORCE_DEALLOC (GOMP_MAP_FLAG_SPECIAL_0 | 3)
+#define GOMP_MAP_FORCE_DEVICEPTR (GOMP_MAP_FLAG_SPECIAL_1 | 0)
+#define GOMP_MAP_FORCE_ALLOC (GOMP_MAP_FLAG_FORCE | GOMP_MAP_ALLOC)
+#define GOMP_MAP_FORCE_TO (GOMP_MAP_FLAG_FORCE | GOMP_MAP_TO)
+#define GOMP_MAP_FORCE_FROM (GOMP_MAP_FLAG_FORCE | GOMP_MAP_FROM)
+#define GOMP_MAP_FORCE_TOFROM (GOMP_MAP_FLAG_FORCE | GOMP_MAP_TOFROM)
-#define GOMP_MAP_COPYFROM_P(X) \
- ((X) == GOMP_MAP_ALLOC_FROM || (X) == GOMP_MAP_FORCE_FROM)
+#define GOMP_MAP_COPY_TO_P(X) \
+ (!((X) & GOMP_MAP_FLAG_SPECIAL) \
+ && ((X) & GOMP_MAP_FLAG_TO))
-#define GOMP_MAP_TOFROM_P(X) \
- ((X) == GOMP_MAP_ALLOC_TOFROM || (X) == GOMP_MAP_FORCE_TOFROM)
+#define GOMP_MAP_COPY_FROM_P(X) \
+ (!((X) & GOMP_MAP_FLAG_SPECIAL) \
+ && ((X) & GOMP_MAP_FLAG_FROM))
#define GOMP_MAP_POINTER_P(X) \
((X) == GOMP_MAP_POINTER)
-#define GOMP_IF_CLAUSE_FALSE -2
-
-/* Canonical list of target type codes for OpenMP/OpenACC. */
-#define GOMP_TARGET_NONE 0
-#define GOMP_TARGET_HOST 2
-#define GOMP_TARGET_HOST_NONSHM 3
-#define GOMP_TARGET_NOT_HOST 4
-#define GOMP_TARGET_NVIDIA_PTX 5
-#define GOMP_TARGET_INTEL_MIC 6
+
+/* Asynchronous behavior. Keep in sync with
+ libgomp/{openacc.h,openacc.f90,openacc_lib.h}:acc_async_t. */
+
+#define GOMP_ASYNC_NOVAL -1
+#define GOMP_ASYNC_SYNC -2
+
+
+/* Device codes. Keep in sync with
+ libgomp/{openacc.h,openacc.f90,openacc_lib.h}:acc_device_t as well as
+ libgomp/libgomp_target.h. */
+#define GOMP_DEVICE_NONE 0
+#define GOMP_DEVICE_DEFAULT 1
+#define GOMP_DEVICE_HOST 2
+#define GOMP_DEVICE_HOST_NONSHM 3
+#define GOMP_DEVICE_NOT_HOST 4
+#define GOMP_DEVICE_NVIDIA_PTX 5
+#define GOMP_DEVICE_INTEL_MIC 6
+
+#define GOMP_DEVICE_ICV -1
+#define GOMP_DEVICE_HOST_FALLBACK -2
#endif
@@ -1,4 +1,13 @@
2014-12-17 Thomas Schwinge <thomas@codesourcery.com>
+
+ * Makefile.am: Don't add ../include/gomp-constants.h to
+ nodist_libsubinclude_HEADERS.
+
+ * openacc.h: Don't include "gomp-constants.h".
+
+ * oacc-parallel.c (dump_var): Remove.
+
+2014-12-17 Thomas Schwinge <thomas@codesourcery.com>
Julian Brown <julian@codesourcery.com>
David Malcolm <dmalcolm@redhat.com>
@@ -72,7 +72,7 @@ libgomp_la_SOURCES += openacc.f90
endif
nodist_noinst_HEADERS = libgomp_f.h
-nodist_libsubinclude_HEADERS = omp.h openacc.h ../include/gomp-constants.h
+nodist_libsubinclude_HEADERS = omp.h openacc.h
if USE_FORTRAN
nodist_finclude_HEADERS = omp_lib.h omp_lib.f90 omp_lib.mod omp_lib_kinds.mod \
openacc_lib.h openacc.f90 openacc.mod openacc_kinds.mod
@@ -417,7 +417,7 @@ libgomp_plugin_host_nonshm_la_LDFLAGS = \
libgomp_plugin_host_nonshm_la_LIBTOOLFLAGS = --tag=disable-static
nodist_noinst_HEADERS = libgomp_f.h
-nodist_libsubinclude_HEADERS = omp.h openacc.h ../include/gomp-constants.h
+nodist_libsubinclude_HEADERS = omp.h openacc.h
@USE_FORTRAN_TRUE@nodist_finclude_HEADERS = omp_lib.h omp_lib.f90 omp_lib.mod omp_lib_kinds.mod \
@USE_FORTRAN_TRUE@ openacc_lib.h openacc.f90 openacc.mod openacc_kinds.mod
@@ -27,13 +27,13 @@
#include "gomp-constants.h"
-/* Type of offload target device. Keep in sync with openacc.h:acc_device_t. */
+/* Type of offload target device. Keep in sync with include/gomp-constants.h. */
enum offload_target_type
{
- OFFLOAD_TARGET_TYPE_HOST = GOMP_TARGET_HOST,
- OFFLOAD_TARGET_TYPE_HOST_NONSHM = GOMP_TARGET_HOST_NONSHM,
- OFFLOAD_TARGET_TYPE_NVIDIA_PTX = GOMP_TARGET_NVIDIA_PTX,
- OFFLOAD_TARGET_TYPE_INTEL_MIC = GOMP_TARGET_INTEL_MIC
+ OFFLOAD_TARGET_TYPE_HOST = 2,
+ OFFLOAD_TARGET_TYPE_HOST_NONSHM = 3,
+ OFFLOAD_TARGET_TYPE_NVIDIA_PTX = 5,
+ OFFLOAD_TARGET_TYPE_INTEL_MIC = 6
};
/* Auxiliary struct, used for transferring a host-target address range mapping
@@ -385,7 +385,7 @@ present_create_copy (unsigned f, void *h, size_t s)
void *hostaddrs = h;
if (f & PCC_Copy)
- kinds = GOMP_MAP_ALLOC_TO;
+ kinds = GOMP_MAP_TO;
else
kinds = GOMP_MAP_ALLOC;
@@ -38,36 +38,6 @@
#include <assert.h>
#include <alloca.h>
-static void
-dump_var (char *s, size_t idx, void *hostaddr, size_t size, unsigned char kind)
-{
- gomp_debug (0, " %2zi: %3s 0x%.2x -", idx, s, kind & 0xff);
-
- switch (kind & 0xff)
- {
- case 0x00: gomp_debug (0, " ALLOC "); break;
- case 0x01: gomp_debug (0, " ALLOC TO "); break;
- case 0x02: gomp_debug (0, " ALLOC FROM "); break;
- case 0x03: gomp_debug (0, " ALLOC TOFROM "); break;
- case 0x04: gomp_debug (0, " POINTER "); break;
- case 0x05: gomp_debug (0, " TO_PSET "); break;
-
- case 0x08: gomp_debug (0, " FORCE_ALLOC "); break;
- case 0x09: gomp_debug (0, " FORCE_TO "); break;
- case 0x0a: gomp_debug (0, " FORCE_FROM "); break;
- case 0x0b: gomp_debug (0, " FORCE_TOFROM "); break;
- case 0x0c: gomp_debug (0, " FORCE_PRESENT "); break;
- case 0x0d: gomp_debug (0, " FORCE_DEALLOC "); break;
- case 0x0e: gomp_debug (0, " FORCE_DEVICEPTR "); break;
-
- case (unsigned char) -1: gomp_debug (0, " DUMMY "); break;
- default: gomp_debug (0, "UGH! 0x%x\n", kind);
- }
-
- gomp_debug (0, "- %d - %4d/0x%04x ", 1 << (kind >> 8), (int) size, (int) size);
- gomp_debug (0, "- %p\n", hostaddr);
-}
-
static int
find_pset (int pos, size_t mapnum, unsigned short *kinds)
{
@@ -90,7 +60,7 @@ select_acc_device (int device_type)
{
goacc_lazy_initialize ();
- if (device_type == GOMP_IF_CLAUSE_FALSE)
+ if (device_type == GOMP_DEVICE_HOST_FALLBACK)
return;
if (device_type == acc_device_none)
@@ -114,7 +84,7 @@ GOACC_parallel (int device, void (*fn) (void *), const void *offload_table,
int num_gangs, int num_workers, int vector_length,
int async, int num_waits, ...)
{
- bool if_clause_condition_value = device != GOMP_IF_CLAUSE_FALSE;
+ bool host_fallback = device == GOMP_DEVICE_HOST_FALLBACK;
va_list ap;
struct goacc_thread *thr;
struct gomp_device_descr *acc_dev;
@@ -139,7 +109,7 @@ GOACC_parallel (int device, void (*fn) (void *), const void *offload_table,
/* Host fallback if "if" clause is false or if the current device is set to
the host. */
- if (!if_clause_condition_value)
+ if (host_fallback)
{
goacc_save_and_set_bind (acc_device_host);
fn (hostaddrs);
@@ -206,7 +176,7 @@ void
GOACC_data_start (int device, const void *offload_table, size_t mapnum,
void **hostaddrs, size_t *sizes, unsigned short *kinds)
{
- bool if_clause_condition_value = device != GOMP_IF_CLAUSE_FALSE;
+ bool host_fallback = device == GOMP_DEVICE_HOST_FALLBACK;
struct target_mem_desc *tgt;
gomp_debug (0, "%s: mapnum=%zd, hostaddrs=%p, sizes=%p, kinds=%p\n",
@@ -219,7 +189,7 @@ GOACC_data_start (int device, const void *offload_table, size_t mapnum,
/* Host fallback or 'do nothing'. */
if ((acc_dev->capabilities & TARGET_CAP_SHARED_MEM)
- || !if_clause_condition_value)
+ || host_fallback)
{
tgt = gomp_map_vars (NULL, 0, NULL, NULL, NULL, NULL, true, false);
tgt->prev = thr->mapped_data;
@@ -255,7 +225,7 @@ GOACC_enter_exit_data (int device, const void *offload_table, size_t mapnum,
{
struct goacc_thread *thr;
struct gomp_device_descr *acc_dev;
- bool if_clause_condition_value = device != GOMP_IF_CLAUSE_FALSE;
+ bool host_fallback = device == GOMP_DEVICE_HOST_FALLBACK;
bool data_enter = false;
size_t i;
@@ -265,7 +235,7 @@ GOACC_enter_exit_data (int device, const void *offload_table, size_t mapnum,
acc_dev = thr->dev;
if ((acc_dev->capabilities & TARGET_CAP_SHARED_MEM)
- || !if_clause_condition_value)
+ || host_fallback)
return;
if (num_waits > 0)
@@ -289,14 +259,16 @@ GOACC_enter_exit_data (int device, const void *offload_table, size_t mapnum,
if (kind == GOMP_MAP_POINTER || kind == GOMP_MAP_TO_PSET)
continue;
- if (kind == GOMP_MAP_FORCE_ALLOC || kind == GOMP_MAP_FORCE_PRESENT
+ if (kind == GOMP_MAP_FORCE_ALLOC
+ || kind == GOMP_MAP_FORCE_PRESENT
|| kind == GOMP_MAP_FORCE_TO)
{
data_enter = true;
break;
}
- if (kind == GOMP_MAP_FORCE_DEALLOC || kind == GOMP_MAP_FORCE_FROM)
+ if (kind == GOMP_MAP_FORCE_DEALLOC
+ || kind == GOMP_MAP_FORCE_FROM)
break;
gomp_fatal (">>>> GOACC_enter_exit_data UNHANDLED kind 0x%.2x",
@@ -466,7 +438,7 @@ GOACC_update (int device, const void *offload_table, size_t mapnum,
void **hostaddrs, size_t *sizes, unsigned short *kinds,
int async, int num_waits, ...)
{
- bool if_clause_condition_value = device != GOMP_IF_CLAUSE_FALSE;
+ bool host_fallback = device == GOMP_DEVICE_HOST_FALLBACK;
size_t i;
select_acc_device (device);
@@ -475,7 +447,7 @@ GOACC_update (int device, const void *offload_table, size_t mapnum,
struct gomp_device_descr *acc_dev = thr->dev;
if ((acc_dev->capabilities & TARGET_CAP_SHARED_MEM)
- || !if_clause_condition_value)
+ || host_fallback)
return;
if (num_waits > 0)
@@ -495,8 +467,6 @@ GOACC_update (int device, const void *offload_table, size_t mapnum,
{
unsigned char kind = kinds[i] & 0xff;
- dump_var ("UPD", i, hostaddrs[i], sizes[i], kinds[i]);
-
switch (kind)
{
case GOMP_MAP_POINTER:
@@ -39,6 +39,7 @@ module openacc_kinds
public :: acc_device_none, acc_device_default, acc_device_host
public :: acc_device_not_host, acc_device_nvidia
+ ! Keep in sync with include/gomp-constants.h.
integer (acc_device_kind), parameter :: acc_device_none = 0
integer (acc_device_kind), parameter :: acc_device_default = 1
integer (acc_device_kind), parameter :: acc_device_host = 2
@@ -52,6 +53,7 @@ module openacc_kinds
public :: acc_async_noval, acc_async_sync
+ ! Keep in sync with include/gomp-constants.h.
integer (acc_handle_kind), parameter :: acc_async_noval = -1
integer (acc_handle_kind), parameter :: acc_async_sync = -2
@@ -29,8 +29,6 @@
#ifndef _OPENACC_H
#define _OPENACC_H 1
-#include "gomp-constants.h"
-
/* The OpenACC std is silent on whether or not including openacc.h
might or must not include other header files. We chose to include
some. */
@@ -51,18 +49,19 @@ extern "C" {
/* Types */
typedef enum acc_device_t
{
+ /* Keep in sync with include/gomp-constants.h. */
acc_device_none = 0,
- acc_device_default, /* This has to be a distinct value, as no
- return value can match it. */
- acc_device_host = GOMP_TARGET_HOST,
- acc_device_host_nonshm = GOMP_TARGET_HOST_NONSHM,
- acc_device_not_host,
- acc_device_nvidia = GOMP_TARGET_NVIDIA_PTX,
+ acc_device_default = 1,
+ acc_device_host = 2,
+ acc_device_host_nonshm = 3,
+ acc_device_not_host = 4,
+ acc_device_nvidia = 5,
_ACC_device_hwm
} acc_device_t;
typedef enum acc_async_t
{
+ /* Keep in sync with include/gomp-constants.h. */
acc_async_noval = -1,
acc_async_sync = -2
} acc_async_t;
@@ -34,6 +34,7 @@
integer, parameter :: acc_device_kind = 4
+! Keep in sync with include/gomp-constants.h.
integer (acc_device_kind), parameter :: acc_device_none = 0
integer (acc_device_kind), parameter :: acc_device_default = 1
integer (acc_device_kind), parameter :: acc_device_host = 2
@@ -43,6 +44,7 @@
integer, parameter :: acc_handle_kind = 4
+! Keep in sync with include/gomp-constants.h.
integer (acc_handle_kind), parameter :: acc_async_noval = -1
integer (acc_handle_kind), parameter :: acc_async_sync = -2
@@ -100,7 +100,7 @@ gomp_get_num_devices (void)
static struct gomp_device_descr *
resolve_device (int device_id)
{
- if (device_id == -1)
+ if (device_id == GOMP_DEVICE_ICV)
{
struct gomp_task_icv *icv = gomp_icv (false);
device_id = icv->default_device_var;
@@ -120,8 +120,7 @@ static inline void
gomp_map_vars_existing (splay_tree_key oldn, splay_tree_key newn,
unsigned char kind)
{
- if ((!(kind & _GOMP_MAP_FLAG_SPECIAL)
- && (kind & _GOMP_MAP_FLAG_FORCE))
+ if ((kind & GOMP_MAP_FLAG_FORCE)
|| oldn->host_start > newn->host_start
|| oldn->host_end < newn->host_end)
gomp_fatal ("Trying to map into device [%p..%p) object when "
@@ -339,8 +338,7 @@ gomp_map_vars (struct gomp_device_descr *devicep, size_t mapnum,
k->tgt = tgt;
k->tgt_offset = tgt_size;
tgt_size += k->host_end - k->host_start;
- k->copy_from = GOMP_MAP_COPYFROM_P (kind & typemask)
- || GOMP_MAP_TOFROM_P (kind & typemask);
+ k->copy_from = GOMP_MAP_COPY_FROM_P (kind & typemask);
k->refcount = 1;
k->async_refcount = 0;
tgt->refcount++;
@@ -352,12 +350,12 @@ gomp_map_vars (struct gomp_device_descr *devicep, size_t mapnum,
switch (kind & typemask)
{
case GOMP_MAP_ALLOC:
- case GOMP_MAP_ALLOC_FROM:
+ case GOMP_MAP_FROM:
case GOMP_MAP_FORCE_ALLOC:
case GOMP_MAP_FORCE_FROM:
break;
- case GOMP_MAP_ALLOC_TO:
- case GOMP_MAP_ALLOC_TOFROM:
+ case GOMP_MAP_TO:
+ case GOMP_MAP_TOFROM:
case GOMP_MAP_FORCE_TO:
case GOMP_MAP_FORCE_TOFROM:
/* Copy from host to device memory. */
@@ -692,7 +690,7 @@ gomp_update (struct gomp_device_descr *devicep, struct gomp_memory_mapping *mm,
(void *) cur_node.host_end,
(void *) n->host_start,
(void *) n->host_end);
- if (GOMP_MAP_COPYTO_P (kind & typemask))
+ if (GOMP_MAP_COPY_TO_P (kind & typemask))
/* Copy from host to device memory. */
devicep->host2dev_func (devicep->target_id,
(void *) (n->tgt->tgt_start
@@ -701,7 +699,7 @@ gomp_update (struct gomp_device_descr *devicep, struct gomp_memory_mapping *mm,
- n->host_start),
(void *) cur_node.host_start,
cur_node.host_end - cur_node.host_start);
- else if (GOMP_MAP_COPYFROM_P (kind & typemask))
+ if (GOMP_MAP_COPY_FROM_P (kind & typemask))
/* Copy from device to host memory. */
devicep->dev2host_func (devicep->target_id,
(void *) cur_node.host_start,
@@ -826,8 +824,9 @@ gomp_fini_device (struct gomp_device_descr *devicep)
}
/* Called when encountering a target directive. If DEVICE
- is -1, it means use device-var ICV. If it is -2 (or any other value
- larger than last available hw device, use host fallback.
+ is GOMP_DEVICE_ICV, it means use device-var ICV. If it is
+ GOMP_DEVICE_HOST_FALLBACK (or any value
+ larger than last available hw device), use host fallback.
FN is address of host code, OFFLOAD_TABLE contains value of the
__OFFLOAD_TABLE__ symbol in the shared library or binary that invokes
GOMP_target. HOSTADDRS, SIZES and KINDS are arrays
@@ -162,7 +162,7 @@ proc libgomp_init { args } {
lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/.libs"
lappend ALWAYS_CFLAGS "additional_flags=-I${blddir}"
lappend ALWAYS_CFLAGS "ldflags=-L${blddir}/.libs"
- # The top-level include directory, for libgomp-constants.h.
+ # The top-level include directory, for gomp-constants.h.
lappend ALWAYS_CFLAGS "additional_flags=-I${srcdir}/../../include"
}
lappend ALWAYS_CFLAGS "additional_flags=-I${srcdir}/.."