]> git.ipfire.org Git - thirdparty/gcc.git/blame - libgomp/oacc-plugin.c
PR tree-optimization/90090
[thirdparty/gcc.git] / libgomp / oacc-plugin.c
CommitLineData
fbd26352 1/* Copyright (C) 2014-2019 Free Software Foundation, Inc.
995b27b9 2
ca4c3545 3 Contributed by Mentor Embedded.
4
c35c9a62 5 This file is part of the GNU Offloading and Multi Processing Library
6 (libgomp).
995b27b9 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
ca4c3545 27/* Initialize and register OpenACC dispatch table from libgomp plugin. */
995b27b9 28
ca4c3545 29#include "libgomp.h"
30#include "oacc-plugin.h"
31#include "oacc-int.h"
995b27b9 32
ca4c3545 33void
2bf775c0 34GOMP_PLUGIN_async_unmap_vars (void *ptr, int async)
995b27b9 35{
ca4c3545 36 struct target_mem_desc *tgt = ptr;
2bf775c0 37 struct gomp_device_descr *devicep = tgt->device_descr;
ca4c3545 38
2bf775c0 39 devicep->openacc.async_set_async_func (async);
40 gomp_unmap_vars (tgt, true);
41 devicep->openacc.async_set_async_func (acc_async_sync);
ca4c3545 42}
995b27b9 43
ca4c3545 44/* Return the target-specific part of the TLS data for the current thread. */
45
46void *
47GOMP_PLUGIN_acc_thread (void)
48{
49 struct goacc_thread *thr = goacc_thread ();
50 return thr ? thr->target_tls : NULL;
51}
8655b2ce 52
53int
54GOMP_PLUGIN_acc_default_dim (unsigned int i)
55{
56 if (i >= GOMP_DIM_MAX)
57 {
58 gomp_fatal ("invalid dimension argument: %d", i);
59 return -1;
60 }
61 return goacc_default_dims[i];
62}