145
|
1 /* Copyright (C) 2014-2020 Free Software Foundation, Inc.
|
111
|
2
|
|
3 Contributed by Mentor Embedded.
|
|
4
|
|
5 This file is part of the GNU Offloading and Multi Processing Library
|
|
6 (libgomp).
|
|
7
|
|
8 Libgomp is free software; you can redistribute it and/or modify it
|
|
9 under the terms of the GNU General Public License as published by
|
|
10 the Free Software Foundation; either version 3, or (at your option)
|
|
11 any later version.
|
|
12
|
|
13 Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
15 FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
16 more details.
|
|
17
|
|
18 Under Section 7 of GPL version 3, you are granted additional
|
|
19 permissions described in the GCC Runtime Library Exception, version
|
|
20 3.1, as published by the Free Software Foundation.
|
|
21
|
|
22 You should have received a copy of the GNU General Public License and
|
|
23 a copy of the GCC Runtime Library Exception along with this program;
|
|
24 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
|
25 <http://www.gnu.org/licenses/>. */
|
|
26
|
|
27 /* Initialize and register OpenACC dispatch table from libgomp plugin. */
|
|
28
|
|
29 #include "libgomp.h"
|
|
30 #include "oacc-plugin.h"
|
|
31 #include "oacc-int.h"
|
145
|
32 #include "acc_prof.h"
|
111
|
33
|
145
|
34 /* This plugin function is now obsolete. */
|
111
|
35 void
|
145
|
36 GOMP_PLUGIN_async_unmap_vars (void *ptr __attribute__((unused)),
|
|
37 int async __attribute__((unused)))
|
111
|
38 {
|
145
|
39 gomp_fatal ("invalid plugin function");
|
|
40 }
|
|
41
|
|
42 /* Return the TLS data for the current thread. */
|
111
|
43
|
145
|
44 struct goacc_thread *
|
|
45 GOMP_PLUGIN_goacc_thread (void)
|
|
46 {
|
|
47 return goacc_thread ();
|
111
|
48 }
|
|
49
|
|
50 /* Return the target-specific part of the TLS data for the current thread. */
|
|
51
|
|
52 void *
|
|
53 GOMP_PLUGIN_acc_thread (void)
|
|
54 {
|
|
55 struct goacc_thread *thr = goacc_thread ();
|
|
56 return thr ? thr->target_tls : NULL;
|
|
57 }
|
131
|
58
|
|
59 int
|
|
60 GOMP_PLUGIN_acc_default_dim (unsigned int i)
|
|
61 {
|
|
62 if (i >= GOMP_DIM_MAX)
|
|
63 {
|
|
64 gomp_fatal ("invalid dimension argument: %d", i);
|
|
65 return -1;
|
|
66 }
|
|
67 return goacc_default_dims[i];
|
|
68 }
|
145
|
69
|
|
70 void
|
|
71 GOMP_PLUGIN_goacc_profiling_dispatch (acc_prof_info *prof_info,
|
|
72 acc_event_info *event_info,
|
|
73 acc_api_info *api_info)
|
|
74 {
|
|
75 goacc_profiling_dispatch (prof_info, event_info, api_info);
|
|
76 }
|