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, 18 Dec 2014 18:41:18 +0100, Ilya Verbin <iverbin@gmail.com> wrote:
> 2014-12-18 16:27 GMT+01:00 Thomas Schwinge <thomas@codesourcery.com>:
> > 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/configure.ac
> >> +++ b/libgomp/configure.ac
> >> @@ -280,9 +280,13 @@ else
> >>    multilib_arg=
> >>  fi
> >>
> >> +# Get accel target and path to install tree of accel compiler
> >> +offload_additional_options=
> >> +offload_additional_lib_paths=
> >>  offload_targets=
> >>  if test x"$enable_offload_targets" != x; then
> >>    for tgt in `echo $enable_offload_targets | sed -e 's#,# #g'`; do
> >> +    tgt_dir=`echo $tgt | grep '=' | sed 's/.*=//'`
> >>      tgt=`echo $tgt | sed 's/=.*//'`
> >>      case $tgt in
> >>        *-intelmic-* | *-intelmicemul-*)
> >> @@ -295,10 +299,20 @@ if test x"$enable_offload_targets" != x; then
> >>      else
> >>        offload_targets=$offload_targets,$tgt_name
> >>      fi
> >> +    if test x"$tgt_dir" != x; then
> >> +      offload_additional_options="$offload_additional_options -B$tgt_dir/libexec/gcc/\$(target_alias)/\$(gcc_version) -B$tgt_dir/bin"
> >> +      offload_additional_lib_paths="$offload_additional_lib_paths:$tgt_dir/lib64:$tgt_dir/lib"
> >> +    else
> >> +      offload_additional_options="$offload_additional_options -B\$(libexecdir)/gcc/\$(target_alias)/\$(gcc_version) -B\$(bindir)"
> >> +      offload_additional_lib_paths="$offload_additional_lib_paths:$toolexeclibdir"
> >> +    fi
> >>    done
> >>  fi
> >
> > Hmm, maybe I'm seeing a problem where there isn't one, but in case I'm
> > not: how will this work if there is more than one offloading compiler
> > configured?  Won't you get conflicting -B paths added to
> > offload_additional_options in this case?

> In this place I don't see any problems, at least for the case with
> installed offloading compilers.
> One -B allows to find mkoffload in lto-wrapper:compile_offload_image.
> This function tries to open all paths + '/accel/target_name/mkoffload'
> suffix. So, there should be no conflicts.
> Another -B allows mkoffload to find target driver. It tries to open
> 'host_name-accel-target_name-gcc', so, there also should be no
> conflicts.

Aha, thanks for the explanation, and yes, that seems all good.


What is the reason for adding paths if $tgt_dir is empty?  (I mean, if
properly installed and $tgt_dir empty, this should just work, because
that's what a user will be doing, so why does the libgomp testsuite have
to do differently?)  These paths will (basically) point to GCC's
configured --prefix=[...] -- which may not actually match where the
installed offloading compilers are to be found, for example, in the
common case that DESTDIR is used with make install.  And, isn't it that
GCC by default will already be looking into "$prefix" installation
directories, or is this solving an actual problem for you?  If not, is it
then OK to remove the cases for empty $tgt_dir?


> However, I still did not tried to enable 'make check' with
> non-installed offloading compilers.

I'm working of that (with low priority, though).

