1/* Copyright (C) 2017-2022 Free Software Foundation, Inc.
2   Contributed by Mentor Embedded.
3
4   This file is part of the GNU Offloading and Multi Processing Library
5   (libgomp).
6
7   Libgomp is free software; you can redistribute it and/or modify it
8   under the terms of the GNU General Public License as published by
9   the Free Software Foundation; either version 3, or (at your option)
10   any later version.
11
12   Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
13   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14   FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
15   more details.
16
17   Under Section 7 of GPL version 3, you are granted additional
18   permissions described in the GCC Runtime Library Exception, version
19   3.1, as published by the Free Software Foundation.
20
21   You should have received a copy of the GNU General Public License and
22   a copy of the GCC Runtime Library Exception along with this program;
23   see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
24   <http://www.gnu.org/licenses/>.  */
25
26#include "libgomp.h"
27#include <limits.h>
28
29bool
30GOMP_teams4 (unsigned int num_teams_lower, unsigned int num_teams_upper,
31	     unsigned int thread_limit, bool first)
32{
33  if (!first)
34    return false;
35  if (thread_limit)
36    {
37      struct gomp_task_icv *icv = gomp_icv (true);
38      icv->thread_limit_var
39	= thread_limit > INT_MAX ? UINT_MAX : thread_limit;
40    }
41  unsigned int num_workgroups, workgroup_id;
42  num_workgroups = __builtin_gcn_dim_size (0);
43  workgroup_id = __builtin_gcn_dim_pos (0);
44  /* FIXME: If num_teams_lower > num_workgroups, we want to loop
45     multiple times at least for some workgroups.  */
46  (void) num_teams_lower;
47  if (!num_teams_upper || num_teams_upper >= num_workgroups)
48    num_teams_upper = num_workgroups;
49  else if (workgroup_id >= num_teams_upper)
50    return false;
51  gomp_num_teams_var = num_teams_upper - 1;
52  return true;
53}
54
55int
56omp_pause_resource (omp_pause_resource_t kind, int device_num)
57{
58  (void) kind;
59  (void) device_num;
60  return -1;
61}
62
63int
64omp_pause_resource_all (omp_pause_resource_t kind)
65{
66  (void) kind;
67  return -1;
68}
69
70ialias (omp_pause_resource)
71ialias (omp_pause_resource_all)
72
73void
74GOMP_target_ext (int device, void (*fn) (void *), size_t mapnum,
75		 void **hostaddrs, size_t *sizes, unsigned short *kinds,
76		 unsigned int flags, void **depend, void **args)
77{
78  (void) device;
79  (void) fn;
80  (void) mapnum;
81  (void) hostaddrs;
82  (void) sizes;
83  (void) kinds;
84  (void) flags;
85  (void) depend;
86  (void) args;
87  __builtin_unreachable ();
88}
89
90void
91GOMP_target_data_ext (int device, size_t mapnum, void **hostaddrs,
92		      size_t *sizes, unsigned short *kinds)
93{
94  (void) device;
95  (void) mapnum;
96  (void) hostaddrs;
97  (void) sizes;
98  (void) kinds;
99  __builtin_unreachable ();
100}
101
102void
103GOMP_target_end_data (void)
104{
105  __builtin_unreachable ();
106}
107
108void
109GOMP_target_update_ext (int device, size_t mapnum, void **hostaddrs,
110			size_t *sizes, unsigned short *kinds,
111			unsigned int flags, void **depend)
112{
113  (void) device;
114  (void) mapnum;
115  (void) hostaddrs;
116  (void) sizes;
117  (void) kinds;
118  (void) flags;
119  (void) depend;
120  __builtin_unreachable ();
121}
122
123void
124GOMP_target_enter_exit_data (int device, size_t mapnum, void **hostaddrs,
125			     size_t *sizes, unsigned short *kinds,
126			     unsigned int flags, void **depend)
127{
128  (void) device;
129  (void) mapnum;
130  (void) hostaddrs;
131  (void) sizes;
132  (void) kinds;
133  (void) flags;
134  (void) depend;
135  __builtin_unreachable ();
136}
137