RISC-V: Delete obsolete MIPS comment.
[official-gcc.git] / libgomp / oacc-int.h
blobcdd0f7f0f73727c0d06a7b31fa88a130852bc215
1 /* OpenACC Runtime - internal declarations
3 Copyright (C) 2013-2018 Free Software Foundation, Inc.
5 Contributed by Mentor Embedded.
7 This file is part of the GNU Offloading and Multi Processing Library
8 (libgomp).
10 Libgomp is free software; you can redistribute it and/or modify it
11 under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 3, or (at your option)
13 any later version.
15 Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
16 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18 more details.
20 Under Section 7 of GPL version 3, you are granted additional
21 permissions described in the GCC Runtime Library Exception, version
22 3.1, as published by the Free Software Foundation.
24 You should have received a copy of the GNU General Public License and
25 a copy of the GCC Runtime Library Exception along with this program;
26 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
27 <http://www.gnu.org/licenses/>. */
29 /* This file contains data types and function declarations that are not
30 part of the official OpenACC user interface. There are declarations
31 in here that are part of the GNU OpenACC ABI, in that the compiler is
32 required to know about them and use them.
34 The convention is that the all caps prefix "GOACC" is used group items
35 that are part of the external ABI, and the lower case prefix "goacc"
36 is used group items that are completely private to the library. */
38 #ifndef OACC_INT_H
39 #define OACC_INT_H 1
41 #include "openacc.h"
42 #include "config.h"
43 #include <stddef.h>
44 #include <stdbool.h>
45 #include <stdarg.h>
47 #ifdef HAVE_ATTRIBUTE_VISIBILITY
48 # pragma GCC visibility push(hidden)
49 #endif
51 static inline enum acc_device_t
52 acc_device_type (enum offload_target_type type)
54 return (enum acc_device_t) type;
57 struct goacc_thread
59 /* The base device for the current thread. */
60 struct gomp_device_descr *base_dev;
62 /* The device for the current thread. */
63 struct gomp_device_descr *dev;
65 struct gomp_device_descr *saved_bound_dev;
67 /* This is a linked list of data mapped by the "acc data" pragma, following
68 strictly push/pop semantics according to lexical scope. */
69 struct target_mem_desc *mapped_data;
71 /* These structures form a list: this is the next thread in that list. */
72 struct goacc_thread *next;
74 /* Target-specific data (used by plugin). */
75 void *target_tls;
78 #if defined HAVE_TLS || defined USE_EMUTLS
79 extern __thread struct goacc_thread *goacc_tls_data;
80 static inline struct goacc_thread *
81 goacc_thread (void)
83 return goacc_tls_data;
85 #else
86 extern pthread_key_t goacc_tls_key;
87 static inline struct goacc_thread *
88 goacc_thread (void)
90 return pthread_getspecific (goacc_tls_key);
92 #endif
94 void goacc_register (struct gomp_device_descr *) __GOACC_NOTHROW;
95 void goacc_attach_host_thread_to_device (int);
96 void goacc_runtime_initialize (void);
97 void goacc_save_and_set_bind (acc_device_t);
98 void goacc_restore_bind (void);
99 void goacc_lazy_initialize (void);
100 void goacc_host_init (void);
102 static inline bool
103 async_valid_stream_id_p (int async)
105 return async >= 0;
108 static inline bool
109 async_valid_p (int async)
111 return (async == acc_async_noval || async == acc_async_sync
112 || async_valid_stream_id_p (async));
115 static inline bool
116 async_synchronous_p (int async)
118 if (!async_valid_p (async))
119 return true;
121 return async == acc_async_sync;
124 #ifdef HAVE_ATTRIBUTE_VISIBILITY
125 # pragma GCC visibility pop
126 #endif
128 #endif