annotate libgomp/oacc-int.h @ 136:4627f235cf2a

fix c-next example
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Thu, 08 Nov 2018 14:11: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 /* OpenACC Runtime - internal declarations
kono
parents:
diff changeset
2
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
3 Copyright (C) 2013-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 /* This file contains data types and function declarations that are not
kono
parents:
diff changeset
30 part of the official OpenACC user interface. There are declarations
kono
parents:
diff changeset
31 in here that are part of the GNU OpenACC ABI, in that the compiler is
kono
parents:
diff changeset
32 required to know about them and use them.
kono
parents:
diff changeset
33
kono
parents:
diff changeset
34 The convention is that the all caps prefix "GOACC" is used group items
kono
parents:
diff changeset
35 that are part of the external ABI, and the lower case prefix "goacc"
kono
parents:
diff changeset
36 is used group items that are completely private to the library. */
kono
parents:
diff changeset
37
kono
parents:
diff changeset
38 #ifndef OACC_INT_H
kono
parents:
diff changeset
39 #define OACC_INT_H 1
kono
parents:
diff changeset
40
kono
parents:
diff changeset
41 #include "openacc.h"
kono
parents:
diff changeset
42 #include "config.h"
kono
parents:
diff changeset
43 #include <stddef.h>
kono
parents:
diff changeset
44 #include <stdbool.h>
kono
parents:
diff changeset
45 #include <stdarg.h>
kono
parents:
diff changeset
46
kono
parents:
diff changeset
47 #ifdef HAVE_ATTRIBUTE_VISIBILITY
kono
parents:
diff changeset
48 # pragma GCC visibility push(hidden)
kono
parents:
diff changeset
49 #endif
kono
parents:
diff changeset
50
kono
parents:
diff changeset
51 static inline enum acc_device_t
kono
parents:
diff changeset
52 acc_device_type (enum offload_target_type type)
kono
parents:
diff changeset
53 {
kono
parents:
diff changeset
54 return (enum acc_device_t) type;
kono
parents:
diff changeset
55 }
kono
parents:
diff changeset
56
kono
parents:
diff changeset
57 struct goacc_thread
kono
parents:
diff changeset
58 {
kono
parents:
diff changeset
59 /* The base device for the current thread. */
kono
parents:
diff changeset
60 struct gomp_device_descr *base_dev;
kono
parents:
diff changeset
61
kono
parents:
diff changeset
62 /* The device for the current thread. */
kono
parents:
diff changeset
63 struct gomp_device_descr *dev;
kono
parents:
diff changeset
64
kono
parents:
diff changeset
65 struct gomp_device_descr *saved_bound_dev;
kono
parents:
diff changeset
66
kono
parents:
diff changeset
67 /* This is a linked list of data mapped by the "acc data" pragma, following
kono
parents:
diff changeset
68 strictly push/pop semantics according to lexical scope. */
kono
parents:
diff changeset
69 struct target_mem_desc *mapped_data;
kono
parents:
diff changeset
70
kono
parents:
diff changeset
71 /* These structures form a list: this is the next thread in that list. */
kono
parents:
diff changeset
72 struct goacc_thread *next;
kono
parents:
diff changeset
73
kono
parents:
diff changeset
74 /* Target-specific data (used by plugin). */
kono
parents:
diff changeset
75 void *target_tls;
kono
parents:
diff changeset
76 };
kono
parents:
diff changeset
77
kono
parents:
diff changeset
78 #if defined HAVE_TLS || defined USE_EMUTLS
kono
parents:
diff changeset
79 extern __thread struct goacc_thread *goacc_tls_data;
kono
parents:
diff changeset
80 static inline struct goacc_thread *
kono
parents:
diff changeset
81 goacc_thread (void)
kono
parents:
diff changeset
82 {
kono
parents:
diff changeset
83 return goacc_tls_data;
kono
parents:
diff changeset
84 }
kono
parents:
diff changeset
85 #else
kono
parents:
diff changeset
86 extern pthread_key_t goacc_tls_key;
kono
parents:
diff changeset
87 static inline struct goacc_thread *
kono
parents:
diff changeset
88 goacc_thread (void)
kono
parents:
diff changeset
89 {
kono
parents:
diff changeset
90 return pthread_getspecific (goacc_tls_key);
kono
parents:
diff changeset
91 }
kono
parents:
diff changeset
92 #endif
kono
parents:
diff changeset
93
kono
parents:
diff changeset
94 void goacc_register (struct gomp_device_descr *) __GOACC_NOTHROW;
kono
parents:
diff changeset
95 void goacc_attach_host_thread_to_device (int);
kono
parents:
diff changeset
96 void goacc_runtime_initialize (void);
kono
parents:
diff changeset
97 void goacc_save_and_set_bind (acc_device_t);
kono
parents:
diff changeset
98 void goacc_restore_bind (void);
kono
parents:
diff changeset
99 void goacc_lazy_initialize (void);
kono
parents:
diff changeset
100 void goacc_host_init (void);
kono
parents:
diff changeset
101
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
102 static inline bool
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
103 async_valid_stream_id_p (int async)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
104 {
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
105 return async >= 0;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
106 }
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
107
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
108 static inline bool
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
109 async_valid_p (int async)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
110 {
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
111 return (async == acc_async_noval || async == acc_async_sync
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
112 || async_valid_stream_id_p (async));
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
113 }
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
114
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
115 static inline bool
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
116 async_synchronous_p (int async)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
117 {
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
118 if (!async_valid_p (async))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
119 return true;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
120
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
121 return async == acc_async_sync;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
122 }
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
123
111
kono
parents:
diff changeset
124 #ifdef HAVE_ATTRIBUTE_VISIBILITY
kono
parents:
diff changeset
125 # pragma GCC visibility pop
kono
parents:
diff changeset
126 #endif
kono
parents:
diff changeset
127
kono
parents:
diff changeset
128 #endif