annotate libgomp/libgomp-plugin.h @ 144:8f4e72ab4e11

fix segmentation fault caused by nothing next cur_op to end
author Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Sun, 23 Dec 2018 21:23:56 +0900
parents 84e7813d76e9
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* The libgomp plugin API.
kono
parents:
diff changeset
2
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
3 Copyright (C) 2014-2018 Free Software Foundation, Inc.
111
kono
parents:
diff changeset
4
kono
parents:
diff changeset
5 Contributed by Mentor Embedded.
kono
parents:
diff changeset
6
kono
parents:
diff changeset
7 This file is part of the GNU Offloading and Multi Processing Library
kono
parents:
diff changeset
8 (libgomp).
kono
parents:
diff changeset
9
kono
parents:
diff changeset
10 Libgomp is free software; you can redistribute it and/or modify it
kono
parents:
diff changeset
11 under the terms of the GNU General Public License as published by
kono
parents:
diff changeset
12 the Free Software Foundation; either version 3, or (at your option)
kono
parents:
diff changeset
13 any later version.
kono
parents:
diff changeset
14
kono
parents:
diff changeset
15 Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
kono
parents:
diff changeset
16 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
kono
parents:
diff changeset
17 FOR A PARTICULAR PURPOSE. See the GNU General Public License for
kono
parents:
diff changeset
18 more details.
kono
parents:
diff changeset
19
kono
parents:
diff changeset
20 Under Section 7 of GPL version 3, you are granted additional
kono
parents:
diff changeset
21 permissions described in the GCC Runtime Library Exception, version
kono
parents:
diff changeset
22 3.1, as published by the Free Software Foundation.
kono
parents:
diff changeset
23
kono
parents:
diff changeset
24 You should have received a copy of the GNU General Public License and
kono
parents:
diff changeset
25 a copy of the GCC Runtime Library Exception along with this program;
kono
parents:
diff changeset
26 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
kono
parents:
diff changeset
27 <http://www.gnu.org/licenses/>. */
kono
parents:
diff changeset
28
kono
parents:
diff changeset
29 #ifndef LIBGOMP_PLUGIN_H
kono
parents:
diff changeset
30 #define LIBGOMP_PLUGIN_H 1
kono
parents:
diff changeset
31
kono
parents:
diff changeset
32 #include <stdbool.h>
kono
parents:
diff changeset
33 #include <stddef.h>
kono
parents:
diff changeset
34 #include <stdint.h>
kono
parents:
diff changeset
35
kono
parents:
diff changeset
36 #ifdef __cplusplus
kono
parents:
diff changeset
37 extern "C" {
kono
parents:
diff changeset
38 #endif
kono
parents:
diff changeset
39
kono
parents:
diff changeset
40 /* Capabilities of offloading devices. */
kono
parents:
diff changeset
41 #define GOMP_OFFLOAD_CAP_SHARED_MEM (1 << 0)
kono
parents:
diff changeset
42 #define GOMP_OFFLOAD_CAP_NATIVE_EXEC (1 << 1)
kono
parents:
diff changeset
43 #define GOMP_OFFLOAD_CAP_OPENMP_400 (1 << 2)
kono
parents:
diff changeset
44 #define GOMP_OFFLOAD_CAP_OPENACC_200 (1 << 3)
kono
parents:
diff changeset
45
kono
parents:
diff changeset
46 /* Type of offload target device. Keep in sync with include/gomp-constants.h. */
kono
parents:
diff changeset
47 enum offload_target_type
kono
parents:
diff changeset
48 {
kono
parents:
diff changeset
49 OFFLOAD_TARGET_TYPE_HOST = 2,
kono
parents:
diff changeset
50 /* OFFLOAD_TARGET_TYPE_HOST_NONSHM = 3 removed. */
kono
parents:
diff changeset
51 OFFLOAD_TARGET_TYPE_NVIDIA_PTX = 5,
kono
parents:
diff changeset
52 OFFLOAD_TARGET_TYPE_INTEL_MIC = 6,
kono
parents:
diff changeset
53 OFFLOAD_TARGET_TYPE_HSA = 7
kono
parents:
diff changeset
54 };
kono
parents:
diff changeset
55
kono
parents:
diff changeset
56 /* Auxiliary struct, used for transferring pairs of addresses from plugin
kono
parents:
diff changeset
57 to libgomp. */
kono
parents:
diff changeset
58 struct addr_pair
kono
parents:
diff changeset
59 {
kono
parents:
diff changeset
60 uintptr_t start;
kono
parents:
diff changeset
61 uintptr_t end;
kono
parents:
diff changeset
62 };
kono
parents:
diff changeset
63
kono
parents:
diff changeset
64 /* Miscellaneous functions. */
kono
parents:
diff changeset
65 extern void *GOMP_PLUGIN_malloc (size_t) __attribute__ ((malloc));
kono
parents:
diff changeset
66 extern void *GOMP_PLUGIN_malloc_cleared (size_t) __attribute__ ((malloc));
kono
parents:
diff changeset
67 extern void *GOMP_PLUGIN_realloc (void *, size_t);
kono
parents:
diff changeset
68 void GOMP_PLUGIN_target_task_completion (void *);
kono
parents:
diff changeset
69
kono
parents:
diff changeset
70 extern void GOMP_PLUGIN_debug (int, const char *, ...)
kono
parents:
diff changeset
71 __attribute__ ((format (printf, 2, 3)));
kono
parents:
diff changeset
72 extern void GOMP_PLUGIN_error (const char *, ...)
kono
parents:
diff changeset
73 __attribute__ ((format (printf, 1, 2)));
kono
parents:
diff changeset
74 extern void GOMP_PLUGIN_fatal (const char *, ...)
kono
parents:
diff changeset
75 __attribute__ ((noreturn, format (printf, 1, 2)));
kono
parents:
diff changeset
76
kono
parents:
diff changeset
77 /* Prototypes for functions implemented by libgomp plugins. */
kono
parents:
diff changeset
78 extern const char *GOMP_OFFLOAD_get_name (void);
kono
parents:
diff changeset
79 extern unsigned int GOMP_OFFLOAD_get_caps (void);
kono
parents:
diff changeset
80 extern int GOMP_OFFLOAD_get_type (void);
kono
parents:
diff changeset
81 extern int GOMP_OFFLOAD_get_num_devices (void);
kono
parents:
diff changeset
82 extern bool GOMP_OFFLOAD_init_device (int);
kono
parents:
diff changeset
83 extern bool GOMP_OFFLOAD_fini_device (int);
kono
parents:
diff changeset
84 extern unsigned GOMP_OFFLOAD_version (void);
kono
parents:
diff changeset
85 extern int GOMP_OFFLOAD_load_image (int, unsigned, const void *,
kono
parents:
diff changeset
86 struct addr_pair **);
kono
parents:
diff changeset
87 extern bool GOMP_OFFLOAD_unload_image (int, unsigned, const void *);
kono
parents:
diff changeset
88 extern void *GOMP_OFFLOAD_alloc (int, size_t);
kono
parents:
diff changeset
89 extern bool GOMP_OFFLOAD_free (int, void *);
kono
parents:
diff changeset
90 extern bool GOMP_OFFLOAD_dev2host (int, void *, const void *, size_t);
kono
parents:
diff changeset
91 extern bool GOMP_OFFLOAD_host2dev (int, void *, const void *, size_t);
kono
parents:
diff changeset
92 extern bool GOMP_OFFLOAD_dev2dev (int, void *, const void *, size_t);
kono
parents:
diff changeset
93 extern bool GOMP_OFFLOAD_can_run (void *);
kono
parents:
diff changeset
94 extern void GOMP_OFFLOAD_run (int, void *, void *, void **);
kono
parents:
diff changeset
95 extern void GOMP_OFFLOAD_async_run (int, void *, void *, void **, void *);
kono
parents:
diff changeset
96 extern void GOMP_OFFLOAD_openacc_exec (void (*) (void *), size_t, void **,
kono
parents:
diff changeset
97 void **, int, unsigned *, void *);
kono
parents:
diff changeset
98 extern void GOMP_OFFLOAD_openacc_register_async_cleanup (void *, int);
kono
parents:
diff changeset
99 extern int GOMP_OFFLOAD_openacc_async_test (int);
kono
parents:
diff changeset
100 extern int GOMP_OFFLOAD_openacc_async_test_all (void);
kono
parents:
diff changeset
101 extern void GOMP_OFFLOAD_openacc_async_wait (int);
kono
parents:
diff changeset
102 extern void GOMP_OFFLOAD_openacc_async_wait_async (int, int);
kono
parents:
diff changeset
103 extern void GOMP_OFFLOAD_openacc_async_wait_all (void);
kono
parents:
diff changeset
104 extern void GOMP_OFFLOAD_openacc_async_wait_all_async (int);
kono
parents:
diff changeset
105 extern void GOMP_OFFLOAD_openacc_async_set_async (int);
kono
parents:
diff changeset
106 extern void *GOMP_OFFLOAD_openacc_create_thread_data (int);
kono
parents:
diff changeset
107 extern void GOMP_OFFLOAD_openacc_destroy_thread_data (void *);
kono
parents:
diff changeset
108 extern void *GOMP_OFFLOAD_openacc_cuda_get_current_device (void);
kono
parents:
diff changeset
109 extern void *GOMP_OFFLOAD_openacc_cuda_get_current_context (void);
kono
parents:
diff changeset
110 extern void *GOMP_OFFLOAD_openacc_cuda_get_stream (int);
kono
parents:
diff changeset
111 extern int GOMP_OFFLOAD_openacc_cuda_set_stream (int, void *);
kono
parents:
diff changeset
112
kono
parents:
diff changeset
113 #ifdef __cplusplus
kono
parents:
diff changeset
114 }
kono
parents:
diff changeset
115 #endif
kono
parents:
diff changeset
116
kono
parents:
diff changeset
117 #endif