diff mbox

[7/10] OpenACC 2.0 support for libgomp - OpenACC runtime, NVidia PTX/CUDA plugin

Message ID 87y4p812bq.fsf@kepler.schwinge.homeip.net
State New
Headers show

Commit Message

Thomas Schwinge Jan. 12, 2015, 2:49 p.m. UTC
Hi!

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, [...]

> --- /dev/null
> +++ b/libgomp/libgomp-plugin.h
> @@ -0,0 +1,57 @@

> +/* An interface to various libgomp-internal functions for use by plugins.  */

..., and in parallel, a libgomp_target.h file came into existence.  In
gomp-4_0-branch's r219468, I now merged the two into the one with -- in
my opinion -- the more descriptive name:

commit 5024605e60ed2a42fefaa6882ac0ca7493643460
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Mon Jan 12 14:47:46 2015 +0000

    libgomp: Merge libgomp_target.h into libgomp-plugin.h.
    
    	libgomp/
    	* env.c: Don't include "libgomp_target.h".
    	* libgomp-plugin.c: Likewise.
    	* oacc-async.c: Likewise.
    	* oacc-cuda.c: Likewise.
    	* oacc-init.c: Likewise.
    	* oacc-mem.c: Likewise.
    	* oacc-parallel.c: Likewise.
    	* oacc-plugin.c: Likewise.
    	* plugin/plugin-host.c: Likewise.
    	* plugin/plugin-nvptx.c: Likewise.
    	* target.c: Likewise.
    	* libgomp_target.h: Remove file after merging its content into...
    	* libgomp-plugin.h: ... this file.  Adjust all users.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@219468 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/config/i386/intelmic-mkoffload.c             |  2 +-
 libgomp/ChangeLog.gomp                           | 14 +++++++
 libgomp/env.c                                    |  1 -
 libgomp/libgomp-plugin.c                         |  1 -
 libgomp/libgomp-plugin.h                         | 37 +++++++++++++++++
 libgomp/libgomp.h                                |  2 +-
 libgomp/libgomp_target.h                         | 53 ------------------------
 libgomp/oacc-async.c                             |  1 -
 libgomp/oacc-cuda.c                              |  1 -
 libgomp/oacc-init.c                              |  1 -
 libgomp/oacc-mem.c                               |  1 -
 libgomp/oacc-parallel.c                          |  1 -
 libgomp/oacc-plugin.c                            |  1 -
 libgomp/plugin/plugin-host.c                     |  1 -
 libgomp/plugin/plugin-nvptx.c                    |  1 -
 libgomp/target.c                                 |  1 -
 liboffloadmic/plugin/libgomp-plugin-intelmic.cpp |  2 +-
 17 files changed, 54 insertions(+), 67 deletions(-)



Grüße,
 Thomas
diff mbox

Patch

diff --git gcc/config/i386/intelmic-mkoffload.c gcc/config/i386/intelmic-mkoffload.c
index 050f2e6..edc3f92 100644
--- gcc/config/i386/intelmic-mkoffload.c
+++ gcc/config/i386/intelmic-mkoffload.c
@@ -22,13 +22,13 @@ 
 
 #include "config.h"
 #include <libgen.h>
+#include "libgomp-plugin.h"
 #include "system.h"
 #include "coretypes.h"
 #include "obstack.h"
 #include "intl.h"
 #include "diagnostic.h"
 #include "collect-utils.h"
-#include <libgomp_target.h>
 
 const char tool_name[] = "intelmic mkoffload";
 
diff --git libgomp/ChangeLog.gomp libgomp/ChangeLog.gomp
index d955a85..76f21e6 100644
--- libgomp/ChangeLog.gomp
+++ libgomp/ChangeLog.gomp
@@ -1,5 +1,19 @@ 
 2015-01-12  Thomas Schwinge  <thomas@codesourcery.com>
 
+	* env.c: Don't include "libgomp_target.h".
+	* libgomp-plugin.c: Likewise.
+	* oacc-async.c: Likewise.
+	* oacc-cuda.c: Likewise.
+	* oacc-init.c: Likewise.
+	* oacc-mem.c: Likewise.
+	* oacc-parallel.c: Likewise.
+	* oacc-plugin.c: Likewise.
+	* plugin/plugin-host.c: Likewise.
+	* plugin/plugin-nvptx.c: Likewise.
+	* target.c: Likewise.
+	* libgomp_target.h: Remove file after merging its content into...
+	* libgomp-plugin.h: ... this file.  Adjust all users.
+
 	* plugin/plugin-nvptx.c (struct ptx_device): Turn stream_lock
 	member into a pthread_mutex_t.  Adjust all users.
 	(ptx_event_lock): Likewise.
