Commit dced339c by Thomas Schwinge

libgomp: Provide prototypes for functions implemented by libgomp plugins

	libgomp/
	* libgomp-plugin.h: #include <stdbool.h>.
	(GOMP_OFFLOAD_get_name, GOMP_OFFLOAD_get_caps)
	(GOMP_OFFLOAD_get_type, GOMP_OFFLOAD_get_num_devices)
	(GOMP_OFFLOAD_init_device, GOMP_OFFLOAD_fini_device)
	(GOMP_OFFLOAD_version, GOMP_OFFLOAD_load_image)
	(GOMP_OFFLOAD_unload_image, GOMP_OFFLOAD_alloc, GOMP_OFFLOAD_free)
	(GOMP_OFFLOAD_dev2host, GOMP_OFFLOAD_host2dev)
	(GOMP_OFFLOAD_dev2dev, GOMP_OFFLOAD_can_run, GOMP_OFFLOAD_run)
	(GOMP_OFFLOAD_async_run, GOMP_OFFLOAD_openacc_parallel)
	(GOMP_OFFLOAD_openacc_register_async_cleanup)
	(GOMP_OFFLOAD_openacc_async_test)
	(GOMP_OFFLOAD_openacc_async_test_all)
	(GOMP_OFFLOAD_openacc_async_wait)
	(GOMP_OFFLOAD_openacc_async_wait_async)
	(GOMP_OFFLOAD_openacc_async_wait_all)
	(GOMP_OFFLOAD_openacc_async_wait_all_async)
	(GOMP_OFFLOAD_openacc_async_set_async)
	(GOMP_OFFLOAD_openacc_create_thread_data)
	(GOMP_OFFLOAD_openacc_destroy_thread_data)
	(GOMP_OFFLOAD_openacc_get_current_cuda_device)
	(GOMP_OFFLOAD_openacc_get_current_cuda_context)
	(GOMP_OFFLOAD_openacc_get_cuda_stream)
	(GOMP_OFFLOAD_openacc_set_cuda_stream): New prototypes.
	* libgomp.h (struct acc_dispatch_t, struct gomp_device_descr): Use
	these.
	* plugin/plugin-hsa.c (GOMP_OFFLOAD_load_image)
	(GOMP_OFFLOAD_unload_image): Fix argument types.
	liboffloadmic/
	* plugin/libgomp-plugin-intelmic.cpp (GOMP_OFFLOAD_get_type): Fix
	return type.
	(GOMP_OFFLOAD_load_image): Fix argument types.

