+2019-11-13 Andrew Stubbs <ams@codesourcery.com>
+
+ * configure.tgt (nvptx*-*-*): Add "accel" directory.
+ * config/nvptx/libgomp-plugin.c: Move ...
+ * config/accel/libgomp-plugin.c: ... to here.
+ * config/nvptx/lock.c: Move ...
+ * config/accel/lock.c: ... to here.
+ * config/nvptx/mutex.c: Move ...
+ * config/accel/mutex.c: ... to here.
+ * config/nvptx/mutex.h: Move ...
+ * config/accel/mutex.h: ... to here.
+ * config/nvptx/oacc-async.c: Move ...
+ * config/accel/oacc-async.c: ... to here.
+ * config/nvptx/oacc-cuda.c: Move ...
+ * config/accel/oacc-cuda.c: ... to here.
+ * config/nvptx/oacc-host.c: Move ...
+ * config/accel/oacc-host.c: ... to here.
+ * config/nvptx/oacc-init.c: Move ...
+ * config/accel/oacc-init.c: ... to here.
+ * config/nvptx/oacc-mem.c: Move ...
+ * config/accel/oacc-mem.c: ... to here.
+ * config/nvptx/oacc-plugin.c: Move ...
+ * config/accel/oacc-plugin.c: ... to here.
+ * config/nvptx/omp-lock.h: Move ...
+ * config/accel/omp-lock.h: ... to here.
+ * config/nvptx/openacc.f90: Move ...
+ * config/accel/openacc.f90: ... to here.
+ * config/nvptx/pool.h: Move ...
+ * config/accel/pool.h: ... to here.
+ * config/nvptx/proc.c: Move ...
+ * config/accel/proc.c: ... to here.
+ * config/nvptx/ptrlock.c: Move ...
+ * config/accel/ptrlock.c: ... to here.
+ * config/nvptx/ptrlock.h: Move ...
+ * config/accel/ptrlock.h: ... to here.
+ * config/nvptx/sem.c: Move ...
+ * config/accel/sem.c: ... to here.
+ * config/nvptx/sem.h: Move ...
+ * config/accel/sem.h: ... to here.
+ * config/nvptx/thread-stacksize.h: Move ...
+ * config/accel/thread-stacksize.h: ... to here.
+
2019-11-12 Maciej W. Rozycki <macro@codesourcery.com>
Tobias Burnus <tobias@codesourcery.com>
Frederik Harwath <frederik@codesourcery.com>
--- /dev/null
+/* Copyright (C) 2016-2019 Free Software Foundation, Inc.
+ Contributed by Alexander Monakov <amonakov@ispras.ru>.
+
+ This file is part of the GNU Offloading and Multi Processing Library
+ (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ Under Section 7 of GPL version 3, you are granted additional
+ permissions described in the GCC Runtime Library Exception, version
+ 3.1, as published by the Free Software Foundation.
+
+ You should have received a copy of the GNU General Public License and
+ a copy of the GCC Runtime Library Exception along with this program;
+ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+/* This is a NVPTX specific implementation of the public OpenMP locking
+ primitives. */
+
+/* Reuse the generic implementation in terms of gomp_mutex_t. */
+#include "../../lock.c"
+
+ialias (omp_init_lock)
+ialias (omp_init_nest_lock)
+ialias (omp_destroy_lock)
+ialias (omp_destroy_nest_lock)
+ialias (omp_set_lock)
+ialias (omp_set_nest_lock)
+ialias (omp_unset_lock)
+ialias (omp_unset_nest_lock)
+ialias (omp_test_lock)
+ialias (omp_test_nest_lock)
--- /dev/null
+/* Copyright (C) 2015-2019 Free Software Foundation, Inc.
+ Contributed by Alexander Monakov <amonakov@ispras.ru>
+
+ This file is part of the GNU Offloading and Multi Processing Library
+ (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ Under Section 7 of GPL version 3, you are granted additional
+ permissions described in the GCC Runtime Library Exception, version
+ 3.1, as published by the Free Software Foundation.
+
+ You should have received a copy of the GNU General Public License and
+ a copy of the GCC Runtime Library Exception along with this program;
+ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+/* This is an NVPTX specific implementation of a mutex synchronization
+ mechanism for libgomp. This type is private to the library. This
+ implementation uses atomic instructions and busy waiting. */
+
+#ifndef GOMP_MUTEX_H
+#define GOMP_MUTEX_H 1
+
+typedef int gomp_mutex_t;
+
+#define GOMP_MUTEX_INIT_0 1
+
+static inline void
+gomp_mutex_init (gomp_mutex_t *mutex)
+{
+ *mutex = 0;
+}
+
+static inline void
+gomp_mutex_destroy (gomp_mutex_t *mutex)
+{
+}
+
+static inline void
+gomp_mutex_lock (gomp_mutex_t *mutex)
+{
+ while (__sync_lock_test_and_set (mutex, 1))
+ /* spin */ ;
+}
+
+static inline void
+gomp_mutex_unlock (gomp_mutex_t *mutex)
+{
+ __sync_lock_release (mutex);
+}
+#endif /* GOMP_MUTEX_H */
--- /dev/null
+/* OpenACC Runtime initialization routines
+
+ Copyright (C) 2014-2019 Free Software Foundation, Inc.
+
+ Contributed by Mentor Embedded.
+
+ This file is part of the GNU Offloading and Multi Processing Library
+ (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ Under Section 7 of GPL version 3, you are granted additional
+ permissions described in the GCC Runtime Library Exception, version
+ 3.1, as published by the Free Software Foundation.
+
+ You should have received a copy of the GNU General Public License and
+ a copy of the GCC Runtime Library Exception along with this program;
+ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include "openacc.h"
+
+/* For -O and higher, the compiler always attempts to expand acc_on_device, but
+ if the user disables the builtin, or calls it via a pointer, we'll need this
+ version.
+
+ Compile this with optimization, so that the compiler expands
+ this, rather than generating infinitely recursive code. */
+
+int __attribute__ ((__optimize__ ("O2")))
+acc_on_device (acc_device_t dev)
+{
+ return __builtin_acc_on_device (dev);
+}
--- /dev/null
+/* This header is used during the build process to find the size and
+ alignment of the public OpenMP locks, so that we can export data
+ structures without polluting the namespace.
+
+ When using the Linux futex primitive, non-recursive locks require
+ one int. Recursive locks require we identify the owning task
+ and so require in addition one int and a pointer. */
+
+typedef int omp_lock_t;
+typedef struct { int lock, count; void *owner; } omp_nest_lock_t;
+typedef int omp_lock_25_t;
+typedef struct { int owner, count; } omp_nest_lock_25_t;
--- /dev/null
+! OpenACC Runtime Library Definitions.
+
+! Copyright (C) 2014-2019 Free Software Foundation, Inc.
+
+! Contributed by Tobias Burnus <burnus@net-b.de>
+! and Mentor Embedded.
+
+! This file is part of the GNU Offloading and Multi Processing Library
+! (libgomp).
+
+! Libgomp is free software; you can redistribute it and/or modify it
+! under the terms of the GNU General Public License as published by
+! the Free Software Foundation; either version 3, or (at your option)
+! any later version.
+
+! Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
+! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+! FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+! more details.
+
+! Under Section 7 of GPL version 3, you are granted additional
+! permissions described in the GCC Runtime Library Exception, version
+! 3.1, as published by the Free Software Foundation.
+
+! You should have received a copy of the GNU General Public License and
+! a copy of the GCC Runtime Library Exception along with this program;
+! see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+! <http://www.gnu.org/licenses/>.
+
+! Wrapper functions will be built from openacc.f90. We use a separate file
+! here, because for using ../../openacc.f90, implementations are required for
+! all the functions that it wraps, which we currently don't provide, so linking
+! would fail.
+
+module openacc_kinds
+ use iso_fortran_env, only: int32
+ implicit none
+
+ private :: int32
+ public :: acc_device_kind
+
+ integer, parameter :: acc_device_kind = int32
+
+ public :: acc_device_none, acc_device_default, acc_device_host
+ public :: acc_device_not_host, acc_device_nvidia
+
+ ! Keep in sync with include/gomp-constants.h.
+ integer (acc_device_kind), parameter :: acc_device_none = 0
+ integer (acc_device_kind), parameter :: acc_device_default = 1
+ integer (acc_device_kind), parameter :: acc_device_host = 2
+ ! integer (acc_device_kind), parameter :: acc_device_host_nonshm = 3 removed.
+ integer (acc_device_kind), parameter :: acc_device_not_host = 4
+ integer (acc_device_kind), parameter :: acc_device_nvidia = 5
+
+end module
+
+module openacc_internal
+ use openacc_kinds
+ implicit none
+
+ interface
+ function acc_on_device_h (d)
+ import
+ integer (acc_device_kind) d
+ logical acc_on_device_h
+ end function
+ end interface
+
+ interface
+ function acc_on_device_l (d) &
+ bind (C, name = "acc_on_device")
+ use iso_c_binding, only: c_int
+ integer (c_int) :: acc_on_device_l
+ integer (c_int), value :: d
+ end function
+ end interface
+end module
+
+module openacc
+ use openacc_kinds
+ use openacc_internal
+ implicit none
+
+ public :: acc_on_device
+
+ interface acc_on_device
+ procedure :: acc_on_device_h
+ end interface
+
+end module openacc
+
+function acc_on_device_h (d)
+ use openacc_internal, only: acc_on_device_l
+ use openacc_kinds
+ integer (acc_device_kind) d
+ logical acc_on_device_h
+ if (acc_on_device_l (d) .eq. 1) then
+ acc_on_device_h = .TRUE.
+ else
+ acc_on_device_h = .FALSE.
+ end if
+end function
--- /dev/null
+/* Copyright (C) 2015-2019 Free Software Foundation, Inc.
+ Contributed by Alexander Monakov <amonakov@ispras.ru>
+
+ This file is part of the GNU Offloading and Multi Processing Library
+ (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ Under Section 7 of GPL version 3, you are granted additional
+ permissions described in the GCC Runtime Library Exception, version
+ 3.1, as published by the Free Software Foundation.
+
+ You should have received a copy of the GNU General Public License and
+ a copy of the GCC Runtime Library Exception along with this program;
+ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+/* This is the NVPTX implementation of the thread pool management
+ for libgomp. This type is private to the library. */
+
+#ifndef GOMP_POOL_H
+#define GOMP_POOL_H 1
+
+#include "libgomp.h"
+
+/* Get the thread pool. */
+
+static inline struct gomp_thread_pool *
+gomp_get_thread_pool (struct gomp_thread *thr, unsigned nthreads)
+{
+ /* NVPTX is running with a fixed pool of pre-started threads. */
+ return thr->thread_pool;
+}
+
+static inline void
+gomp_release_thread_pool (struct gomp_thread_pool *pool)
+{
+ /* Do nothing. */
+}
+
+#endif /* GOMP_POOL_H */
--- /dev/null
+/* Copyright (C) 2015-2019 Free Software Foundation, Inc.
+ Contributed by Alexander Monakov <amonakov@ispras.ru>
+
+ This file is part of the GNU Offloading and Multi Processing Library
+ (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ Under Section 7 of GPL version 3, you are granted additional
+ permissions described in the GCC Runtime Library Exception, version
+ 3.1, as published by the Free Software Foundation.
+
+ You should have received a copy of the GNU General Public License and
+ a copy of the GCC Runtime Library Exception along with this program;
+ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+/* This file contains system specific routines related to counting
+ online processors and dynamic load balancing. */
+
+#include "libgomp.h"
+
+unsigned
+gomp_dynamic_max_threads (void)
+{
+ return gomp_icv (false)->nthreads_var;
+}
+
+int
+omp_get_num_procs (void)
+{
+ return gomp_icv (false)->nthreads_var;
+}
--- /dev/null
+/* Copyright (C) 2015-2019 Free Software Foundation, Inc.
+ Contributed by Alexander Monakov <amonakov@ispras.ru>
+
+ This file is part of the GNU Offloading and Multi Processing Library
+ (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ Under Section 7 of GPL version 3, you are granted additional
+ permissions described in the GCC Runtime Library Exception, version
+ 3.1, as published by the Free Software Foundation.
+
+ You should have received a copy of the GNU General Public License and
+ a copy of the GCC Runtime Library Exception along with this program;
+ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+/* This is an NVPTX specific implementation of a mutex synchronization
+ mechanism for libgomp. This type is private to the library. This
+ implementation uses atomic instructions and busy waiting.
+
+ A ptrlock has four states:
+ 0/NULL Initial
+ 1 Owned by me, I get to write a pointer to ptrlock.
+ 2 Some thread is waiting on the ptrlock.
+ >2 Ptrlock contains a valid pointer.
+ It is not valid to gain the ptrlock and then write a NULL to it. */
+
+#ifndef GOMP_PTRLOCK_H
+#define GOMP_PTRLOCK_H 1
+
+typedef void *gomp_ptrlock_t;
+
+static inline void gomp_ptrlock_init (gomp_ptrlock_t *ptrlock, void *ptr)
+{
+ *ptrlock = ptr;
+}
+
+static inline void *gomp_ptrlock_get (gomp_ptrlock_t *ptrlock)
+{
+ uintptr_t v = (uintptr_t) __atomic_load_n (ptrlock, MEMMODEL_ACQUIRE);
+ if (v > 2)
+ return (void *) v;
+
+ if (v == 0
+ && __atomic_compare_exchange_n (ptrlock, &v, 1, false,
+ MEMMODEL_ACQUIRE, MEMMODEL_ACQUIRE))
+ return NULL;
+
+ while (v == 1)
+ v = (uintptr_t) __atomic_load_n (ptrlock, MEMMODEL_ACQUIRE);
+
+ return (void *) v;
+}
+
+static inline void gomp_ptrlock_set (gomp_ptrlock_t *ptrlock, void *ptr)
+{
+ __atomic_store_n (ptrlock, ptr, MEMMODEL_RELEASE);
+}
+
+static inline void gomp_ptrlock_destroy (gomp_ptrlock_t *ptrlock)
+{
+}
+
+#endif /* GOMP_PTRLOCK_H */
--- /dev/null
+/* Copyright (C) 2015-2019 Free Software Foundation, Inc.
+ Contributed by Alexander Monakov <amonakov@ispras.ru>
+
+ This file is part of the GNU Offloading and Multi Processing Library
+ (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ Under Section 7 of GPL version 3, you are granted additional
+ permissions described in the GCC Runtime Library Exception, version
+ 3.1, as published by the Free Software Foundation.
+
+ You should have received a copy of the GNU General Public License and
+ a copy of the GCC Runtime Library Exception along with this program;
+ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+/* This is an NVPTX specific implementation of a semaphore synchronization
+ mechanism for libgomp. This type is private to the library. This
+ semaphore implementation uses atomic instructions and busy waiting. */
+
+#ifndef GOMP_SEM_H
+#define GOMP_SEM_H 1
+
+typedef int gomp_sem_t;
+
+static inline void
+gomp_sem_init (gomp_sem_t *sem, int value)
+{
+ *sem = value;
+}
+
+static inline void
+gomp_sem_destroy (gomp_sem_t *sem)
+{
+}
+
+static inline void
+gomp_sem_wait (gomp_sem_t *sem)
+{
+ int count = __atomic_load_n (sem, MEMMODEL_ACQUIRE);
+ for (;;)
+ {
+ while (count == 0)
+ count = __atomic_load_n (sem, MEMMODEL_ACQUIRE);
+ if (__atomic_compare_exchange_n (sem, &count, count - 1, false,
+ MEMMODEL_ACQUIRE, MEMMODEL_RELAXED))
+ return;
+ }
+}
+
+static inline void
+gomp_sem_post (gomp_sem_t *sem)
+{
+ (void) __atomic_add_fetch (sem, 1, MEMMODEL_RELEASE);
+}
+#endif /* GOMP_SEM_H */
--- /dev/null
+/* Copyright (C) 2017-2019 Free Software Foundation, Inc.
+ Contributed by Jakub Jelinek <jakub@redhat.com>
+
+ This file is part of the GNU Offloading and Multi Processing Library
+ (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ Under Section 7 of GPL version 3, you are granted additional
+ permissions described in the GCC Runtime Library Exception, version
+ 3.1, as published by the Free Software Foundation.
+
+ You should have received a copy of the GNU General Public License and
+ a copy of the GCC Runtime Library Exception along with this program;
+ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+/* Not really applicable to NVPTX. */
+#define GOMP_DEFAULT_STACKSIZE 0
+++ /dev/null
-/* Copyright (C) 2016-2019 Free Software Foundation, Inc.
- Contributed by Alexander Monakov <amonakov@ispras.ru>.
-
- This file is part of the GNU Offloading and Multi Processing Library
- (libgomp).
-
- Libgomp is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- Under Section 7 of GPL version 3, you are granted additional
- permissions described in the GCC Runtime Library Exception, version
- 3.1, as published by the Free Software Foundation.
-
- You should have received a copy of the GNU General Public License and
- a copy of the GCC Runtime Library Exception along with this program;
- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
- <http://www.gnu.org/licenses/>. */
-
-/* This is a NVPTX specific implementation of the public OpenMP locking
- primitives. */
-
-/* Reuse the generic implementation in terms of gomp_mutex_t. */
-#include "../../lock.c"
-
-ialias (omp_init_lock)
-ialias (omp_init_nest_lock)
-ialias (omp_destroy_lock)
-ialias (omp_destroy_nest_lock)
-ialias (omp_set_lock)
-ialias (omp_set_nest_lock)
-ialias (omp_unset_lock)
-ialias (omp_unset_nest_lock)
-ialias (omp_test_lock)
-ialias (omp_test_nest_lock)
+++ /dev/null
-/* Copyright (C) 2015-2019 Free Software Foundation, Inc.
- Contributed by Alexander Monakov <amonakov@ispras.ru>
-
- This file is part of the GNU Offloading and Multi Processing Library
- (libgomp).
-
- Libgomp is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- Under Section 7 of GPL version 3, you are granted additional
- permissions described in the GCC Runtime Library Exception, version
- 3.1, as published by the Free Software Foundation.
-
- You should have received a copy of the GNU General Public License and
- a copy of the GCC Runtime Library Exception along with this program;
- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
- <http://www.gnu.org/licenses/>. */
-
-/* This is an NVPTX specific implementation of a mutex synchronization
- mechanism for libgomp. This type is private to the library. This
- implementation uses atomic instructions and busy waiting. */
-
-#ifndef GOMP_MUTEX_H
-#define GOMP_MUTEX_H 1
-
-typedef int gomp_mutex_t;
-
-#define GOMP_MUTEX_INIT_0 1
-
-static inline void
-gomp_mutex_init (gomp_mutex_t *mutex)
-{
- *mutex = 0;
-}
-
-static inline void
-gomp_mutex_destroy (gomp_mutex_t *mutex)
-{
-}
-
-static inline void
-gomp_mutex_lock (gomp_mutex_t *mutex)
-{
- while (__sync_lock_test_and_set (mutex, 1))
- /* spin */ ;
-}
-
-static inline void
-gomp_mutex_unlock (gomp_mutex_t *mutex)
-{
- __sync_lock_release (mutex);
-}
-#endif /* GOMP_MUTEX_H */
+++ /dev/null
-/* OpenACC Runtime initialization routines
-
- Copyright (C) 2014-2019 Free Software Foundation, Inc.
-
- Contributed by Mentor Embedded.
-
- This file is part of the GNU Offloading and Multi Processing Library
- (libgomp).
-
- Libgomp is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- Under Section 7 of GPL version 3, you are granted additional
- permissions described in the GCC Runtime Library Exception, version
- 3.1, as published by the Free Software Foundation.
-
- You should have received a copy of the GNU General Public License and
- a copy of the GCC Runtime Library Exception along with this program;
- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#include "openacc.h"
-
-/* For -O and higher, the compiler always attempts to expand acc_on_device, but
- if the user disables the builtin, or calls it via a pointer, we'll need this
- version.
-
- Compile this with optimization, so that the compiler expands
- this, rather than generating infinitely recursive code. */
-
-int __attribute__ ((__optimize__ ("O2")))
-acc_on_device (acc_device_t dev)
-{
- return __builtin_acc_on_device (dev);
-}
+++ /dev/null
-/* This header is used during the build process to find the size and
- alignment of the public OpenMP locks, so that we can export data
- structures without polluting the namespace.
-
- When using the Linux futex primitive, non-recursive locks require
- one int. Recursive locks require we identify the owning task
- and so require in addition one int and a pointer. */
-
-typedef int omp_lock_t;
-typedef struct { int lock, count; void *owner; } omp_nest_lock_t;
-typedef int omp_lock_25_t;
-typedef struct { int owner, count; } omp_nest_lock_25_t;
+++ /dev/null
-! OpenACC Runtime Library Definitions.
-
-! Copyright (C) 2014-2019 Free Software Foundation, Inc.
-
-! Contributed by Tobias Burnus <burnus@net-b.de>
-! and Mentor Embedded.
-
-! This file is part of the GNU Offloading and Multi Processing Library
-! (libgomp).
-
-! Libgomp is free software; you can redistribute it and/or modify it
-! under the terms of the GNU General Public License as published by
-! the Free Software Foundation; either version 3, or (at your option)
-! any later version.
-
-! Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
-! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-! FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-! more details.
-
-! Under Section 7 of GPL version 3, you are granted additional
-! permissions described in the GCC Runtime Library Exception, version
-! 3.1, as published by the Free Software Foundation.
-
-! You should have received a copy of the GNU General Public License and
-! a copy of the GCC Runtime Library Exception along with this program;
-! see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-! <http://www.gnu.org/licenses/>.
-
-! Wrapper functions will be built from openacc.f90. We use a separate file
-! here, because for using ../../openacc.f90, implementations are required for
-! all the functions that it wraps, which we currently don't provide, so linking
-! would fail.
-
-module openacc_kinds
- use iso_fortran_env, only: int32
- implicit none
-
- private :: int32
- public :: acc_device_kind
-
- integer, parameter :: acc_device_kind = int32
-
- public :: acc_device_none, acc_device_default, acc_device_host
- public :: acc_device_not_host, acc_device_nvidia
-
- ! Keep in sync with include/gomp-constants.h.
- integer (acc_device_kind), parameter :: acc_device_none = 0
- integer (acc_device_kind), parameter :: acc_device_default = 1
- integer (acc_device_kind), parameter :: acc_device_host = 2
- ! integer (acc_device_kind), parameter :: acc_device_host_nonshm = 3 removed.
- integer (acc_device_kind), parameter :: acc_device_not_host = 4
- integer (acc_device_kind), parameter :: acc_device_nvidia = 5
-
-end module
-
-module openacc_internal
- use openacc_kinds
- implicit none
-
- interface
- function acc_on_device_h (d)
- import
- integer (acc_device_kind) d
- logical acc_on_device_h
- end function
- end interface
-
- interface
- function acc_on_device_l (d) &
- bind (C, name = "acc_on_device")
- use iso_c_binding, only: c_int
- integer (c_int) :: acc_on_device_l
- integer (c_int), value :: d
- end function
- end interface
-end module
-
-module openacc
- use openacc_kinds
- use openacc_internal
- implicit none
-
- public :: acc_on_device
-
- interface acc_on_device
- procedure :: acc_on_device_h
- end interface
-
-end module openacc
-
-function acc_on_device_h (d)
- use openacc_internal, only: acc_on_device_l
- use openacc_kinds
- integer (acc_device_kind) d
- logical acc_on_device_h
- if (acc_on_device_l (d) .eq. 1) then
- acc_on_device_h = .TRUE.
- else
- acc_on_device_h = .FALSE.
- end if
-end function
+++ /dev/null
-/* Copyright (C) 2015-2019 Free Software Foundation, Inc.
- Contributed by Alexander Monakov <amonakov@ispras.ru>
-
- This file is part of the GNU Offloading and Multi Processing Library
- (libgomp).
-
- Libgomp is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- Under Section 7 of GPL version 3, you are granted additional
- permissions described in the GCC Runtime Library Exception, version
- 3.1, as published by the Free Software Foundation.
-
- You should have received a copy of the GNU General Public License and
- a copy of the GCC Runtime Library Exception along with this program;
- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
- <http://www.gnu.org/licenses/>. */
-
-/* This is the NVPTX implementation of the thread pool management
- for libgomp. This type is private to the library. */
-
-#ifndef GOMP_POOL_H
-#define GOMP_POOL_H 1
-
-#include "libgomp.h"
-
-/* Get the thread pool. */
-
-static inline struct gomp_thread_pool *
-gomp_get_thread_pool (struct gomp_thread *thr, unsigned nthreads)
-{
- /* NVPTX is running with a fixed pool of pre-started threads. */
- return thr->thread_pool;
-}
-
-static inline void
-gomp_release_thread_pool (struct gomp_thread_pool *pool)
-{
- /* Do nothing. */
-}
-
-#endif /* GOMP_POOL_H */
+++ /dev/null
-/* Copyright (C) 2015-2019 Free Software Foundation, Inc.
- Contributed by Alexander Monakov <amonakov@ispras.ru>
-
- This file is part of the GNU Offloading and Multi Processing Library
- (libgomp).
-
- Libgomp is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- Under Section 7 of GPL version 3, you are granted additional
- permissions described in the GCC Runtime Library Exception, version
- 3.1, as published by the Free Software Foundation.
-
- You should have received a copy of the GNU General Public License and
- a copy of the GCC Runtime Library Exception along with this program;
- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
- <http://www.gnu.org/licenses/>. */
-
-/* This file contains system specific routines related to counting
- online processors and dynamic load balancing. */
-
-#include "libgomp.h"
-
-unsigned
-gomp_dynamic_max_threads (void)
-{
- return gomp_icv (false)->nthreads_var;
-}
-
-int
-omp_get_num_procs (void)
-{
- return gomp_icv (false)->nthreads_var;
-}
+++ /dev/null
-/* Copyright (C) 2015-2019 Free Software Foundation, Inc.
- Contributed by Alexander Monakov <amonakov@ispras.ru>
-
- This file is part of the GNU Offloading and Multi Processing Library
- (libgomp).
-
- Libgomp is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- Under Section 7 of GPL version 3, you are granted additional
- permissions described in the GCC Runtime Library Exception, version
- 3.1, as published by the Free Software Foundation.
-
- You should have received a copy of the GNU General Public License and
- a copy of the GCC Runtime Library Exception along with this program;
- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
- <http://www.gnu.org/licenses/>. */
-
-/* This is an NVPTX specific implementation of a mutex synchronization
- mechanism for libgomp. This type is private to the library. This
- implementation uses atomic instructions and busy waiting.
-
- A ptrlock has four states:
- 0/NULL Initial
- 1 Owned by me, I get to write a pointer to ptrlock.
- 2 Some thread is waiting on the ptrlock.
- >2 Ptrlock contains a valid pointer.
- It is not valid to gain the ptrlock and then write a NULL to it. */
-
-#ifndef GOMP_PTRLOCK_H
-#define GOMP_PTRLOCK_H 1
-
-typedef void *gomp_ptrlock_t;
-
-static inline void gomp_ptrlock_init (gomp_ptrlock_t *ptrlock, void *ptr)
-{
- *ptrlock = ptr;
-}
-
-static inline void *gomp_ptrlock_get (gomp_ptrlock_t *ptrlock)
-{
- uintptr_t v = (uintptr_t) __atomic_load_n (ptrlock, MEMMODEL_ACQUIRE);
- if (v > 2)
- return (void *) v;
-
- if (v == 0
- && __atomic_compare_exchange_n (ptrlock, &v, 1, false,
- MEMMODEL_ACQUIRE, MEMMODEL_ACQUIRE))
- return NULL;
-
- while (v == 1)
- v = (uintptr_t) __atomic_load_n (ptrlock, MEMMODEL_ACQUIRE);
-
- return (void *) v;
-}
-
-static inline void gomp_ptrlock_set (gomp_ptrlock_t *ptrlock, void *ptr)
-{
- __atomic_store_n (ptrlock, ptr, MEMMODEL_RELEASE);
-}
-
-static inline void gomp_ptrlock_destroy (gomp_ptrlock_t *ptrlock)
-{
-}
-
-#endif /* GOMP_PTRLOCK_H */
+++ /dev/null
-/* Copyright (C) 2015-2019 Free Software Foundation, Inc.
- Contributed by Alexander Monakov <amonakov@ispras.ru>
-
- This file is part of the GNU Offloading and Multi Processing Library
- (libgomp).
-
- Libgomp is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- Under Section 7 of GPL version 3, you are granted additional
- permissions described in the GCC Runtime Library Exception, version
- 3.1, as published by the Free Software Foundation.
-
- You should have received a copy of the GNU General Public License and
- a copy of the GCC Runtime Library Exception along with this program;
- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
- <http://www.gnu.org/licenses/>. */
-
-/* This is an NVPTX specific implementation of a semaphore synchronization
- mechanism for libgomp. This type is private to the library. This
- semaphore implementation uses atomic instructions and busy waiting. */
-
-#ifndef GOMP_SEM_H
-#define GOMP_SEM_H 1
-
-typedef int gomp_sem_t;
-
-static inline void
-gomp_sem_init (gomp_sem_t *sem, int value)
-{
- *sem = value;
-}
-
-static inline void
-gomp_sem_destroy (gomp_sem_t *sem)
-{
-}
-
-static inline void
-gomp_sem_wait (gomp_sem_t *sem)
-{
- int count = __atomic_load_n (sem, MEMMODEL_ACQUIRE);
- for (;;)
- {
- while (count == 0)
- count = __atomic_load_n (sem, MEMMODEL_ACQUIRE);
- if (__atomic_compare_exchange_n (sem, &count, count - 1, false,
- MEMMODEL_ACQUIRE, MEMMODEL_RELAXED))
- return;
- }
-}
-
-static inline void
-gomp_sem_post (gomp_sem_t *sem)
-{
- (void) __atomic_add_fetch (sem, 1, MEMMODEL_RELEASE);
-}
-#endif /* GOMP_SEM_H */
+++ /dev/null
-/* Copyright (C) 2017-2019 Free Software Foundation, Inc.
- Contributed by Jakub Jelinek <jakub@redhat.com>
-
- This file is part of the GNU Offloading and Multi Processing Library
- (libgomp).
-
- Libgomp is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- Under Section 7 of GPL version 3, you are granted additional
- permissions described in the GCC Runtime Library Exception, version
- 3.1, as published by the Free Software Foundation.
-
- You should have received a copy of the GNU General Public License and
- a copy of the GCC Runtime Library Exception along with this program;
- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
- <http://www.gnu.org/licenses/>. */
-
-/* Not really applicable to NVPTX. */
-#define GOMP_DEFAULT_STACKSIZE 0
;;
nvptx*-*-*)
- config_path="nvptx"
+ config_path="nvptx accel"
;;
*-*-rtems*)