This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 4/4] OpenMP 4.0 offloading to Intel MIC: non-fallback testing


Hi!

On Thu, 30 Oct 2014 14:40:01 +0300, Ilya Verbin <iverbin@gmail.com> wrote:
> This patch allows to run non-fallback 'make check-target-libgomp'.  It passes to
> the host compiler additional -B options with the paths to the offload compilers,
> since non-installed host compiler doesn't know where to find mkoffload tools.
> Also in case of intelmic offload targets it appends paths to liboffloadmic lib.

> --- a/libgomp/testsuite/lib/libgomp.exp
> +++ b/libgomp/testsuite/lib/libgomp.exp

> @@ -107,6 +110,20 @@ proc libgomp_init { args } {
>      # Compute what needs to be put into LD_LIBRARY_PATH
>      set always_ld_library_path ".:${blddir}/.libs"
>  
> +    # Add liboffloadmic build directory in LD_LIBRARY_PATH to support
> +    # non-fallback testing for Intel MIC targets
> +    if { [string match "*-intelmic-*" $offload_targets]
> +	|| [string match "*-intelmicemul-*" $offload_targets] } {
> +	append always_ld_library_path ":${blddir}/../liboffloadmic/.libs"
> +	append always_ld_library_path ":${blddir}/../liboffloadmic/plugin/.libs"
> +	# libstdc++ is required by liboffloadmic
> +	append always_ld_library_path ":${blddir}/../libstdc++-v3/src/.libs"
> +    }
> +
> +    if { $offload_additional_lib_paths != ""} {
> +	append always_ld_library_path "${offload_additional_lib_paths}"
> +    }

Hmm, looking at this again.  Suddenly/unexpectedly (after a long-overdue
system reboot, software upgrades, etc.), the
libgomp.oacc-c/../libgomp.oacc-c-c++-common/context-1.c execution test
(on gomp-4_0-branch) regressed from PASS to FAIL, with the very first
cublasCreate call not returning the exptected CUBLAS_STATUS_SUCCESS.
While I could never figure out what exactly is going wrong in/with
libcublas, I did figure out that the problem comes to existence in GCC
configurations with Intel MIC offloading enabled, where the above stanza
is active.  Remember that offload_additional_lib_paths specifies paths to
the Intel MIC offloading libraries' builds
(x86_64-intelmicemul-linux-gnu), and these are prepended by paths to
satisfy liboffloadmic's dependencies: libstdc++ (x86_64-pc-linux-gnu).
But: libstdc++ depends on libgcc_s, whose path is not specified here, but
a path to libgcc_s is specified with offload_additional_lib_paths, but
that's the variant for Intel MIC offloading
(x86_64-intelmicemul-linux-gnu), not the regular target library
(x86_64-pc-linux-gnu).  And, for some reason this caused breakage in/with
libcublas.

All in all, this whole setup still seems fragile to me (I
wondered/worried about this before): as the x86_64-pc-linux-gnu (target)
and x86_64-intelmicemul-linux-gnu (Intel MIC offloading) libraries are
ABI compatible, ld.so is free to intermix these...  For certain libraries
it may not matter, but certainly the libgomp builds for
x86_64-pc-linux-gnu vs. x86_64-intelmicemul-linux-gnu will have different
semantics for certain functions, for example.

In r234170, I applied the following fix as obvious, but this may still
need further attention; compare the stanza cited above to the potentially
more compilated dependencies of libstdc++.  See
libgomp/testsuite/libgomp.c++/c++.exp, and
libstdc++-v3/testsuite/lib/libstdc++.exp:libstdc++_init mentions that in
certain configurations, also libvtv may be a dependency of libstdc++, for
example.

Also, is the stanza cited above doing the right thing for GCC multilib
configurations?

commit 16603d6b5b9073537c00b706b854f0a87101b991
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Sun Mar 13 19:08:21 2016 +0000

    libgcc_s is required by libstdc++
    
    	libgomp/
    	* testsuite/lib/libgomp.exp (libgomp_init): Potentially append to
    	always_ld_library_path the path to libgcc_s.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@234170 138bc75d-0d04-0410-961f-82ee72b054a4
---
 libgomp/ChangeLog                 | 5 +++++
 libgomp/testsuite/lib/libgomp.exp | 2 ++
 2 files changed, 7 insertions(+)

diff --git libgomp/ChangeLog libgomp/ChangeLog
index 7293e69..5a91504 100644
--- libgomp/ChangeLog
+++ libgomp/ChangeLog
@@ -1,3 +1,8 @@
+2016-03-13  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* testsuite/lib/libgomp.exp (libgomp_init): Potentially append to
+	always_ld_library_path the path to libgcc_s.
+
 2016-03-10  Cesar Philippidis  <cesar@codesourcery.com>
 
 	PR testsuite/70009
diff --git libgomp/testsuite/lib/libgomp.exp libgomp/testsuite/lib/libgomp.exp
index 0d5b6d4..1cb4991 100644
--- libgomp/testsuite/lib/libgomp.exp
+++ libgomp/testsuite/lib/libgomp.exp
@@ -142,6 +142,8 @@ proc libgomp_init { args } {
 	append always_ld_library_path ":${blddir}/../liboffloadmic/plugin/.libs"
 	# libstdc++ is required by liboffloadmic
 	append always_ld_library_path ":${blddir}/../libstdc++-v3/src/.libs"
+	# libgcc_s is required by libstdc++
+	append always_ld_library_path ":${blddir}/../libgcc"
     }
 
     global offload_additional_lib_paths


GrÃÃe
 Thomas

Attachment: signature.asc
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]