annotate libgomp/oacc-plugin.c @ 158:494b0b89df80 default tip

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