diff --git libgomp/env.c libgomp/env.c
index 81460dc..130c52c 100644
--- libgomp/env.c
+++ libgomp/env.c
@@ -28,7 +28,6 @@ 
 
 #include "libgomp.h"
 #include "libgomp_f.h"
-#include "libgomp_target.h"
 #include "oacc-int.h"
 #include <ctype.h>
 #include <stdlib.h>
diff --git libgomp/libgomp-plugin.c libgomp/libgomp-plugin.c
index 77e250e..1dd33f5 100644
--- libgomp/libgomp-plugin.c
+++ libgomp/libgomp-plugin.c
@@ -30,7 +30,6 @@ 
 
 #include "libgomp.h"
 #include "libgomp-plugin.h"
-#include "libgomp_target.h"
 
 void *
 GOMP_PLUGIN_malloc (size_t size)
diff --git libgomp/libgomp-plugin.h libgomp/libgomp-plugin.h
index 2e2be1f..c8383e1 100644
--- libgomp/libgomp-plugin.h
+++ libgomp/libgomp-plugin.h
@@ -29,6 +29,39 @@ 
 #ifndef LIBGOMP_PLUGIN_H
 #define LIBGOMP_PLUGIN_H 1
 
+#include <stddef.h>
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Capabilities of offloading devices.  */
+#define GOMP_OFFLOAD_CAP_SHARED_MEM	(1 << 0)
+#define GOMP_OFFLOAD_CAP_NATIVE_EXEC	(1 << 1)
+#define GOMP_OFFLOAD_CAP_OPENMP_400	(1 << 2)
+#define GOMP_OFFLOAD_CAP_OPENACC_200	(1 << 3)
+
+/* Type of offload target device.  Keep in sync with include/gomp-constants.h.  */
+enum offload_target_type
+{
+  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
+   from plugin to libgomp.  */
+struct mapping_table
+{
+  uintptr_t host_start;
+  uintptr_t host_end;
+  uintptr_t tgt_start;
+  uintptr_t tgt_end;
+};
+
+/* Miscellaneous functions.  */
 extern void *GOMP_PLUGIN_malloc (size_t) __attribute__((malloc));
 extern void *GOMP_PLUGIN_malloc_cleared (size_t) __attribute__((malloc));
 extern void *GOMP_PLUGIN_realloc (void *, size_t);
@@ -40,4 +73,8 @@  extern void GOMP_PLUGIN_error (const char *, ...)
 extern void GOMP_PLUGIN_fatal (const char *, ...)
 	__attribute__((noreturn, format (printf, 1, 2)));
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git libgomp/libgomp.h libgomp/libgomp.h
index eff790a..97732a5 100644
--- libgomp/libgomp.h
+++ libgomp/libgomp.h
@@ -38,6 +38,7 @@ 
 
 #include "config.h"
 #include "gstdint.h"
+#include "libgomp-plugin.h"
 
 #include <pthread.h>
 #include <stdbool.h>
@@ -632,7 +633,6 @@  extern void gomp_free_thread (void *);
 extern void gomp_init_targets_once (void);
 extern int gomp_get_num_devices (void);
 
-#include "libgomp_target.h"
 #include "splay-tree.h"
 
 struct target_mem_desc {
diff --git libgomp/libgomp_target.h libgomp/libgomp_target.h
deleted file mode 100644
index d753dfe..0000000
--- libgomp/libgomp_target.h
+++ /dev/null
@@ -1,53 +0,0 @@ 
-/* Copyright (C) 2014-2015 Free Software Foundation, Inc.
-
-   This file is part of the GNU Offloading and Multi Processing Library
-   (libgomp).
-
-   Libgomp is free software; you can redistribute it and/or modify it
-   under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
-   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-   FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
-   more details.
-
-   Under Section 7 of GPL version 3, you are granted additional
-   permissions described in the GCC Runtime Library Exception, version
-   3.1, as published by the Free Software Foundation.
-
-   You should have received a copy of the GNU General Public License and
-   a copy of the GCC Runtime Library Exception along with this program;
-   see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#ifndef LIBGOMP_TARGET_H
-#define LIBGOMP_TARGET_H 1
-
-/* Capabilities of offloading devices.  */
-#define GOMP_OFFLOAD_CAP_SHARED_MEM	(1 << 0)
-#define GOMP_OFFLOAD_CAP_NATIVE_EXEC	(1 << 1)
-#define GOMP_OFFLOAD_CAP_OPENMP_400	(1 << 2)
-#define GOMP_OFFLOAD_CAP_OPENACC_200	(1 << 3)
-
-/* Type of offload target device.  Keep in sync with include/gomp-constants.h.  */
-enum offload_target_type
-{
-  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
-   from plugin to libgomp.  */
-struct mapping_table
-{
-  uintptr_t host_start;
-  uintptr_t host_end;
-  uintptr_t tgt_start;
-  uintptr_t tgt_end;
-};
-
-#endif /* LIBGOMP_TARGET_H */
diff --git libgomp/oacc-async.c libgomp/oacc-async.c
index be59036..08b7c5e 100644
--- libgomp/oacc-async.c
+++ libgomp/oacc-async.c
@@ -29,7 +29,6 @@ 
 
 #include "openacc.h"
 #include "libgomp.h"
-#include "libgomp_target.h"
 #include "oacc-int.h"
 
 int
diff --git libgomp/oacc-cuda.c libgomp/oacc-cuda.c
index 4dc9e38..6f1a06f 100644
--- libgomp/oacc-cuda.c
+++ libgomp/oacc-cuda.c
@@ -29,7 +29,6 @@ 
 #include "openacc.h"
 #include "config.h"
 #include "libgomp.h"
-#include "libgomp_target.h"
 #include "oacc-int.h"
 
 void *
diff --git libgomp/oacc-init.c libgomp/oacc-init.c
index 4ca25eb..6f4a32c 100644
--- libgomp/oacc-init.c
+++ libgomp/oacc-init.c
@@ -27,7 +27,6 @@ 
    <http://www.gnu.org/licenses/>.  */
 
 #include "libgomp.h"
-#include "libgomp_target.h"
 #include "oacc-int.h"
 #include "openacc.h"
 #include <assert.h>
diff --git libgomp/oacc-mem.c libgomp/oacc-mem.c
index eb821b3..674fb76 100644
--- libgomp/oacc-mem.c
+++ libgomp/oacc-mem.c
@@ -30,7 +30,6 @@ 
 #include "config.h"
 #include "libgomp.h"
 #include "gomp-constants.h"
-#include "libgomp_target.h"
 #include "oacc-int.h"
 #include <stdio.h>
 #include <stdint.h>
diff --git libgomp/oacc-parallel.c libgomp/oacc-parallel.c
index 6bdf674..b6ee7c1 100644
--- libgomp/oacc-parallel.c
+++ libgomp/oacc-parallel.c
@@ -30,7 +30,6 @@ 
 #include "libgomp.h"
 #include "libgomp_g.h"
 #include "gomp-constants.h"
-#include "libgomp_target.h"
 #include "oacc-int.h"
 #include <stdio.h>
 #include <string.h>
diff --git libgomp/oacc-plugin.c libgomp/oacc-plugin.c
index baa891f..1fd6b2d 100644
--- libgomp/oacc-plugin.c
+++ libgomp/oacc-plugin.c
@@ -28,7 +28,6 @@ 
 
 #include "libgomp.h"
 #include "oacc-plugin.h"
-#include "libgomp_target.h"
 #include "oacc-int.h"
 
 void
diff --git libgomp/plugin/plugin-host.c libgomp/plugin/plugin-host.c
index 3a8bb48..acf9efd 100644
--- libgomp/plugin/plugin-host.c
+++ libgomp/plugin/plugin-host.c
@@ -33,7 +33,6 @@ 
 #include "openacc.h"
 #include "config.h"
 #include "libgomp.h"
-#include "libgomp_target.h"
 #ifdef HOST_NONSHM_PLUGIN
 #include "libgomp-plugin.h"
 #include "oacc-plugin.h"
diff --git libgomp/plugin/plugin-nvptx.c libgomp/plugin/plugin-nvptx.c
index f92ff40..4f0dc9a 100644
--- libgomp/plugin/plugin-nvptx.c
+++ libgomp/plugin/plugin-nvptx.c
@@ -34,7 +34,6 @@ 
 #include "openacc.h"
 #include "config.h"
 #include "libgomp.h"
-#include "libgomp_target.h"
 #include "libgomp-plugin.h"
 #include "oacc-ptx.h"
 #include "oacc-plugin.h"
diff --git libgomp/target.c libgomp/target.c
index 8bb0ae9..6871e7b 100644
--- libgomp/target.c
+++ libgomp/target.c
@@ -27,7 +27,6 @@ 
 
 #include "config.h"
 #include "libgomp.h"
-#include "libgomp_target.h"
 #include "oacc-plugin.h"
 #include "oacc-int.h"
 #include "gomp-constants.h"
diff --git liboffloadmic/plugin/libgomp-plugin-intelmic.cpp liboffloadmic/plugin/libgomp-plugin-intelmic.cpp
index b5aff92..3e7a958 100644
--- liboffloadmic/plugin/libgomp-plugin-intelmic.cpp
+++ liboffloadmic/plugin/libgomp-plugin-intelmic.cpp
@@ -34,7 +34,7 @@ 
 #include <string.h>
 #include <utility>
 #include <vector>
-#include <libgomp_target.h>
+#include "libgomp-plugin.h"
 #include "compiler_if_host.h"
 #include "main_target_image.h"