In my understanding, we'd like to support the modes that either all
compilers are installed (which is what a user will be using), or all are
tested from their build trees.  Or, do we also have to support the mode
that only the offloading compilers are installed, but the target
(offloading host) compiler is not?  (Doesn't make much sense to me.)


Here is a patch to correctly match intelmic in $offload_targets; OK to
commit, I assume?  I suppose I'm the first one to ever do build-tree
testing?  (Jakub?)

--- libgomp/testsuite/lib/libgomp.exp
+++ libgomp/testsuite/lib/libgomp.exp
@@ -115,8 +115,7 @@ proc libgomp_init { args } {
 
     # 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] } {
+    if { [string match "*,intelmic,*" ",$offload_targets,"] } {
 	append always_ld_library_path ":${blddir}/../liboffloadmic/.libs"
 	append always_ld_library_path ":${blddir}/../liboffloadmic/plugin/.libs"
 	# libstdc++ is required by liboffloadmic


Such things also need to be guarded to be done for build-tree testing
only; I'll address this later on, where missing.


Here is a patch to fix 32-bit x86 Intel MIC offloading; OK to commit, I
assume?

    [...]
    spawn [...]/build-gcc/gcc/xgcc -B[...]/build-gcc/gcc/ [...]/source-gcc/libgomp/testsuite/libgomp.c/examples-4/e.50.1.c -B[...]/build-gcc/x86_64-unknown-linux-gnu/32/libgomp/ -B[...]/build-gcc/x86_64-unknown-linux-gnu/32/libgomp/.libs -I[...]/build-gcc/x86_64-unknown-linux-gnu/32/libgomp -I[...]/source-gcc/libgomp/testsuite/.. -march=i486 -fmessage-length=0 -fno-diagnostics-show-caret -fdiagnostics-color=never -B[...]/install/offload-x86_64-intelmicemul-linux-gnu/libexec/gcc/x86_64-unknown-linux-gnu/5.0.0 -B[...]/install/offload-x86_64-intelmicemul-linux-gnu/bin -fopenmp -O2 -L[...]/build-gcc/x86_64-unknown-linux-gnu/32/libgomp/.libs -lm -m32 -o ./e.50.1.exe
    PASS: libgomp.c/examples-4/e.50.1.c (test for excess errors)
    Setting LD_LIBRARY_PATH to .:[...]/build-gcc/x86_64-unknown-linux-gnu/32/libgomp/.libs:[...]/build-gcc/x86_64-unknown-linux-gnu/32/libgomp/../liboffloadmic/.libs:[...]/build-gcc/x86_64-unknown-linux-gnu/32/libgomp/../liboffloadmic/plugin/.libs:[...]/build-gcc/x86_64-unknown-linux-gnu/32/libgomp/../libstdc++-v3/src/.libs:[...]/install/offload-x86_64-intelmicemul-linux-gnu/lib64:[...]/install/offload-x86_64-intelmicemul-linux-gnu/lib:[...]/build-gcc/gcc:[...]/build-gcc/gcc/32:.:[...]/build-gcc/x86_64-unknown-linux-gnu/32/libgomp/.libs:[...]/build-gcc/x86_64-unknown-linux-gnu/32/libgomp/../liboffloadmic/.libs:[...]/build-gcc/x86_64-unknown-linux-gnu/32/libgomp/../liboffloadmic/plugin/.libs:[...]/build-gcc/x86_64-unknown-linux-gnu/32/libgomp/../libstdc++-v3/src/.libs:[...]/install/offload-x86_64-intelmicemul-linux-gnu/lib64:[...]/install/offload-x86_64-intelmicemul-linux-gnu/lib:[...]/build-gcc/gcc:[...]/build-gcc/gcc/32:[...]/build-gcc/x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs:[...]/build-gcc/x86_64-unknown-linux-gnu/libsanitizer/.libs:[...]/build-gcc/x86_64-unknown-linux-gnu/libvtv/.libs:[...]/build-gcc/x86_64-unknown-linux-gnu/libcilkrts/.libs:[...]/build-gcc/x86_64-unknown-linux-gnu/liboffloadmic/.libs:[...]/build-gcc/x86_64-unknown-linux-gnu/libssp/.libs:[...]/build-gcc/x86_64-unknown-linux-gnu/libgomp/.libs:[...]/build-gcc/x86_64-unknown-linux-gnu/libitm/.libs:[...]/build-gcc/x86_64-unknown-linux-gnu/libatomic/.libs:[...]/build-gcc/./gcc:[...]/build-gcc/./prev-gcc
    spawn [open ...]
    /tmp/offload_WCXKRZ/offload_target_main: error while loading shared libraries: liboffloadmic_target.so.5: wrong ELF class: ELFCLASS64
    WARNING: program timed out.
    FAIL: libgomp.c/examples-4/e.50.1.c execution test
    [...]

(It is bad that testing is running into loooong timeouts for every single
offloading test case, but I'm not addressing that with my patch.)

This is a "standard" GCC configuration: x86_64-intelmicemul-linux-gnu with
(default) multilibs enabled:

    $ find -name liboffloadmic_target.so.5
    ./install/offload-x86_64-intelmicemul-linux-gnu/lib64/liboffloadmic_target.so.5
    ./install/offload-x86_64-intelmicemul-linux-gnu/lib32/liboffloadmic_target.so.5
    ./build-gcc-offload-x86_64-intelmicemul-linux-gnu/x86_64-intelmicemul-linux-gnu/32/liboffloadmic/.libs/liboffloadmic_target.so.5
    ./build-gcc-offload-x86_64-intelmicemul-linux-gnu/x86_64-intelmicemul-linux-gnu/liboffloadmic/.libs/liboffloadmic_target.so.5

--- libgomp/configure.ac
+++ libgomp/configure.ac
@@ -304,7 +304,7 @@ if test x"$enable_offload_targets" != x; then
     fi
     if test x"$tgt_dir" != x; then
       offload_additional_options="$offload_additional_options -B$tgt_dir/libexec/gcc/\$(target_alias)/\$(gcc_version) -B$tgt_dir/bin"
-      offload_additional_lib_paths="$offload_additional_lib_paths:$tgt_dir/lib64:$tgt_dir/lib"
+      offload_additional_lib_paths="$offload_additional_lib_paths:$tgt_dir/lib64:$tgt_dir/lib:$tgt_dir/lib32"
     else
       offload_additional_options="$offload_additional_options -B\$(libexecdir)/gcc/\$(target_alias)/\$(gcc_version) -B\$(bindir)"
       offload_additional_lib_paths="$offload_additional_lib_paths:$toolexeclibdir"


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]