From-SVN: r245062
parent 5b11971a
2017-01-31 Thomas Schwinge <thomas@codesourcery.com>
* libgomp-plugin.h: #include <stdbool.h>.
(GOMP_OFFLOAD_get_name, GOMP_OFFLOAD_get_caps)
(GOMP_OFFLOAD_get_type, GOMP_OFFLOAD_get_num_devices)
(GOMP_OFFLOAD_init_device, GOMP_OFFLOAD_fini_device)
(GOMP_OFFLOAD_version, GOMP_OFFLOAD_load_image)
(GOMP_OFFLOAD_unload_image, GOMP_OFFLOAD_alloc, GOMP_OFFLOAD_free)
(GOMP_OFFLOAD_dev2host, GOMP_OFFLOAD_host2dev)
(GOMP_OFFLOAD_dev2dev, GOMP_OFFLOAD_can_run, GOMP_OFFLOAD_run)
(GOMP_OFFLOAD_async_run, GOMP_OFFLOAD_openacc_parallel)
(GOMP_OFFLOAD_openacc_register_async_cleanup)
(GOMP_OFFLOAD_openacc_async_test)
(GOMP_OFFLOAD_openacc_async_test_all)
(GOMP_OFFLOAD_openacc_async_wait)
(GOMP_OFFLOAD_openacc_async_wait_async)
(GOMP_OFFLOAD_openacc_async_wait_all)
(GOMP_OFFLOAD_openacc_async_wait_all_async)
(GOMP_OFFLOAD_openacc_async_set_async)
(GOMP_OFFLOAD_openacc_create_thread_data)
(GOMP_OFFLOAD_openacc_destroy_thread_data)
(GOMP_OFFLOAD_openacc_get_current_cuda_device)
(GOMP_OFFLOAD_openacc_get_current_cuda_context)
(GOMP_OFFLOAD_openacc_get_cuda_stream)
(GOMP_OFFLOAD_openacc_set_cuda_stream): New prototypes.
* libgomp.h (struct acc_dispatch_t, struct gomp_device_descr): Use
these.
* plugin/plugin-hsa.c (GOMP_OFFLOAD_load_image)
(GOMP_OFFLOAD_unload_image): Fix argument types.
2017-01-26 Jakub Jelinek <jakub@redhat.com> 2017-01-26 Jakub Jelinek <jakub@redhat.com>
* testsuite/lib/libgomp.exp * testsuite/lib/libgomp.exp
......
/* Copyright (C) 2014-2017 Free Software Foundation, Inc. /* The libgomp plugin API.
Copyright (C) 2014-2017 Free Software Foundation, Inc.
Contributed by Mentor Embedded. Contributed by Mentor Embedded.
...@@ -24,11 +26,10 @@ ...@@ -24,11 +26,10 @@
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */ <http://www.gnu.org/licenses/>. */
/* An interface to various libgomp-internal functions for use by plugins. */
#ifndef LIBGOMP_PLUGIN_H #ifndef LIBGOMP_PLUGIN_H
#define LIBGOMP_PLUGIN_H 1 #define LIBGOMP_PLUGIN_H 1
#include <stdbool.h>
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
...@@ -73,6 +74,42 @@ extern void GOMP_PLUGIN_error (const char *, ...) ...@@ -73,6 +74,42 @@ extern void GOMP_PLUGIN_error (const char *, ...)
extern void GOMP_PLUGIN_fatal (const char *, ...) extern void GOMP_PLUGIN_fatal (const char *, ...)
__attribute__ ((noreturn, format (printf, 1, 2))); __attribute__ ((noreturn, format (printf, 1, 2)));
/* Prototypes for functions implemented by libgomp plugins. */
extern const char *GOMP_OFFLOAD_get_name (void);
extern unsigned int GOMP_OFFLOAD_get_caps (void);
extern int GOMP_OFFLOAD_get_type (void);
extern int GOMP_OFFLOAD_get_num_devices (void);
extern bool GOMP_OFFLOAD_init_device (int);
extern bool GOMP_OFFLOAD_fini_device (int);
extern unsigned GOMP_OFFLOAD_version (void);
extern int GOMP_OFFLOAD_load_image (int, unsigned, const void *,
struct addr_pair **);
extern bool GOMP_OFFLOAD_unload_image (int, unsigned, const void *);
extern void *GOMP_OFFLOAD_alloc (int, size_t);
extern bool GOMP_OFFLOAD_free (int, void *);
extern bool GOMP_OFFLOAD_dev2host (int, void *, const void *, size_t);
extern bool GOMP_OFFLOAD_host2dev (int, void *, const void *, size_t);
extern bool GOMP_OFFLOAD_dev2dev (int, void *, const void *, size_t);
extern bool GOMP_OFFLOAD_can_run (void *);
extern void GOMP_OFFLOAD_run (int, void *, void *, void **);
extern void GOMP_OFFLOAD_async_run (int, void *, void *, void **, void *);
extern void GOMP_OFFLOAD_openacc_parallel (void (*) (void *), size_t, void **,
void **, int, unsigned *, void *);
extern void GOMP_OFFLOAD_openacc_register_async_cleanup (void *, int);
extern int GOMP_OFFLOAD_openacc_async_test (int);
extern int GOMP_OFFLOAD_openacc_async_test_all (void);
extern void GOMP_OFFLOAD_openacc_async_wait (int);
extern void GOMP_OFFLOAD_openacc_async_wait_async (int, int);
extern void GOMP_OFFLOAD_openacc_async_wait_all (void);
extern void GOMP_OFFLOAD_openacc_async_wait_all_async (int);
extern void GOMP_OFFLOAD_openacc_async_set_async (int);
extern void *GOMP_OFFLOAD_openacc_create_thread_data (int);
extern void GOMP_OFFLOAD_openacc_destroy_thread_data (void *);
extern void *GOMP_OFFLOAD_openacc_get_current_cuda_device (void);
extern void *GOMP_OFFLOAD_openacc_get_current_cuda_context (void);
extern void *GOMP_OFFLOAD_openacc_get_cuda_stream (int);
extern int GOMP_OFFLOAD_openacc_set_cuda_stream (int, void *);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
...@@ -882,31 +882,35 @@ typedef struct acc_dispatch_t ...@@ -882,31 +882,35 @@ typedef struct acc_dispatch_t
struct target_mem_desc *data_environ; struct target_mem_desc *data_environ;
/* Execute. */ /* Execute. */
void (*exec_func) (void (*) (void *), size_t, void **, void **, int, __typeof (GOMP_OFFLOAD_openacc_parallel) *exec_func;
unsigned *, void *);
/* Async cleanup callback registration. */ /* Async cleanup callback registration. */
void (*register_async_cleanup_func) (void *, int); __typeof (GOMP_OFFLOAD_openacc_register_async_cleanup)
*register_async_cleanup_func;
/* Asynchronous routines. */ /* Asynchronous routines. */
int (*async_test_func) (int); __typeof (GOMP_OFFLOAD_openacc_async_test) *async_test_func;
int (*async_test_all_func) (void); __typeof (GOMP_OFFLOAD_openacc_async_test_all) *async_test_all_func;
void (*async_wait_func) (int); __typeof (GOMP_OFFLOAD_openacc_async_wait) *async_wait_func;
void (*async_wait_async_func) (int, int); __typeof (GOMP_OFFLOAD_openacc_async_wait_async) *async_wait_async_func;
void (*async_wait_all_func) (void); __typeof (GOMP_OFFLOAD_openacc_async_wait_all) *async_wait_all_func;
void (*async_wait_all_async_func) (int); __typeof (GOMP_OFFLOAD_openacc_async_wait_all_async)
void (*async_set_async_func) (int); *async_wait_all_async_func;
__typeof (GOMP_OFFLOAD_openacc_async_set_async) *async_set_async_func;
/* Create/destroy TLS data. */ /* Create/destroy TLS data. */
void *(*create_thread_data_func) (int); __typeof (GOMP_OFFLOAD_openacc_create_thread_data) *create_thread_data_func;
void (*destroy_thread_data_func) (void *); __typeof (GOMP_OFFLOAD_openacc_destroy_thread_data)
*destroy_thread_data_func;
/* NVIDIA target specific routines. */ /* NVIDIA target specific routines. */
struct { struct {
void *(*get_current_device_func) (void); __typeof (GOMP_OFFLOAD_openacc_get_current_cuda_device)
void *(*get_current_context_func) (void); *get_current_device_func;
void *(*get_stream_func) (int); __typeof (GOMP_OFFLOAD_openacc_get_current_cuda_context)
int (*set_stream_func) (int, void *); *get_current_context_func;
__typeof (GOMP_OFFLOAD_openacc_get_cuda_stream) *get_stream_func;
__typeof (GOMP_OFFLOAD_openacc_set_cuda_stream) *set_stream_func;
} cuda; } cuda;
} acc_dispatch_t; } acc_dispatch_t;
...@@ -940,23 +944,23 @@ struct gomp_device_descr ...@@ -940,23 +944,23 @@ struct gomp_device_descr
enum offload_target_type type; enum offload_target_type type;
/* Function handlers. */ /* Function handlers. */
const char *(*get_name_func) (void); __typeof (GOMP_OFFLOAD_get_name) *get_name_func;
unsigned int (*get_caps_func) (void); __typeof (GOMP_OFFLOAD_get_caps) *get_caps_func;
int (*get_type_func) (void); __typeof (GOMP_OFFLOAD_get_type) *get_type_func;
int (*get_num_devices_func) (void); __typeof (GOMP_OFFLOAD_get_num_devices) *get_num_devices_func;
bool (*init_device_func) (int); __typeof (GOMP_OFFLOAD_init_device) *init_device_func;
bool (*fini_device_func) (int); __typeof (GOMP_OFFLOAD_fini_device) *fini_device_func;
unsigned (*version_func) (void); __typeof (GOMP_OFFLOAD_version) *version_func;
int (*load_image_func) (int, unsigned, const void *, struct addr_pair **); __typeof (GOMP_OFFLOAD_load_image) *load_image_func;
bool (*unload_image_func) (int, unsigned, const void *); __typeof (GOMP_OFFLOAD_unload_image) *unload_image_func;
void *(*alloc_func) (int, size_t); __typeof (GOMP_OFFLOAD_alloc) *alloc_func;
bool (*free_func) (int, void *); __typeof (GOMP_OFFLOAD_free) *free_func;
bool (*dev2host_func) (int, void *, const void *, size_t); __typeof (GOMP_OFFLOAD_dev2host) *dev2host_func;
bool (*host2dev_func) (int, void *, const void *, size_t); __typeof (GOMP_OFFLOAD_host2dev) *host2dev_func;
bool (*dev2dev_func) (int, void *, const void *, size_t); __typeof (GOMP_OFFLOAD_dev2dev) *dev2dev_func;
bool (*can_run_func) (void *); __typeof (GOMP_OFFLOAD_can_run) *can_run_func;
void (*run_func) (int, void *, void *, void **); __typeof (GOMP_OFFLOAD_run) *run_func;
void (*async_run_func) (int, void *, void *, void **, void *); __typeof (GOMP_OFFLOAD_async_run) *async_run_func;
/* Splay tree containing information about mapped memory regions. */ /* Splay tree containing information about mapped memory regions. */
struct splay_tree_s mem_map; struct splay_tree_s mem_map;
......
...@@ -891,7 +891,7 @@ init_basic_kernel_info (struct kernel_info *kernel, ...@@ -891,7 +891,7 @@ init_basic_kernel_info (struct kernel_info *kernel,
in TARGET_TABLE. */ in TARGET_TABLE. */
int int
GOMP_OFFLOAD_load_image (int ord, unsigned version, void *target_data, GOMP_OFFLOAD_load_image (int ord, unsigned version, const void *target_data,
struct addr_pair **target_table) struct addr_pair **target_table)
{ {
if (GOMP_VERSION_DEV (version) > GOMP_VERSION_HSA) if (GOMP_VERSION_DEV (version) > GOMP_VERSION_HSA)
...@@ -1726,7 +1726,7 @@ destroy_module (struct module_info *module) ...@@ -1726,7 +1726,7 @@ destroy_module (struct module_info *module)
TRUE on success. */ TRUE on success. */
bool bool
GOMP_OFFLOAD_unload_image (int n, unsigned version, void *target_data) GOMP_OFFLOAD_unload_image (int n, unsigned version, const void *target_data)
{ {
if (GOMP_VERSION_DEV (version) > GOMP_VERSION_HSA) if (GOMP_VERSION_DEV (version) > GOMP_VERSION_HSA)
{ {
......
2017-01-31 Thomas Schwinge <thomas@codesourcery.com>
* plugin/libgomp-plugin-intelmic.cpp (GOMP_OFFLOAD_get_type): Fix
return type.
(GOMP_OFFLOAD_load_image): Fix argument types.
2017-01-21 Jakub Jelinek <jakub@redhat.com> 2017-01-21 Jakub Jelinek <jakub@redhat.com>
PR other/79046 PR other/79046
...@@ -630,3 +636,9 @@ ...@@ -630,3 +636,9 @@
* runtime/orsl-lite/lib/orsl-lite.c: Ditto. * runtime/orsl-lite/lib/orsl-lite.c: Ditto.
* runtime/orsl-lite/version.txt: Ditto. * runtime/orsl-lite/version.txt: Ditto.
* runtime/use_mpss2.txt: Ditto. * runtime/use_mpss2.txt: Ditto.
Copyright (C) 2014-2017 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.
...@@ -159,7 +159,7 @@ GOMP_OFFLOAD_get_caps (void) ...@@ -159,7 +159,7 @@ GOMP_OFFLOAD_get_caps (void)
return res; return res;
} }
extern "C" enum offload_target_type extern "C" int
GOMP_OFFLOAD_get_type (void) GOMP_OFFLOAD_get_type (void)
{ {
enum offload_target_type res = OFFLOAD_TARGET_TYPE_INTEL_MIC; enum offload_target_type res = OFFLOAD_TARGET_TYPE_INTEL_MIC;
...@@ -345,7 +345,7 @@ GOMP_OFFLOAD_version (void) ...@@ -345,7 +345,7 @@ GOMP_OFFLOAD_version (void)
extern "C" int extern "C" int
GOMP_OFFLOAD_load_image (int device, const unsigned version, GOMP_OFFLOAD_load_image (int device, const unsigned version,
void *target_image, addr_pair **result) const void *target_image, addr_pair **result)
{ {
TRACE ("(device = %d, target_image = %p)", device, target_image); TRACE ("(device = %d, target_image = %p)", device, target_image);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment