libgomp nvptx plugin: Only consider '--with-cuda-driver=[...]' when applicable

Message ID 87tu9tskmp.fsf@euler.schwinge.homeip.net
State Committed
Headers
Series libgomp nvptx plugin: Only consider '--with-cuda-driver=[...]' when applicable |

Commit Message

Thomas Schwinge May 13, 2022, 12:05 p.m. UTC
  Hi!

Another small one:

On 2022-05-12T14:39:14+0200, I wrote:
> Again, no change in behavior, just refactoring, making things more
> explicit, in preparation for other changes.

> "Refactor '-ldl' handling for libgomp proper and plugins"?

> --- a/libgomp/plugin/Makefrag.am
> +++ b/libgomp/plugin/Makefrag.am

> @@ -46,7 +48,7 @@ endif
>
>  # 'dlopen'ing the CUDA Driver library vs. linking it.
>  if PLUGIN_NVPTX_DYNAMIC
> -libgomp_plugin_nvptx_la_LIBADD += $(PLUGIN_NVPTX_LIBS)
> +libgomp_plugin_nvptx_la_LIBADD += $(DL_LIBS)
>  else
>  libgomp_plugin_nvptx_la_CPPFLAGS += -DPLUGIN_NVPTX_LINK_LIBCUDA
>  libgomp_plugin_nvptx_la_LIBADD += $(PLUGIN_NVPTX_LIBS)

This means that 'PLUGIN_NVPTX_LIBS' is no longer considered in the
'--without-cuda-driver' case.

Similarly, normally, 'PLUGIN_NVPTX_CPPFLAGS' and 'PLUGIN_NVPTX_LDFLAGS'
are either empty (especially in the '--without-cuda-driver' case), or
assigned from 'CUDA_DRIVER_CPPFLAGS' and 'CUDA_DRIVER_LDFLAGS' (in the
'--with-cuda-driver=[...]' etc. cases).

Only in the latter case, they're actually (a) meaningful and (b)
(possibly) non-empty, so I've clarified that, pushed to master branch
commit 1f89e48789d230c78ec60ff3dc9e7e2478cc3df9 "libgomp nvptx plugin:
Only consider '--with-cuda-driver=[...]' when applicable", see attached.


Grüße
 Thomas


-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
  

Patch

From 1f89e48789d230c78ec60ff3dc9e7e2478cc3df9 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Thu, 12 May 2022 17:51:43 +0200
Subject: [PATCH] libgomp nvptx plugin: Only consider
 '--with-cuda-driver=[...]' when applicable

They're not applicable in 'PLUGIN_NVPTX_DYNAMIC' configurations.

	libgomp/
	* plugin/Makefrag.am (libgomp_plugin_nvptx_la_CPPFLAGS)
	[PLUGIN_NVPTX_DYNAMIC]: Don't append '$(PLUGIN_NVPTX_CPPFLAGS)'.
	(libgomp_plugin_nvptx_la_LDFLAGS) [PLUGIN_NVPTX_DYNAMIC]: Don't
	append '$(PLUGIN_NVPTX_LDFLAGS)'.
	* Makefile.in: Regenerate.
---
 libgomp/Makefile.in        | 18 ++++++++++--------
 libgomp/plugin/Makefrag.am |  5 +++--
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/libgomp/Makefile.in b/libgomp/Makefile.in
index c47b6bd6153..2ac0397a036 100644
--- a/libgomp/Makefile.in
+++ b/libgomp/Makefile.in
@@ -122,13 +122,15 @@  target_triplet = @target@
 
 # Including the GCC-shipped 'include/cuda/cuda.h' vs. system <cuda.h>.
 @PLUGIN_NVPTX_DYNAMIC_FALSE@@PLUGIN_NVPTX_TRUE@am__append_2 = -DPLUGIN_NVPTX_INCLUDE_SYSTEM_CUDA_H \
+@PLUGIN_NVPTX_DYNAMIC_FALSE@@PLUGIN_NVPTX_TRUE@	$(PLUGIN_NVPTX_CPPFLAGS) \
 @PLUGIN_NVPTX_DYNAMIC_FALSE@@PLUGIN_NVPTX_TRUE@	-DPLUGIN_NVPTX_LINK_LIBCUDA
 
 # 'dlopen'ing the CUDA Driver library vs. linking it.
 @PLUGIN_NVPTX_DYNAMIC_TRUE@@PLUGIN_NVPTX_TRUE@am__append_3 = $(DL_LIBS)
-@PLUGIN_NVPTX_DYNAMIC_FALSE@@PLUGIN_NVPTX_TRUE@am__append_4 = $(PLUGIN_NVPTX_LIBS)
-@PLUGIN_GCN_TRUE@am__append_5 = libgomp-plugin-gcn.la
-@USE_FORTRAN_TRUE@am__append_6 = openacc.f90
+@PLUGIN_NVPTX_DYNAMIC_FALSE@@PLUGIN_NVPTX_TRUE@am__append_4 = $(PLUGIN_NVPTX_LDFLAGS)
+@PLUGIN_NVPTX_DYNAMIC_FALSE@@PLUGIN_NVPTX_TRUE@am__append_5 = $(PLUGIN_NVPTX_LIBS)
+@PLUGIN_GCN_TRUE@am__append_6 = libgomp-plugin-gcn.la
+@USE_FORTRAN_TRUE@am__append_7 = openacc.f90
 subdir = .
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
@@ -536,7 +538,7 @@  libsubincludedir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
 AM_CPPFLAGS = $(addprefix -I, $(search_path))
 AM_CFLAGS = $(XCFLAGS)
 AM_LDFLAGS = $(XLDFLAGS) $(SECTION_LDFLAGS) $(OPT_LDFLAGS)
