Mercurial > hg > CbC > CbC_gcc
comparison libgomp/plugin/configfrag.ac @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 84e7813d76e9 |
children |
comparison
equal
deleted
inserted
replaced
131:84e7813d76e9 | 145:1830386684a0 |
---|---|
1 # Plugins for offload execution, configure.ac fragment. -*- mode: autoconf -*- | 1 # Plugins for offload execution, configure.ac fragment. -*- mode: autoconf -*- |
2 # | 2 # |
3 # Copyright (C) 2014-2018 Free Software Foundation, Inc. | 3 # Copyright (C) 2014-2020 Free Software Foundation, Inc. |
4 # | 4 # |
5 # Contributed by Mentor Embedded. | 5 # Contributed by Mentor Embedded. |
6 # | 6 # |
7 # This file is part of the GNU Offloading and Multi Processing Library | 7 # This file is part of the GNU Offloading and Multi Processing Library |
8 # (libgomp). | 8 # (libgomp). |
24 # You should have received a copy of the GNU General Public License and | 24 # You should have received a copy of the GNU General Public License and |
25 # a copy of the GCC Runtime Library Exception along with this program; | 25 # a copy of the GCC Runtime Library Exception along with this program; |
26 # see the files COPYING3 and COPYING.RUNTIME respectively. If not, see | 26 # see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
27 # <http://www.gnu.org/licenses/>. | 27 # <http://www.gnu.org/licenses/>. |
28 | 28 |
29 offload_targets= | |
30 AC_SUBST(offload_targets) | |
31 plugin_support=yes | 29 plugin_support=yes |
32 AC_CHECK_LIB(dl, dlsym, , [plugin_support=no]) | 30 AC_CHECK_LIB(dl, dlsym, , [plugin_support=no]) |
33 if test x"$plugin_support" = xyes; then | 31 if test x"$plugin_support" = xyes; then |
34 AC_DEFINE(PLUGIN_SUPPORT, 1, | 32 AC_DEFINE(PLUGIN_SUPPORT, 1, |
35 [Define if all infrastructure, needed for plugins, is supported.]) | 33 [Define if all infrastructure, needed for plugins, is supported.]) |
137 AC_SUBST(PLUGIN_HSA) | 135 AC_SUBST(PLUGIN_HSA) |
138 AC_SUBST(PLUGIN_HSA_CPPFLAGS) | 136 AC_SUBST(PLUGIN_HSA_CPPFLAGS) |
139 AC_SUBST(PLUGIN_HSA_LDFLAGS) | 137 AC_SUBST(PLUGIN_HSA_LDFLAGS) |
140 AC_SUBST(PLUGIN_HSA_LIBS) | 138 AC_SUBST(PLUGIN_HSA_LIBS) |
141 | 139 |
142 # Get offload targets and path to install tree of offloading compiler. | 140 PLUGIN_GCN=0 |
141 PLUGIN_GCN_CPPFLAGS= | |
142 PLUGIN_GCN_LDFLAGS= | |
143 PLUGIN_GCN_LIBS= | |
144 AC_SUBST(PLUGIN_GCN) | |
145 AC_SUBST(PLUGIN_GCN_CPPFLAGS) | |
146 AC_SUBST(PLUGIN_GCN_LDFLAGS) | |
147 AC_SUBST(PLUGIN_GCN_LIBS) | |
148 | |
149 # Parse '--enable-offload-targets', figure out the corresponding libgomp | |
150 # plugins, and configure to find the corresponding offload compilers. | |
151 # 'offload_plugins' and 'offload_targets' will be populated in the same order. | |
152 offload_plugins= | |
153 offload_targets= | |
154 AC_SUBST(offload_plugins) | |
155 AC_SUBST(offload_targets) | |
143 offload_additional_options= | 156 offload_additional_options= |
144 offload_additional_lib_paths= | 157 offload_additional_lib_paths= |
145 AC_SUBST(offload_additional_options) | 158 AC_SUBST(offload_additional_options) |
146 AC_SUBST(offload_additional_lib_paths) | 159 AC_SUBST(offload_additional_lib_paths) |
147 if test x"$enable_offload_targets" != x; then | 160 if test x"$enable_offload_targets" != x; then |
148 for tgt in `echo $enable_offload_targets | sed -e 's#,# #g'`; do | 161 for tgt in `echo $enable_offload_targets | sed -e 's#,# #g'`; do |
149 tgt_dir=`echo $tgt | grep '=' | sed 's/.*=//'` | 162 tgt_dir=`echo $tgt | grep '=' | sed 's/.*=//'` |
150 tgt=`echo $tgt | sed 's/=.*//'` | 163 tgt=`echo $tgt | sed 's/=.*//'` |
151 tgt_name= | 164 tgt_plugin= |
152 case $tgt in | 165 case $tgt in |
153 *-intelmic-* | *-intelmicemul-*) | 166 *-intelmic-* | *-intelmicemul-*) |
154 tgt_name=intelmic | 167 tgt_plugin=intelmic |
155 ;; | 168 ;; |
156 nvptx*) | 169 nvptx*) |
157 tgt_name=nvptx | 170 tgt_plugin=nvptx |
158 PLUGIN_NVPTX=$tgt | 171 PLUGIN_NVPTX=$tgt |
159 if test "x$CUDA_DRIVER_LIB" != xno \ | 172 if test "x$CUDA_DRIVER_LIB" != xno \ |
160 && test "x$CUDA_DRIVER_LIB" != xno; then | 173 && test "x$CUDA_DRIVER_LIB" != xno; then |
161 PLUGIN_NVPTX_CPPFLAGS=$CUDA_DRIVER_CPPFLAGS | 174 PLUGIN_NVPTX_CPPFLAGS=$CUDA_DRIVER_CPPFLAGS |
162 PLUGIN_NVPTX_LDFLAGS=$CUDA_DRIVER_LDFLAGS | 175 PLUGIN_NVPTX_LDFLAGS=$CUDA_DRIVER_LDFLAGS |
196 ;; | 209 ;; |
197 hsa*) | 210 hsa*) |
198 case "${target}" in | 211 case "${target}" in |
199 x86_64-*-*) | 212 x86_64-*-*) |
200 case " ${CC} ${CFLAGS} " in | 213 case " ${CC} ${CFLAGS} " in |
201 *" -m32 "*) | 214 *" -m32 "*|*" -mx32 "*) |
202 PLUGIN_HSA=0 | 215 PLUGIN_HSA=0 |
203 ;; | 216 ;; |
204 *) | 217 *) |
205 tgt_name=hsa | 218 tgt_plugin=hsa |
206 PLUGIN_HSA=$tgt | 219 PLUGIN_HSA=$tgt |
207 PLUGIN_HSA_CPPFLAGS=$HSA_RUNTIME_CPPFLAGS | 220 PLUGIN_HSA_CPPFLAGS=$HSA_RUNTIME_CPPFLAGS |
208 PLUGIN_HSA_LDFLAGS="$HSA_RUNTIME_LDFLAGS" | 221 PLUGIN_HSA_LDFLAGS="$HSA_RUNTIME_LDFLAGS" |
209 PLUGIN_HSA_LIBS="-ldl" | 222 PLUGIN_HSA_LIBS="-ldl" |
210 | 223 |
218 PLUGIN_HSA=1 | 231 PLUGIN_HSA=1 |
219 CPPFLAGS=$PLUGIN_HSA_save_CPPFLAGS | 232 CPPFLAGS=$PLUGIN_HSA_save_CPPFLAGS |
220 LDFLAGS=$PLUGIN_HSA_save_LDFLAGS | 233 LDFLAGS=$PLUGIN_HSA_save_LDFLAGS |
221 LIBS=$PLUGIN_HSA_save_LIBS | 234 LIBS=$PLUGIN_HSA_save_LIBS |
222 case $PLUGIN_HSA in | 235 case $PLUGIN_HSA in |
223 hsa*) | 236 hsa*) |
224 HSA_PLUGIN=0 | 237 HSA_PLUGIN=0 |
225 AC_MSG_ERROR([HSA run-time package required for HSA support]) | 238 AC_MSG_ERROR([HSA run-time package required for HSA support]) |
226 ;; | 239 ;; |
227 esac | 240 esac |
228 ;; | 241 ;; |
231 *-*-*) | 244 *-*-*) |
232 PLUGIN_HSA=0 | 245 PLUGIN_HSA=0 |
233 ;; | 246 ;; |
234 esac | 247 esac |
235 ;; | 248 ;; |
249 | |
250 amdgcn*) | |
251 case "${target}" in | |
252 x86_64-*-*) | |
253 case " ${CC} ${CFLAGS} " in | |
254 *" -m32 "*|*" -mx32 "*) | |
255 PLUGIN_GCN=0 | |
256 ;; | |
257 *) | |
258 tgt_plugin=gcn | |
259 PLUGIN_GCN=$tgt | |
260 PLUGIN_GCN_CPPFLAGS=$HSA_RUNTIME_CPPFLAGS | |
261 PLUGIN_GCN_LDFLAGS="$HSA_RUNTIME_LDFLAGS" | |
262 PLUGIN_GCN_LIBS="-ldl" | |
263 PLUGIN_GCN=1 | |
264 ;; | |
265 esac | |
266 ;; | |
267 *-*-*) | |
268 PLUGIN_GCN=0 | |
269 ;; | |
270 esac | |
271 ;; | |
236 *) | 272 *) |
237 AC_MSG_ERROR([unknown offload target specified]) | 273 AC_MSG_ERROR([unknown offload target specified]) |
238 ;; | 274 ;; |
239 esac | 275 esac |
240 if test x"$tgt_name" = x; then | 276 if test x"$tgt_plugin" = x; then |
241 # Don't configure libgomp for this offloading target if we don't build | 277 # Not configuring libgomp for this offload target if we're not building |
242 # the corresponding plugin. | 278 # the corresponding offload plugin. |
243 continue | 279 continue |
244 elif test x"$offload_targets" = x; then | 280 elif test x"$offload_plugins" = x; then |
245 offload_targets=$tgt_name | 281 offload_plugins=$tgt_plugin |
282 offload_targets=$tgt | |
246 else | 283 else |
247 offload_targets=$offload_targets,$tgt_name | 284 offload_plugins=$offload_plugins,$tgt_plugin |
285 offload_targets=$offload_targets,$tgt | |
248 fi | 286 fi |
249 if test "$tgt_name" = hsa; then | 287 # Configure additional search paths. |
288 if test "$tgt_plugin" = hsa; then | |
250 # Offloading compilation is all handled by the target compiler. | 289 # Offloading compilation is all handled by the target compiler. |
251 : | 290 : |
252 elif test x"$tgt_dir" != x; then | 291 elif test x"$tgt_dir" != x; then |
253 offload_additional_options="$offload_additional_options -B$tgt_dir/libexec/gcc/\$(target_alias)/\$(gcc_version) -B$tgt_dir/bin" | 292 offload_additional_options="$offload_additional_options -B$tgt_dir/libexec/gcc/\$(target_alias)/\$(gcc_version) -B$tgt_dir/bin" |
254 offload_additional_lib_paths="$offload_additional_lib_paths:$tgt_dir/lib64:$tgt_dir/lib:$tgt_dir/lib32" | 293 offload_additional_lib_paths="$offload_additional_lib_paths:$tgt_dir/lib64:$tgt_dir/lib:$tgt_dir/lib32" |
256 offload_additional_options="$offload_additional_options -B\$(libexecdir)/gcc/\$(target_alias)/\$(gcc_version) -B\$(bindir)" | 295 offload_additional_options="$offload_additional_options -B\$(libexecdir)/gcc/\$(target_alias)/\$(gcc_version) -B\$(bindir)" |
257 offload_additional_lib_paths="$offload_additional_lib_paths:$toolexeclibdir" | 296 offload_additional_lib_paths="$offload_additional_lib_paths:$toolexeclibdir" |
258 fi | 297 fi |
259 done | 298 done |
260 fi | 299 fi |
261 AC_DEFINE_UNQUOTED(OFFLOAD_TARGETS, "$offload_targets", | 300 AC_DEFINE_UNQUOTED(OFFLOAD_PLUGINS, "$offload_plugins", |
262 [Define to offload targets, separated by commas.]) | 301 [Define to offload plugins, separated by commas.]) |
263 AM_CONDITIONAL([PLUGIN_NVPTX], [test $PLUGIN_NVPTX = 1]) | 302 AM_CONDITIONAL([PLUGIN_NVPTX], [test $PLUGIN_NVPTX = 1]) |
264 AC_DEFINE_UNQUOTED([PLUGIN_NVPTX], [$PLUGIN_NVPTX], | 303 AC_DEFINE_UNQUOTED([PLUGIN_NVPTX], [$PLUGIN_NVPTX], |
265 [Define to 1 if the NVIDIA plugin is built, 0 if not.]) | 304 [Define to 1 if the NVIDIA plugin is built, 0 if not.]) |
266 AC_DEFINE_UNQUOTED([PLUGIN_NVPTX_DYNAMIC], [$PLUGIN_NVPTX_DYNAMIC], | 305 AC_DEFINE_UNQUOTED([PLUGIN_NVPTX_DYNAMIC], [$PLUGIN_NVPTX_DYNAMIC], |
267 [Define to 1 if the NVIDIA plugin should dlopen libcuda.so.1, 0 if it should be linked against it.]) | 306 [Define to 1 if the NVIDIA plugin should dlopen libcuda.so.1, 0 if it should be linked against it.]) |
268 AM_CONDITIONAL([PLUGIN_HSA], [test $PLUGIN_HSA = 1]) | 307 AM_CONDITIONAL([PLUGIN_HSA], [test $PLUGIN_HSA = 1]) |
269 AC_DEFINE_UNQUOTED([PLUGIN_HSA], [$PLUGIN_HSA], | 308 AC_DEFINE_UNQUOTED([PLUGIN_HSA], [$PLUGIN_HSA], |
270 [Define to 1 if the HSA plugin is built, 0 if not.]) | 309 [Define to 1 if the HSA plugin is built, 0 if not.]) |
310 AM_CONDITIONAL([PLUGIN_GCN], [test $PLUGIN_GCN = 1]) | |
311 AC_DEFINE_UNQUOTED([PLUGIN_GCN], [$PLUGIN_GCN], | |
312 [Define to 1 if the GCN plugin is built, 0 if not.]) | |
271 | 313 |
272 if test "$HSA_RUNTIME_LIB" != ""; then | 314 if test "$HSA_RUNTIME_LIB" != ""; then |
273 HSA_RUNTIME_LIB="$HSA_RUNTIME_LIB/" | 315 HSA_RUNTIME_LIB="$HSA_RUNTIME_LIB/" |
274 fi | 316 fi |
275 | 317 |