diff options
author | Thomas Schwinge <thomas@codesourcery.com> | 2022-04-07 23:10:16 +0200 |
---|---|---|
committer | Thomas Schwinge <thomas@codesourcery.com> | 2022-05-12 14:14:13 +0200 |
commit | cd644ce8be2d1ba8d759ce4c00a2ded5a040b70d (patch) | |
tree | adf56f4be183630db7aa855ab51ee71c7feacc12 /libgomp/plugin | |
parent | edbd2b1caaa79d68467418a4571c3b09f9602805 (diff) | |
download | gcc-cd644ce8be2d1ba8d759ce4c00a2ded5a040b70d.zip gcc-cd644ce8be2d1ba8d759ce4c00a2ded5a040b70d.tar.gz gcc-cd644ce8be2d1ba8d759ce4c00a2ded5a040b70d.tar.bz2 |
libgomp nvptx plugin: Split 'PLUGIN_NVPTX_DYNAMIC' into 'PLUGIN_NVPTX_INCLUDE_SYSTEM_CUDA_H' and 'PLUGIN_NVPTX_LINK_LIBCUDA'
Including the GCC-shipped 'include/cuda/cuda.h' vs. system <cuda.h> and
'dlopen'ing the CUDA Driver library vs. linking it are separate concerns.
libgomp/
* plugin/Makefrag.am: Handle 'PLUGIN_NVPTX_DYNAMIC'.
* plugin/configfrag.ac (PLUGIN_NVPTX_DYNAMIC): Change
'AC_DEFINE_UNQUOTED' into 'AM_CONDITIONAL'.
* plugin/plugin-nvptx.c: Split 'PLUGIN_NVPTX_DYNAMIC' into
'PLUGIN_NVPTX_INCLUDE_SYSTEM_CUDA_H' and
'PLUGIN_NVPTX_LINK_LIBCUDA'.
* Makefile.in: Regenerate.
* config.h.in: Likewise.
* configure: Likewise.
Diffstat (limited to 'libgomp/plugin')
-rw-r--r-- | libgomp/plugin/Makefrag.am | 16 | ||||
-rw-r--r-- | libgomp/plugin/configfrag.ac | 3 | ||||
-rw-r--r-- | libgomp/plugin/plugin-nvptx.c | 4 |
3 files changed, 18 insertions, 5 deletions
diff --git a/libgomp/plugin/Makefrag.am b/libgomp/plugin/Makefrag.am index 11929d4..3eeb341 100644 --- a/libgomp/plugin/Makefrag.am +++ b/libgomp/plugin/Makefrag.am @@ -35,8 +35,22 @@ libgomp_plugin_nvptx_la_CPPFLAGS = $(AM_CPPFLAGS) $(PLUGIN_NVPTX_CPPFLAGS) libgomp_plugin_nvptx_la_LDFLAGS = $(libgomp_plugin_nvptx_version_info) \ $(lt_host_flags) libgomp_plugin_nvptx_la_LDFLAGS += $(PLUGIN_NVPTX_LDFLAGS) -libgomp_plugin_nvptx_la_LIBADD = libgomp.la $(PLUGIN_NVPTX_LIBS) +libgomp_plugin_nvptx_la_LIBADD = libgomp.la libgomp_plugin_nvptx_la_LIBTOOLFLAGS = --tag=disable-static + +# Including the GCC-shipped 'include/cuda/cuda.h' vs. system <cuda.h>. +if PLUGIN_NVPTX_DYNAMIC +else +libgomp_plugin_nvptx_la_CPPFLAGS += -DPLUGIN_NVPTX_INCLUDE_SYSTEM_CUDA_H +endif + +# 'dlopen'ing the CUDA Driver library vs. linking it. +if PLUGIN_NVPTX_DYNAMIC +libgomp_plugin_nvptx_la_LIBADD += $(PLUGIN_NVPTX_LIBS) +else +libgomp_plugin_nvptx_la_CPPFLAGS += -DPLUGIN_NVPTX_LINK_LIBCUDA +libgomp_plugin_nvptx_la_LIBADD += $(PLUGIN_NVPTX_LIBS) +endif endif if PLUGIN_GCN diff --git a/libgomp/plugin/configfrag.ac b/libgomp/plugin/configfrag.ac index 1a61db9..c162241 100644 --- a/libgomp/plugin/configfrag.ac +++ b/libgomp/plugin/configfrag.ac @@ -219,6 +219,5 @@ fi AC_DEFINE_UNQUOTED(OFFLOAD_PLUGINS, "$offload_plugins", [Define to offload plugins, separated by commas.]) AM_CONDITIONAL([PLUGIN_NVPTX], [test $PLUGIN_NVPTX = 1]) -AC_DEFINE_UNQUOTED([PLUGIN_NVPTX_DYNAMIC], [$PLUGIN_NVPTX_DYNAMIC], - [Define to 1 if the NVIDIA plugin should dlopen libcuda.so.1, 0 if it should be linked against it.]) +AM_CONDITIONAL([PLUGIN_NVPTX_DYNAMIC], [test $PLUGIN_NVPTX_DYNAMIC = 1]) AM_CONDITIONAL([PLUGIN_GCN], [test $PLUGIN_GCN = 1]) diff --git a/libgomp/plugin/plugin-nvptx.c b/libgomp/plugin/plugin-nvptx.c index b28dfca..387bcbb 100644 --- a/libgomp/plugin/plugin-nvptx.c +++ b/libgomp/plugin/plugin-nvptx.c @@ -41,7 +41,7 @@ #include "oacc-int.h" #include <pthread.h> -#if PLUGIN_NVPTX_DYNAMIC +#ifndef PLUGIN_NVPTX_INCLUDE_SYSTEM_CUDA_H # include "cuda/cuda.h" #else # include <cuda.h> @@ -85,7 +85,7 @@ CUresult cuOccupancyMaxPotentialBlockSize(int *, int *, CUfunction, #define DO_PRAGMA(x) _Pragma (#x) -#if PLUGIN_NVPTX_DYNAMIC +#ifndef PLUGIN_NVPTX_LINK_LIBCUDA # include <dlfcn.h> struct cuda_lib_s { |