summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2019-05-24 10:59:37 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2019-05-24 10:59:37 +0200
commitb5c26449f365b603b3cf4c0f9b576ab7c12c2f40 (patch)
treeecc1b0ff600342ae9503fbb59891bd549951a4d6
parentd2e8b6ae3760c72d1d30e0d2b2652c98edb8bc87 (diff)
re PR libgomp/90585 (libgomp hsa plugin ftbfs in the x32 multilib variant)
PR libgomp/90585 * plugin/plugin-hsa.c: Include gstdint.h. Include inttypes.h only if HAVE_INTTYPES_H is defined. (print_uint64_t): New typedef. (PRIu64): Define if HAVE_INTTYPES_H is not defined. (print_kernel_dispatch, run_kernel): Use PRIu64 macro instead of "lu", cast uint64_t HSA_DEBUG and fprintf arguments to print_uint64_t. (release_kernel_dispatch): Likewise. Cast shadow->debug to uintptr_t before casting to void *. * plugin/plugin-nvptx.c: Include gstdint.h instead of stdint.h. * oacc-mem.c: Don't include config.h nor stdint.h. * target.c: Don't include config.h. * oacc-cuda.c: Likewise. * oacc-host.c: Don't include stdint.h. From-SVN: r271597
-rw-r--r--libgomp/ChangeLog17
-rw-r--r--libgomp/oacc-cuda.c1
-rw-r--r--libgomp/oacc-host.c1
-rw-r--r--libgomp/oacc-mem.c2
-rw-r--r--libgomp/plugin/plugin-hsa.c27
-rw-r--r--libgomp/plugin/plugin-nvptx.c2
-rw-r--r--libgomp/target.c1
7 files changed, 37 insertions, 14 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 0ead223d83a..5b427abc192 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,20 @@
+2019-05-24 Jakub Jelinek <jakub@redhat.com>
+
+ PR libgomp/90585
+ * plugin/plugin-hsa.c: Include gstdint.h. Include inttypes.h only if
+ HAVE_INTTYPES_H is defined.
+ (print_uint64_t): New typedef.
+ (PRIu64): Define if HAVE_INTTYPES_H is not defined.
+ (print_kernel_dispatch, run_kernel): Use PRIu64 macro instead of
+ "lu", cast uint64_t HSA_DEBUG and fprintf arguments to print_uint64_t.
+ (release_kernel_dispatch): Likewise. Cast shadow->debug to uintptr_t
+ before casting to void *.
+ * plugin/plugin-nvptx.c: Include gstdint.h instead of stdint.h.
+ * oacc-mem.c: Don't include config.h nor stdint.h.
+ * target.c: Don't include config.h.
+ * oacc-cuda.c: Likewise.
+ * oacc-host.c: Don't include stdint.h.
+
2019-05-20 Jakub Jelinek <jakub@redhat.com>
PR libgomp/90527
diff --git a/libgomp/oacc-cuda.c b/libgomp/oacc-cuda.c
index 07951df5bb0..7a42085c877 100644
--- a/libgomp/oacc-cuda.c
+++ b/libgomp/oacc-cuda.c
@@ -27,7 +27,6 @@
<http://www.gnu.org/licenses/>. */
#include "openacc.h"
-#include "config.h"
#include "libgomp.h"
#include "oacc-int.h"
#include <assert.h>
diff --git a/libgomp/oacc-host.c b/libgomp/oacc-host.c
index 00484b9f6ed..12299aee65d 100644
--- a/libgomp/oacc-host.c
+++ b/libgomp/oacc-host.c
@@ -32,7 +32,6 @@
#include <stdbool.h>
#include <stddef.h>
-#include <stdint.h>
static struct gomp_device_descr host_dispatch;
diff --git a/libgomp/oacc-mem.c b/libgomp/oacc-mem.c
index 0f3832f52b3..2f271009fb8 100644
--- a/libgomp/oacc-mem.c
+++ b/libgomp/oacc-mem.c
@@ -27,11 +27,9 @@
<http://www.gnu.org/licenses/>. */
#include "openacc.h"
-#include "config.h"
#include "libgomp.h"
#include "gomp-constants.h"
#include "oacc-int.h"
-#include <stdint.h>
#include <string.h>
#include <assert.h>
diff --git a/libgomp/plugin/plugin-hsa.c b/libgomp/plugin/plugin-hsa.c
index a2b9bdbeb34..80f23f9beb6 100644
--- a/libgomp/plugin/plugin-hsa.c
+++ b/libgomp/plugin/plugin-hsa.c
@@ -28,11 +28,14 @@
<http://www.gnu.org/licenses/>. */
#include "config.h"
+#include "gstdint.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
+#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
+#endif
#include <stdbool.h>
#include <hsa.h>
#include <plugin/hsa_ext_finalize.h>
@@ -41,6 +44,13 @@
#include "gomp-constants.h"
#include "secure_getenv.h"
+#ifdef HAVE_INTTYPES_H
+typedef uint64_t print_uint64_t;
+#else
+#define PRIu64 "lu"
+typedef unsigned long print_uint64_t;
+#endif
+
/* As an HSA runtime is dlopened, following structure defines function
pointers utilized by the HSA plug-in. */
@@ -1154,8 +1164,9 @@ create_single_kernel_dispatch (struct kernel_info *kernel,
static void
release_kernel_dispatch (struct GOMP_hsa_kernel_dispatch *shadow)
{
- HSA_DEBUG ("Released kernel dispatch: %p has value: %lu (%p)\n", shadow,
- shadow->debug, (void *) shadow->debug);
+ HSA_DEBUG ("Released kernel dispatch: %p has value: %" PRIu64 " (%p)\n",
+ shadow, (print_uint64_t) shadow->debug,
+ (void *) (uintptr_t) shadow->debug);
hsa_fns.hsa_memory_free_fn (shadow->kernarg_address);
@@ -1276,9 +1287,9 @@ print_kernel_dispatch (struct GOMP_hsa_kernel_dispatch *dispatch, unsigned inden
indent_stream (stderr, indent);
fprintf (stderr, "kernarg_address: %p\n", dispatch->kernarg_address);
indent_stream (stderr, indent);
- fprintf (stderr, "object: %lu\n", dispatch->object);
+ fprintf (stderr, "object: %" PRIu64 "\n", (print_uint64_t) dispatch->object);
indent_stream (stderr, indent);
- fprintf (stderr, "signal: %lu\n", dispatch->signal);
+ fprintf (stderr, "signal: %" PRIu64 "\n", (print_uint64_t) dispatch->signal);
indent_stream (stderr, indent);
fprintf (stderr, "private_segment_size: %u\n",
dispatch->private_segment_size);
@@ -1286,8 +1297,8 @@ print_kernel_dispatch (struct GOMP_hsa_kernel_dispatch *dispatch, unsigned inden
fprintf (stderr, "group_segment_size: %u\n",
dispatch->group_segment_size);
indent_stream (stderr, indent);
- fprintf (stderr, "children dispatches: %lu\n",
- dispatch->kernel_dispatch_count);
+ fprintf (stderr, "children dispatches: %" PRIu64 "\n",
+ (print_uint64_t) dispatch->kernel_dispatch_count);
indent_stream (stderr, indent);
fprintf (stderr, "omp_num_threads: %u\n",
dispatch->omp_num_threads);
@@ -1594,8 +1605,8 @@ run_kernel (struct kernel_info *kernel, void *vars,
hsa_signal_t child_s;
child_s.handle = shadow->children_dispatches[i]->signal;
- HSA_DEBUG ("Waiting for children completion signal: %lu\n",
- shadow->children_dispatches[i]->signal);
+ HSA_DEBUG ("Waiting for children completion signal: %" PRIu64 "\n",
+ (print_uint64_t) shadow->children_dispatches[i]->signal);
hsa_fns.hsa_signal_load_acquire_fn (child_s);
}
diff --git a/libgomp/plugin/plugin-nvptx.c b/libgomp/plugin/plugin-nvptx.c
index 3469116cf61..4e51f645cf8 100644
--- a/libgomp/plugin/plugin-nvptx.c
+++ b/libgomp/plugin/plugin-nvptx.c
@@ -34,6 +34,7 @@
#define _GNU_SOURCE
#include "openacc.h"
#include "config.h"
+#include "gstdint.h"
#include "libgomp-plugin.h"
#include "oacc-plugin.h"
#include "gomp-constants.h"
@@ -42,7 +43,6 @@
#include <pthread.h>
#include <cuda.h>
#include <stdbool.h>
-#include <stdint.h>
#include <limits.h>
#include <string.h>
#include <stdio.h>
diff --git a/libgomp/target.c b/libgomp/target.c
index 2e0905effb3..9416401806f 100644
--- a/libgomp/target.c
+++ b/libgomp/target.c
@@ -25,7 +25,6 @@
/* This file contains the support of offloading. */
-#include "config.h"
#include "libgomp.h"
#include "oacc-plugin.h"
#include "oacc-int.h"