xref: /dflybsd-src/contrib/gcc-8.0/libgomp/oacc-plugin.c (revision 38fd149817dfbff97799f62fcb70be98c4e32523)
1*38fd1498Szrj /* Copyright (C) 2014-2018 Free Software Foundation, Inc.
2*38fd1498Szrj 
3*38fd1498Szrj    Contributed by Mentor Embedded.
4*38fd1498Szrj 
5*38fd1498Szrj    This file is part of the GNU Offloading and Multi Processing Library
6*38fd1498Szrj    (libgomp).
7*38fd1498Szrj 
8*38fd1498Szrj    Libgomp is free software; you can redistribute it and/or modify it
9*38fd1498Szrj    under the terms of the GNU General Public License as published by
10*38fd1498Szrj    the Free Software Foundation; either version 3, or (at your option)
11*38fd1498Szrj    any later version.
12*38fd1498Szrj 
13*38fd1498Szrj    Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
14*38fd1498Szrj    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15*38fd1498Szrj    FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
16*38fd1498Szrj    more details.
17*38fd1498Szrj 
18*38fd1498Szrj    Under Section 7 of GPL version 3, you are granted additional
19*38fd1498Szrj    permissions described in the GCC Runtime Library Exception, version
20*38fd1498Szrj    3.1, as published by the Free Software Foundation.
21*38fd1498Szrj 
22*38fd1498Szrj    You should have received a copy of the GNU General Public License and
23*38fd1498Szrj    a copy of the GCC Runtime Library Exception along with this program;
24*38fd1498Szrj    see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
25*38fd1498Szrj    <http://www.gnu.org/licenses/>.  */
26*38fd1498Szrj 
27*38fd1498Szrj /* Initialize and register OpenACC dispatch table from libgomp plugin.  */
28*38fd1498Szrj 
29*38fd1498Szrj #include "libgomp.h"
30*38fd1498Szrj #include "oacc-plugin.h"
31*38fd1498Szrj #include "oacc-int.h"
32*38fd1498Szrj 
33*38fd1498Szrj void
GOMP_PLUGIN_async_unmap_vars(void * ptr,int async)34*38fd1498Szrj GOMP_PLUGIN_async_unmap_vars (void *ptr, int async)
35*38fd1498Szrj {
36*38fd1498Szrj   struct target_mem_desc *tgt = ptr;
37*38fd1498Szrj   struct gomp_device_descr *devicep = tgt->device_descr;
38*38fd1498Szrj 
39*38fd1498Szrj   devicep->openacc.async_set_async_func (async);
40*38fd1498Szrj   gomp_unmap_vars (tgt, true);
41*38fd1498Szrj   devicep->openacc.async_set_async_func (acc_async_sync);
42*38fd1498Szrj }
43*38fd1498Szrj 
44*38fd1498Szrj /* Return the target-specific part of the TLS data for the current thread.  */
45*38fd1498Szrj 
46*38fd1498Szrj void *
GOMP_PLUGIN_acc_thread(void)47*38fd1498Szrj GOMP_PLUGIN_acc_thread (void)
48*38fd1498Szrj {
49*38fd1498Szrj   struct goacc_thread *thr = goacc_thread ();
50*38fd1498Szrj   return thr ? thr->target_tls : NULL;
51*38fd1498Szrj }
52