-toolexeclib_LTLIBRARIES = libgomp.la $(am__append_1) $(am__append_5)
+toolexeclib_LTLIBRARIES = libgomp.la $(am__append_1) $(am__append_6)
 nodist_toolexeclib_HEADERS = libgomp.spec
 
 # -Wc is only a libtool option.
@@ -563,18 +565,18 @@  libgomp_la_SOURCES = alloc.c atomic.c barrier.c critical.c env.c \
 	oacc-parallel.c oacc-host.c oacc-init.c oacc-mem.c \
 	oacc-async.c oacc-plugin.c oacc-cuda.c priority_queue.c \
 	affinity-fmt.c teams.c allocator.c oacc-profiling.c \
-	oacc-target.c $(am__append_6)
+	oacc-target.c $(am__append_7)
 
 # Nvidia PTX OpenACC plugin.
 @PLUGIN_NVPTX_TRUE@libgomp_plugin_nvptx_version_info = -version-info $(libtool_VERSION)
 @PLUGIN_NVPTX_TRUE@libgomp_plugin_nvptx_la_SOURCES = plugin/plugin-nvptx.c
 @PLUGIN_NVPTX_TRUE@libgomp_plugin_nvptx_la_CPPFLAGS = $(AM_CPPFLAGS) \
-@PLUGIN_NVPTX_TRUE@	$(PLUGIN_NVPTX_CPPFLAGS) $(am__append_2)
+@PLUGIN_NVPTX_TRUE@	$(am__append_2)
 @PLUGIN_NVPTX_TRUE@libgomp_plugin_nvptx_la_LDFLAGS =  \
 @PLUGIN_NVPTX_TRUE@	$(libgomp_plugin_nvptx_version_info) \
-@PLUGIN_NVPTX_TRUE@	$(lt_host_flags) $(PLUGIN_NVPTX_LDFLAGS)
+@PLUGIN_NVPTX_TRUE@	$(lt_host_flags) $(am__append_4)
 @PLUGIN_NVPTX_TRUE@libgomp_plugin_nvptx_la_LIBADD = libgomp.la \
-@PLUGIN_NVPTX_TRUE@	$(am__append_3) $(am__append_4)
+@PLUGIN_NVPTX_TRUE@	$(am__append_3) $(am__append_5)
 @PLUGIN_NVPTX_TRUE@libgomp_plugin_nvptx_la_LIBTOOLFLAGS = --tag=disable-static
 
 # AMD GCN plugin
diff --git a/libgomp/plugin/Makefrag.am b/libgomp/plugin/Makefrag.am
index 3e453ff6fee..66c8c12c1a6 100644
--- a/libgomp/plugin/Makefrag.am
+++ b/libgomp/plugin/Makefrag.am
@@ -33,10 +33,9 @@  if PLUGIN_NVPTX
 libgomp_plugin_nvptx_version_info = -version-info $(libtool_VERSION)
 toolexeclib_LTLIBRARIES += libgomp-plugin-nvptx.la
 libgomp_plugin_nvptx_la_SOURCES = plugin/plugin-nvptx.c
-libgomp_plugin_nvptx_la_CPPFLAGS = $(AM_CPPFLAGS) $(PLUGIN_NVPTX_CPPFLAGS)
+libgomp_plugin_nvptx_la_CPPFLAGS = $(AM_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
 libgomp_plugin_nvptx_la_LIBTOOLFLAGS = --tag=disable-static
 
@@ -44,6 +43,7 @@  libgomp_plugin_nvptx_la_LIBTOOLFLAGS = --tag=disable-static
 if PLUGIN_NVPTX_DYNAMIC
 else
 libgomp_plugin_nvptx_la_CPPFLAGS += -DPLUGIN_NVPTX_INCLUDE_SYSTEM_CUDA_H
+libgomp_plugin_nvptx_la_CPPFLAGS += $(PLUGIN_NVPTX_CPPFLAGS)
 endif
 
 # 'dlopen'ing the CUDA Driver library vs. linking it.
@@ -51,6 +51,7 @@  if PLUGIN_NVPTX_DYNAMIC
 libgomp_plugin_nvptx_la_LIBADD += $(DL_LIBS)
 else
 libgomp_plugin_nvptx_la_CPPFLAGS += -DPLUGIN_NVPTX_LINK_LIBCUDA
+libgomp_plugin_nvptx_la_LDFLAGS += $(PLUGIN_NVPTX_LDFLAGS)
 libgomp_plugin_nvptx_la_LIBADD += $(PLUGIN_NVPTX_LIBS)
 endif
 endif
-- 
2.35.1