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

2016-03-13 Thread Thomas Schwinge
Hi!

On Thu, 30 Oct 2014 14:40:01 +0300, Ilya Verbin  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 
Date:   Sun Mar 13 19:08:21 2016 +

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  
+
+   * testsuite/lib/libgomp.exp (libgomp_init): Potentially append to
+   always_ld_library_path the path to libgcc_s.
+
 2016-03-10  Cesar Philippidis  
 
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



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

2015-02-02 Thread Ilya Verbin
On 28 Jan 19:20, Ilya Verbin wrote:
 On 28 Jan 17:15, Jakub Jelinek wrote:
  On Wed, Jan 28, 2015 at 07:02:59PM +0300, Ilya Verbin wrote:
   + = XNEWVEC (char, len + sizeof (-B ../ DEFAULT_TARGET_MACHINE
   +/libgomp/));
   +  sprintf (optional_target_path2, -B%s/../../../ 
   DEFAULT_TARGET_MACHINE
   +   /libgomp/, current_path);
  
  This will surely overflow the buffer, won't it?  There is space just for
  ../ but you put there /../../../.
  
  I'd strongly prefer if you rewrote all these XNEWVEC or XRESIZEVEC etc.
  + sprintf cases into concat, like
optional_target_path2 = concat (-B, current_path,
/../../../ DEFAULT_TARGET_MACHINE
/libgomp/, NULL);
  and similar.  That way you avoid all such bugs.
 
 The variable 'len' contains sizeof (/../../).
 I agree that this code looks ugly :)  I'll rewrite it using concat.

Here is the patch with concat.


diff --git a/gcc/config.gcc b/gcc/config.gcc
index abd915e..0ebdbd2 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -4374,7 +4374,7 @@ fi
 case ${target} in
 i[34567]86-*-* | x86_64-*-*)
if test x$enable_as_accelerator = xyes; then
-   extra_programs=mkoffload\$(exeext)
+   extra_programs=mkoffload\$(exeext) 
accel/${target_noncanonical}/mkoffload$(exeext)
fi
;;
 esac
diff --git a/gcc/config/i386/intelmic-mkoffload.c 
b/gcc/config/i386/intelmic-mkoffload.c
index edc3f92e..bc71004 100644
--- a/gcc/config/i386/intelmic-mkoffload.c
+++ b/gcc/config/i386/intelmic-mkoffload.c
@@ -22,13 +22,13 @@
 
 #include config.h
 #include libgen.h
-#include libgomp-plugin.h
 #include system.h
 #include coretypes.h
 #include obstack.h
 #include intl.h
 #include diagnostic.h
 #include collect-utils.h
+#include intelmic-offload.h
 
 const char tool_name[] = intelmic mkoffload;
 
@@ -45,6 +45,13 @@ const char *temp_files[MAX_NUM_TEMPS];
 /* Shows if we should compile binaries for i386 instead of x86-64.  */
 bool target_ilp32 = false;
 
+/* Optional prefixes for the target compiler, which are required when target
+   compiler is not installed.  */
+char *optional_target_path1 = NULL;
+char *optional_target_path2 = NULL;
+char *optional_target_lib_path = NULL;
+
+
 /* Delete tempfiles and exit function.  */
 void
 tool_cleanup (bool from_signal ATTRIBUTE_UNUSED)
@@ -151,14 +158,17 @@ access_check (const char *name, int mode)
   return access (name, mode);
 }
 
-/* Find target compiler using a path from COLLECT_GCC or COMPILER_PATH.  */
+/* Find target compiler using a path from COLLECT_GCC, COMPILER_PATH, or a path
+   relative to ARGV0.  */
 static char *
-find_target_compiler (const char *name)
+find_target_compiler (const char *argv0)
 {
   bool found = false;
   char **paths = NULL;
   unsigned n_paths, i;
+  const char *current_path;
   const char *collect_path = dirname (ASTRDUP (getenv (COLLECT_GCC)));
+  const char *name = GCC_INSTALL_NAME;
   size_t len = strlen (collect_path) + 1 + strlen (name) + 1;
   char *target_compiler = XNEWVEC (char, len);
   sprintf (target_compiler, %s/%s, collect_path, name);
@@ -177,13 +187,32 @@ find_target_compiler (const char *name)
   if (access_check (target_compiler, X_OK) == 0)
{
  found = true;
- break;
+ goto out;
}
 }
+  XDELETEVEC (target_compiler);
+
+  /* If installed compiler wasn't found, try to find a non-installed compiler,
+ using a path relative to mkoffload.  */
+  current_path = dirname (ASTRDUP (argv0));
+  target_compiler = concat (current_path, /../../xgcc, NULL);
+  if (access_check (target_compiler, X_OK) == 0)
+{
+  optional_target_path1 = concat (-B, current_path, /../../, NULL);
+  optional_target_path2
+   = concat (-B, current_path,
+ /../../../ DEFAULT_TARGET_MACHINE /libgomp/, NULL);
+  optional_target_lib_path
+   = concat (-L, current_path,
+ /../../../ DEFAULT_TARGET_MACHINE /libgomp/.libs/, NULL);
+  found = true;
+}
 
 out:
   free_array_of_ptrs ((void **) paths, n_paths);
-  return found ? target_compiler : NULL;
+  if (!found)
+fatal_error (offload compiler %s not found, name);
+  return target_compiler;
 }
 
 static void
@@ -193,6 +222,14 @@ compile_for_target (struct obstack *argv_obstack)
 obstack_ptr_grow (argv_obstack, -m32);
   else
 obstack_ptr_grow (argv_obstack, -m64);
+
+  if (optional_target_path1)
+obstack_ptr_grow (argv_obstack, optional_target_path1);
+  if (optional_target_path2)
+obstack_ptr_grow (argv_obstack, optional_target_path2);
+  if (optional_target_lib_path)
+obstack_ptr_grow (argv_obstack, optional_target_lib_path);
+
   obstack_ptr_grow (argv_obstack, NULL);
   char **argv = XOBFINISH (argv_obstack, char **);
 
@@ -346,7 +383,7 @@ generate_host_descr_file (const char *host_compiler)
   init (void)\n
   {\n
 GOMP_offload_register 

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

2015-01-28 Thread Ilya Verbin
On 28 Jan 17:15, Jakub Jelinek wrote:
 On Wed, Jan 28, 2015 at 07:02:59PM +0300, Ilya Verbin wrote:
  +   = XNEWVEC (char, len + sizeof (-B ../ DEFAULT_TARGET_MACHINE
  +  /libgomp/));
  +  sprintf (optional_target_path2, -B%s/../../../ 
  DEFAULT_TARGET_MACHINE
  + /libgomp/, current_path);
 
 This will surely overflow the buffer, won't it?  There is space just for
 ../ but you put there /../../../.
 
 I'd strongly prefer if you rewrote all these XNEWVEC or XRESIZEVEC etc.
 + sprintf cases into concat, like
   optional_target_path2 = concat (-B, current_path,
 /../../../ DEFAULT_TARGET_MACHINE
 /libgomp/, NULL);
 and similar.  That way you avoid all such bugs.

The variable 'len' contains sizeof (/../../).
I agree that this code looks ugly :)  I'll rewrite it using concat.

  -- Ilya


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

2015-01-28 Thread Ilya Verbin
On 15 Jan 19:58, Jakub Jelinek wrote:
 On Thu, Jan 15, 2015 at 09:55:40PM +0300, Ilya Verbin wrote:
  This patch enables 'make check-target-libgomp' with noninstalled offloading
  compilers.  It creates gcc/accel/target/ directory in the build tree of 
  the
  offloading compiler, this allows lto-wrapper to find corresponding 
  mkoffload in
  case if there is more than one offloading compiler.  Is this approach ok?
  I don't like changes in config.gcc and t-intelmic, probably there is a 
  better
  way to create a link?
 
 Let's wait until Thomas hopefully checks in the OpenACC merge in order not
 to make him work even harder.
 I'll look at your patch afterwards.

I've rebased this patch.


diff --git a/gcc/config.gcc b/gcc/config.gcc
index bf67beb..c56c055 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -4371,7 +4371,7 @@ fi
 case ${target} in
 i[34567]86-*-* | x86_64-*-*)
if test x$enable_as_accelerator = xyes; then
-   extra_programs=mkoffload\$(exeext)
+   extra_programs=mkoffload\$(exeext) 
accel/${target_noncanonical}/mkoffload$(exeext)
fi
;;
 esac
diff --git a/gcc/config/i386/intelmic-mkoffload.c 
b/gcc/config/i386/intelmic-mkoffload.c
index 5d9ed33..73ca9ce 100644
--- a/gcc/config/i386/intelmic-mkoffload.c
+++ b/gcc/config/i386/intelmic-mkoffload.c
@@ -45,6 +45,13 @@ const char *temp_files[MAX_NUM_TEMPS];
 /* Shows if we should compile binaries for i386 instead of x86-64.  */
 bool target_ilp32 = false;
 
+/* Optional prefixes for the target compiler, which are required when target
+   compiler is not installed.  */
+char *optional_target_path1 = NULL;
+char *optional_target_path2 = NULL;
+char *optional_target_lib_path = NULL;
+
+
 /* Delete tempfiles and exit function.  */
 void
 tool_cleanup (bool from_signal ATTRIBUTE_UNUSED)
@@ -151,14 +158,18 @@ access_check (const char *name, int mode)
   return access (name, mode);
 }
 
-/* Find target compiler using a path from COLLECT_GCC or COMPILER_PATH.  */
+/* Find target compiler using a path from COLLECT_GCC, COMPILER_PATH, or a path
+   relative to ARGV0.  */
 static char *
-find_target_compiler (const char *name)
+find_target_compiler (const char *argv0)
 {
   bool found = false;
   char **paths = NULL;
   unsigned n_paths, i;
+  const char *current_path;
   const char *collect_path = dirname (ASTRDUP (getenv (COLLECT_GCC)));
+  const char *name
+= DEFAULT_REAL_TARGET_MACHINE -accel- DEFAULT_TARGET_MACHINE -gcc;
   size_t len = strlen (collect_path) + 1 + strlen (name) + 1;
   char *target_compiler = XNEWVEC (char, len);
   sprintf (target_compiler, %s/%s, collect_path, name);
@@ -177,13 +188,38 @@ find_target_compiler (const char *name)
   if (access_check (target_compiler, X_OK) == 0)
{
  found = true;
- break;
+ goto out;
}
 }
 
+  /* If installed compiler wasn't found, try to find a non-installed compiler,
+ using a path relative to mkoffload.  */
+  current_path = dirname (ASTRDUP (argv0));
+  len = strlen (current_path) + sizeof (/../../) - 1;
+  target_compiler = XRESIZEVEC (char, target_compiler, len + sizeof (xgcc));
+  sprintf (target_compiler, %s/../../xgcc, current_path);
+  if (access_check (target_compiler, X_OK) == 0)
+{
+  optional_target_path1 = XNEWVEC (char, len + sizeof (-B));
+  sprintf (optional_target_path1, -B%s/../../, current_path);
+  optional_target_path2
+   = XNEWVEC (char, len + sizeof (-B ../ DEFAULT_TARGET_MACHINE
+  /libgomp/));
+  sprintf (optional_target_path2, -B%s/../../../ DEFAULT_TARGET_MACHINE
+ /libgomp/, current_path);
+  optional_target_lib_path
+   = XNEWVEC (char, len + sizeof (-L ../ DEFAULT_TARGET_MACHINE
+  /libgomp/.libs/));
+  sprintf (optional_target_lib_path, -L%s/../../../ 
DEFAULT_TARGET_MACHINE
+/libgomp/.libs/, current_path);
+  found = true;
+}
+
 out:
   free_array_of_ptrs ((void **) paths, n_paths);
-  return found ? target_compiler : NULL;
+  if (!found)
+fatal_error (offload compiler %s not found, name);
+  return target_compiler;
 }
 
 static void
@@ -193,6 +229,14 @@ compile_for_target (struct obstack *argv_obstack)
 obstack_ptr_grow (argv_obstack, -m32);
   else
 obstack_ptr_grow (argv_obstack, -m64);
+
+  if (optional_target_path1)
+obstack_ptr_grow (argv_obstack, optional_target_path1);
+  if (optional_target_path2)
+obstack_ptr_grow (argv_obstack, optional_target_path2);
+  if (optional_target_lib_path)
+obstack_ptr_grow (argv_obstack, optional_target_lib_path);
+
   obstack_ptr_grow (argv_obstack, NULL);
   char **argv = XOBFINISH (argv_obstack, char **);
 
@@ -492,11 +536,7 @@ main (int argc, char **argv)
   if (!host_compiler)
 fatal_error (COLLECT_GCC must be set);
 
-  const char *target_driver_name
-= DEFAULT_REAL_TARGET_MACHINE -accel- 

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

2015-01-28 Thread Jakub Jelinek
On Wed, Jan 28, 2015 at 07:02:59PM +0300, Ilya Verbin wrote:
 + = XNEWVEC (char, len + sizeof (-B ../ DEFAULT_TARGET_MACHINE
 +/libgomp/));
 +  sprintf (optional_target_path2, -B%s/../../../ DEFAULT_TARGET_MACHINE
 +   /libgomp/, current_path);

This will surely overflow the buffer, won't it?  There is space just for
../ but you put there /../../../.

I'd strongly prefer if you rewrote all these XNEWVEC or XRESIZEVEC etc.
+ sprintf cases into concat, like
  optional_target_path2 = concat (-B, current_path,
  /../../../ DEFAULT_TARGET_MACHINE
  /libgomp/, NULL);
and similar.  That way you avoid all such bugs.

Jakub


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

2015-01-15 Thread Ilya Verbin
On 22 Dec 13:35, Jakub Jelinek wrote:
 On Mon, Dec 22, 2014 at 12:48:08PM +0100, Thomas Schwinge wrote:
  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.)
 
 All 3 of these, yes.
 The nothing is installed yet mode supposedly doesn't work properly on the
 trunk yet (and is what I'd like to use e.g. in distro rpm builds), the 
 offloading
 compilers installed, host is not is useful that you actually test the host 
 compiler
 before installing, and that supposedly works on the trunk, the all installed 
 testing
 I've never used myself, but some people are using it.

This patch enables 'make check-target-libgomp' with noninstalled offloading
compilers.  It creates gcc/accel/target/ directory in the build tree of the
offloading compiler, this allows lto-wrapper to find corresponding mkoffload in
case if there is more than one offloading compiler.  Is this approach ok?
I don't like changes in config.gcc and t-intelmic, probably there is a better
way to create a link?


diff --git a/gcc/config.gcc b/gcc/config.gcc
index 0dfc08f..76eef6f 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -4369,7 +4369,7 @@ fi
 case ${target} in
 i[34567]86-*-* | x86_64-*-*)
if test x$enable_as_accelerator = xyes; then
-   extra_programs=mkoffload\$(exeext)
+   extra_programs=mkoffload\$(exeext) 
accel/${target_noncanonical}/mkoffload$(exeext)
fi
;;
 esac
diff --git a/gcc/config/i386/intelmic-mkoffload.c 
b/gcc/config/i386/intelmic-mkoffload.c
index 8e490ff..41807cf 100644
--- a/gcc/config/i386/intelmic-mkoffload.c
+++ b/gcc/config/i386/intelmic-mkoffload.c
@@ -45,6 +45,11 @@ const char *temp_files[MAX_NUM_TEMPS];
 /* Shows if we should compile binaries for i386 instead of x86-64.  */
 bool target_ilp32 = false;
 
+/* An optional prefix for the target compiler, which is required when target
+   compiler is not installed.  */
+char *optional_target_path = NULL;
+
+
 /* Delete tempfiles and exit function.  */
 void
 tool_cleanup (bool from_signal ATTRIBUTE_UNUSED)
@@ -151,14 +156,18 @@ access_check (const char *name, int mode)
   return access (name, mode);
 }
 
-/* Find target compiler using a path from COLLECT_GCC or COMPILER_PATH.  */
+/* Find target compiler using a path from COLLECT_GCC, COMPILER_PATH, or a path
+   relative to ARGV0.  */
 static char *
-find_target_compiler (const char *name)
+find_target_compiler (const char *argv0)
 {
   bool found = false;
   char **paths = NULL;
   unsigned n_paths, i;
+  const char *current_path;
   const char *collect_path = dirname (ASTRDUP (getenv (COLLECT_GCC)));
+  const char *name
+= DEFAULT_REAL_TARGET_MACHINE -accel- DEFAULT_TARGET_MACHINE -gcc;
   size_t len = strlen (collect_path) + 1 + strlen (name) + 1;
   char *target_compiler = XNEWVEC (char, len);
   sprintf (target_compiler, %s/%s, collect_path, name);
@@ -177,13 +186,28 @@ find_target_compiler (const char *name)
   if (access_check (target_compiler, X_OK) == 0)
{
  found = true;
- break;
+ goto out;
}
 }
 
+  /* If installed compiler wasn't found, try to find a non-installed compiler,
+ using a path relative to mkoffload.  */
+  current_path = dirname (ASTRDUP (argv0));
+  len = strlen (current_path) + sizeof (/../../) - 1;
+  target_compiler = XRESIZEVEC (char, target_compiler, len + sizeof (xgcc));
+  sprintf (target_compiler, %s/../../xgcc, current_path);
+  if (access_check (target_compiler, X_OK) == 0)
+{
+  optional_target_path = XNEWVEC (char, len + sizeof (-B));
+  sprintf (optional_target_path, -B%s/../../, current_path);
+  found = true;
+}
+
 out:
   free_array_of_ptrs ((void **) paths, n_paths);
-  return found ? target_compiler : NULL;
+  if (!found)
+fatal_error (offload compiler %s not found, name);
+  return target_compiler;
 }
 
 static void
@@ -193,6 +217,10 @@ compile_for_target (struct obstack *argv_obstack)
 obstack_ptr_grow (argv_obstack, -m32);
   else
 obstack_ptr_grow (argv_obstack, -m64);
+
+  if (optional_target_path)
+obstack_ptr_grow (argv_obstack, optional_target_path);
+
   obstack_ptr_grow (argv_obstack, NULL);
   char **argv = XOBFINISH (argv_obstack, char **);
 
@@ -492,11 +520,7 @@ main (int argc, char **argv)
   if (!host_compiler)
 fatal_error (COLLECT_GCC must be set);
 
-  const char *target_driver_name
-= DEFAULT_REAL_TARGET_MACHINE -accel- DEFAULT_TARGET_MACHINE -gcc;
-  char *target_compiler = find_target_compiler (target_driver_name);
-  if (target_compiler == NULL)
-fatal_error (offload compiler %s not found, target_driver_name);
+  char *target_compiler = find_target_compiler (argv[0]);
 
   /* We may be called with all the 

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

2015-01-15 Thread Jakub Jelinek
On Thu, Jan 15, 2015 at 09:55:40PM +0300, Ilya Verbin wrote:
 This patch enables 'make check-target-libgomp' with noninstalled offloading
 compilers.  It creates gcc/accel/target/ directory in the build tree of the
 offloading compiler, this allows lto-wrapper to find corresponding mkoffload 
 in
 case if there is more than one offloading compiler.  Is this approach ok?
 I don't like changes in config.gcc and t-intelmic, probably there is a better
 way to create a link?

Let's wait until Thomas hopefully checks in the OpenACC merge in order not
to make him work even harder.
I'll look at your patch afterwards.

Jakub


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

2015-01-08 Thread Thomas Schwinge
Hi!

On Fri, 26 Dec 2014 22:15:24 +0300, Ilya Verbin iver...@gmail.com wrote:
 On 22 Dec 12:48, Thomas Schwinge wrote:
  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?)

 OK, thanks.
 I verified this case some time ago, but missed when it started failing, since
 tests just become UNSUPPORTED or PASSED with host fallback, rather than 
 FAILing.

Yeah.  (I diff the *.sum files, so I do see such regressions.)  Committed
to trunk in r219348:

commit b21c795fa27f6fcefdb38d1bc50f1d1634f4e0b3
Author: tschwinge tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4
Date:   Thu Jan 8 16:01:24 2015 +

libgomp: Fix intelmic offloading in build-tree testing.

libgomp/
* testsuite/lib/libgomp.exp (libgomp_init): Correctly match
intelmic in $offload_targets.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@219348 
138bc75d-0d04-0410-961f-82ee72b054a4
---
 libgomp/ChangeLog | 5 +
 libgomp/testsuite/lib/libgomp.exp | 3 +--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git libgomp/ChangeLog libgomp/ChangeLog
index afbde87..beecba9 100644
--- libgomp/ChangeLog
+++ libgomp/ChangeLog
@@ -1,3 +1,8 @@
+2015-01-08  Thomas Schwinge  tho...@codesourcery.com
+
+   * testsuite/lib/libgomp.exp (libgomp_init): Correctly match
+   intelmic in $offload_targets.
+
 2015-01-05  Jakub Jelinek  ja...@redhat.com
 
Update copyright years.
diff --git libgomp/testsuite/lib/libgomp.exp libgomp/testsuite/lib/libgomp.exp
index ff22f10..2d6f822 100644
--- 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


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

 OK, thanks.

Committed to trunk in r219349:

commit 49b6c472197cbb443c55cc1064de5b24384bbf7f
Author: tschwinge tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4
Date:   Thu Jan 8 16:01:37 2015 +

libgomp: Fix 32-bit x86 Intel MIC offloading testing.

[...]
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: 

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

2014-12-26 Thread Ilya Verbin
On 22 Dec 12:48, Thomas Schwinge wrote:
 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?)

The case for empty $tgt_dir is required when offload compiler is installed, but
host compiler isn't.

 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?

If DESTDIR is used, then $tgt_dir can not be empty, otherwise during the build
of host compiler the host's part of MIC plugin for libgomp will not find
target's part, which is built along with target compiler.

 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

OK, thanks.
I verified this case some time ago, but missed when it started failing, since
tests just become UNSUPPORTED or PASSED with host fallback, rather than FAILing.

 Here is a patch to fix 32-bit x86 Intel MIC offloading; OK to commit, I
 assume?
 
 $ 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

OK, thanks.

  -- Ilya


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

2014-12-22 Thread Thomas Schwinge
Hi!

On Thu, 18 Dec 2014 18:41:18 +0100, Ilya Verbin iver...@gmail.com wrote:
 2014-12-18 16:27 GMT+01:00 Thomas Schwinge tho...@codesourcery.com:
  On Thu, 30 Oct 2014 14:40:01 +0300, Ilya Verbin iver...@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 

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

2014-12-22 Thread Jakub Jelinek
On Mon, Dec 22, 2014 at 12:48:08PM +0100, Thomas Schwinge wrote:
 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.)

All 3 of these, yes.
The nothing is installed yet mode supposedly doesn't work properly on the
trunk yet (and is what I'd like to use e.g. in distro rpm builds), the 
offloading
compilers installed, host is not is useful that you actually test the host 
compiler
before installing, and that supposedly works on the trunk, the all installed 
testing
I've never used myself, but some people are using it.

Jakub


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

2014-12-22 Thread Thomas Schwinge
Hi!

On Thu, 18 Dec 2014 11:21:20 +0100, Jakub Jelinek ja...@redhat.com wrote:
 On Wed, Dec 17, 2014 at 11:48:01PM +0100, Thomas Schwinge wrote:
  I have another suggestion: on gomp-4_0-branch, we had already started
  using a libgomp-test-support.exp file for a similar purpose.  I now
  changed your code on gomp-4_0-branch in r218845 as follows (though, not
  very much tested).  The advantage here is that people who are not using
  GCC build-tree testing, but are directly invoking runtest, then don't
  have to set various environment variables, but instead just have to copy
  this one libgomp-test-support.exp file from the build tree to the testing
  tree.  Does this make sense?
  
  commit de01639bf47e29a20959771e587fb6f30c372a45
  Author: tschwinge tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4
  Date:   Wed Dec 17 22:45:05 2014 +
  
  libgomp: Route offloading data through the libgomp-test-support.exp 
  file.
  
  libgomp/
  * testsuite/Makefile.am: Don't export OFFLOAD_TARGETS,
  OFFLOAD_ADDITIONAL_OPTIONS, and OFFLOAD_ADDITIONAL_LIB_PATHS...
  * testsuite/libgomp-test-support.exp.in: ..., and instead set
  offload_targets, offload_additional_options, and
  offload_additional_lib_paths here.  Update all users.
 
 LGTM.

As discussed in
http://news.gmane.org/find-root.php?message_id=%3C87388dropf.fsf%40schwinge.name%3E,
that doesn't really work: there may be additional (recursive) expansions
required (similar to: libexecdir being defined in terms of exec_prefix,
that in terms of prefix, and so on), so we really need to handle that in
the Makefile, where all these variables are available.  Committed to
gomp-4_0-branch in r219016:

commit 6bb8cfa151e40ab1e991112d2bbe2719f0a2c46a
Author: tschwinge tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4
Date:   Mon Dec 22 16:17:15 2014 +

libgomp: Handle Makefile variable usage in 
testsuite/libgomp-test-support.exp.

libgomp/
* testsuite/libgomp-test-support.exp.in
(offload_additional_options, offload_additional_lib_paths): Don't
set.
* configure.ac: Instantiate testsuite/libgomp-test-support.pt.exp
instead of testsuite/libgomp-test-support.exp.
* testsuite/Makefile.am (libgomp-test-support.exp): New rule.
(all-local): Depend on it.
* configure: Regenerate.
* testsuite/Makefile.in: Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@219016 
138bc75d-0d04-0410-961f-82ee72b054a4
---
 libgomp/ChangeLog.gomp| 12 
 libgomp/configure |  4 +--
 libgomp/configure.ac  |  2 +-
 libgomp/testsuite/Makefile.am | 14 +
 libgomp/testsuite/Makefile.in | 41 ++-
 libgomp/testsuite/libgomp-test-support.exp.in |  2 --
 6 files changed, 56 insertions(+), 19 deletions(-)

diff --git libgomp/ChangeLog.gomp libgomp/ChangeLog.gomp
index b7a0e7d..6653e58 100644
--- libgomp/ChangeLog.gomp
+++ libgomp/ChangeLog.gomp
@@ -1,3 +1,15 @@
+2014-12-22  Thomas Schwinge  tho...@codesourcery.com
+
+   * testsuite/libgomp-test-support.exp.in
+   (offload_additional_options, offload_additional_lib_paths): Don't
+   set.
+   * configure.ac: Instantiate testsuite/libgomp-test-support.pt.exp
+   instead of testsuite/libgomp-test-support.exp.
+   * testsuite/Makefile.am (libgomp-test-support.exp): New rule.
+   (all-local): Depend on it.
+   * configure: Regenerate.
+   * testsuite/Makefile.in: Likewise.
+
 2014-12-17  Thomas Schwinge  tho...@codesourcery.com
Tom de Vries  t...@codesourcery.com
 
diff --git libgomp/configure libgomp/configure
index f72378e..839b2c6 100755
--- libgomp/configure
+++ libgomp/configure
@@ -16553,7 +16553,7 @@ ac_config_files=$ac_config_files omp.h omp_lib.h 
omp_lib.f90 libgomp_f.h
 
 ac_config_files=$ac_config_files Makefile testsuite/Makefile libgomp.spec
 
-ac_config_files=$ac_config_files testsuite/libgomp-test-support.exp
+ac_config_files=$ac_config_files 
testsuite/libgomp-test-support.pt.exp:testsuite/libgomp-test-support.exp.in
 
 cat confcache \_ACEOF
 # This file is a shell script that caches the results of configure
@@ -17699,7 +17699,7 @@ do
 Makefile) CONFIG_FILES=$CONFIG_FILES Makefile ;;
 testsuite/Makefile) CONFIG_FILES=$CONFIG_FILES testsuite/Makefile ;;
 libgomp.spec) CONFIG_FILES=$CONFIG_FILES libgomp.spec ;;
-testsuite/libgomp-test-support.exp) CONFIG_FILES=$CONFIG_FILES 
testsuite/libgomp-test-support.exp ;;
+testsuite/libgomp-test-support.pt.exp) CONFIG_FILES=$CONFIG_FILES 
testsuite/libgomp-test-support.pt.exp:testsuite/libgomp-test-support.exp.in ;;
 
   *) as_fn_error invalid argument: \`$ac_config_target' $LINENO 5;;
   esac
diff --git libgomp/configure.ac libgomp/configure.ac
index 178c34d..4687b01 100644
--- libgomp/configure.ac

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

2014-12-18 Thread Jakub Jelinek
On Wed, Dec 17, 2014 at 11:48:01PM +0100, Thomas Schwinge wrote:
 I have another suggestion: on gomp-4_0-branch, we had already started
 using a libgomp-test-support.exp file for a similar purpose.  I now
 changed your code on gomp-4_0-branch in r218845 as follows (though, not
 very much tested).  The advantage here is that people who are not using
 GCC build-tree testing, but are directly invoking runtest, then don't
 have to set various environment variables, but instead just have to copy
 this one libgomp-test-support.exp file from the build tree to the testing
 tree.  Does this make sense?
 
 commit de01639bf47e29a20959771e587fb6f30c372a45
 Author: tschwinge tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4
 Date:   Wed Dec 17 22:45:05 2014 +
 
 libgomp: Route offloading data through the libgomp-test-support.exp file.
 
   libgomp/
   * testsuite/Makefile.am: Don't export OFFLOAD_TARGETS,
   OFFLOAD_ADDITIONAL_OPTIONS, and OFFLOAD_ADDITIONAL_LIB_PATHS...
   * testsuite/libgomp-test-support.exp.in: ..., and instead set
   offload_targets, offload_additional_options, and
   offload_additional_lib_paths here.  Update all users.

LGTM.

Jakub


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

2014-12-18 Thread Thomas Schwinge
Hi!

On Thu, 30 Oct 2014 14:40:01 +0300, Ilya Verbin iver...@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?

 --- a/libgomp/testsuite/lib/libgomp.exp
 +++ b/libgomp/testsuite/lib/libgomp.exp
 @@ -169,6 +186,10 @@ proc libgomp_init { args } {
  
  # Disable color diagnostics
  lappend ALWAYS_CFLAGS additional_flags=-fdiagnostics-color=never
 +
 +# Required to support non-fallback testing of '#pragma omp target'.
 +# Help GCC to find target mkoffload.
 +lappend ALWAYS_CFLAGS additional_flags=${offload_additional_options}
  }

What we're doing in OpenACC offloading testing (gomp-4_0-branch), is in
the libgomp.oacc-c/c.exp (etc.) file cycle through all the available
offloading devices, and then in there -- I think -- such options should
be set, that are specific to one particular offloading device/compiler?


Grüße,
 Thomas


signature.asc
Description: PGP signature


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

2014-12-18 Thread Ilya Verbin
Hi,

2014-12-18 16:27 GMT+01:00 Thomas Schwinge tho...@codesourcery.com:
 Hi!

 On Thu, 30 Oct 2014 14:40:01 +0300, Ilya Verbin iver...@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?

 --- a/libgomp/testsuite/lib/libgomp.exp
 +++ b/libgomp/testsuite/lib/libgomp.exp
 @@ -169,6 +186,10 @@ proc libgomp_init { args } {

  # Disable color diagnostics
  lappend ALWAYS_CFLAGS additional_flags=-fdiagnostics-color=never
 +
 +# Required to support non-fallback testing of '#pragma omp target'.
 +# Help GCC to find target mkoffload.
 +lappend ALWAYS_CFLAGS additional_flags=${offload_additional_options}
  }

 What we're doing in OpenACC offloading testing (gomp-4_0-branch), is in
 the libgomp.oacc-c/c.exp (etc.) file cycle through all the available
 offloading devices, and then in there -- I think -- such options should
 be set, that are specific to one particular offloading device/compiler?


 Grüße,
  Thomas

I have not tested a compiler, configured to support 2 different
offloading targets, so there might be some corner cases.

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.

However, I still did not tried to enable 'make check' with
non-installed offloading compilers. Probably such target specific
paths can help there.

  -- Ilya


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

2014-12-18 Thread Jakub Jelinek
On Thu, Dec 18, 2014 at 06:41:18PM +0100, Ilya Verbin wrote:
  What we're doing in OpenACC offloading testing (gomp-4_0-branch), is in
  the libgomp.oacc-c/c.exp (etc.) file cycle through all the available
  offloading devices, and then in there -- I think -- such options should
  be set, that are specific to one particular offloading device/compiler?
 
 I have not tested a compiler, configured to support 2 different
 offloading targets, so there might be some corner cases.
 
 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.
 
 However, I still did not tried to enable 'make check' with
 non-installed offloading compilers. Probably such target specific
 paths can help there.

Yeah, generally we want to be able to support all 3 (or 4 etc.) compilers
installed into the same DESTDIR and prefix, so extra -B arguments in there
should not break anything, for each of the offloading compilers you'd just
add what -B options it needs.

Jakub


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

2014-12-17 Thread Thomas Schwinge
Hi!

On Mon, 10 Nov 2014 17:34:30 +0300, Ilya Verbin iver...@gmail.com wrote:
 On 06 Nov 18:55, Jakub Jelinek wrote:
  Looks mostly good, but:
  
   +# We need more things in site.exp, but automake completely controls the
   +# creation of that file; there's no way to append to it without messing 
   up
   +# the dependancy chains.  So we overrule automake.  This rule is exactly
   +# what it would have generated, plus our own additions.
   +site.exp: Makefile
   + @echo 'Making a new site.exp file...'
   + @echo '## these variables are automatically generated by make ##' 
   site.tmp
   + @echo '# Do not edit here.  If you wish to override these values' 
   site.tmp
   + @echo '# edit the last section' site.tmp
   + @echo 'set srcdir $(srcdir)' site.tmp
   +[...]
   + @echo 'set target_triplet $(target_triplet)' site.tmp
   + @echo 'set offload_targets $(offload_targets)' site.tmp
   + @echo 'set offload_additional_options $(offload_additional_options)' 
   site.tmp
   + @echo 'set offload_additional_lib_paths 
   $(offload_additional_lib_paths)' site.tmp
   + @echo '## All variables above are generated by configure. Do Not Edit 
   ##' site.tmp
   + @test ! -f site.exp || \
   +   sed '1,/^## All variables above are.*##/ d' site.exp  site.tmp
   + @-rm -f site.bak
   + @test ! -f site.exp || mv site.exp site.bak
   + @mv site.tmp site.exp
  
  I don't like this, that is too fragile.  If automake is changed, we'll
  forget to update this.

(The same problem exists elsewhere in GCC.  But I certainly do agree that
it's ugly.)

  If all you are about are the 3 additional variables, can't you instead
  put them into env vars and query them in the tcl code using getenv?
  Or append them into AM_RUNTESTFLAGS ?
  AM_RUNTESTFLAGS += @something@
 
 Done, I put them into env vars.

 --- a/libgomp/testsuite/Makefile.am
 +++ b/libgomp/testsuite/Makefile.am
 @@ -11,3 +11,8 @@ EXPECT = $(shell if test -f 
 $(top_builddir)/../expect/expect; then \
  _RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \
echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)
  RUNTEST = $(_RUNTEST) $(AM_RUNTESTFLAGS)
 +
 +# Used for support non-fallback offloading.
 +export OFFLOAD_TARGETS = $(offload_targets)
 +export OFFLOAD_ADDITIONAL_OPTIONS = $(offload_additional_options)
 +export OFFLOAD_ADDITIONAL_LIB_PATHS = $(offload_additional_lib_paths)

 --- a/libgomp/testsuite/lib/libgomp.exp
 +++ b/libgomp/testsuite/lib/libgomp.exp
 @@ -107,6 +107,25 @@ proc libgomp_init { args } {
  # Compute what needs to be put into LD_LIBRARY_PATH
  set always_ld_library_path .:${blddir}/.libs
  
 +# Get offload-related variables from environment (exported by Makefile)
 +set offload_targets [getenv OFFLOAD_TARGETS]
 +set offload_additional_options [getenv OFFLOAD_ADDITIONAL_OPTIONS]
 +set offload_additional_lib_paths [getenv OFFLOAD_ADDITIONAL_LIB_PATHS]
 +[...]

I have another suggestion: on gomp-4_0-branch, we had already started
using a libgomp-test-support.exp file for a similar purpose.  I now
changed your code on gomp-4_0-branch in r218845 as follows (though, not
very much tested).  The advantage here is that people who are not using
GCC build-tree testing, but are directly invoking runtest, then don't
have to set various environment variables, but instead just have to copy
this one libgomp-test-support.exp file from the build tree to the testing
tree.  Does this make sense?

commit de01639bf47e29a20959771e587fb6f30c372a45
Author: tschwinge tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4
Date:   Wed Dec 17 22:45:05 2014 +

libgomp: Route offloading data through the libgomp-test-support.exp file.

libgomp/
* testsuite/Makefile.am: Don't export OFFLOAD_TARGETS,
OFFLOAD_ADDITIONAL_OPTIONS, and OFFLOAD_ADDITIONAL_LIB_PATHS...
* testsuite/libgomp-test-support.exp.in: ..., and instead set
offload_targets, offload_additional_options, and
offload_additional_lib_paths here.  Update all users.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@218845 
138bc75d-0d04-0410-961f-82ee72b054a4
---
 libgomp/ChangeLog.gomp| 6 ++
 libgomp/testsuite/Makefile.am | 5 -
 libgomp/testsuite/Makefile.in | 5 -
 libgomp/testsuite/lib/libgomp.exp | 8 +++-
 libgomp/testsuite/libgomp-test-support.exp.in | 4 
 5 files changed, 13 insertions(+), 15 deletions(-)

diff --git libgomp/ChangeLog.gomp libgomp/ChangeLog.gomp
index 1fca220..9c23c80 100644
--- libgomp/ChangeLog.gomp
+++ libgomp/ChangeLog.gomp
@@ -1,5 +1,11 @@
 2014-12-17  Thomas Schwinge  tho...@codesourcery.com
 
+   * testsuite/Makefile.am: Don't export OFFLOAD_TARGETS,
+   OFFLOAD_ADDITIONAL_OPTIONS, and OFFLOAD_ADDITIONAL_LIB_PATHS...
+   * testsuite/libgomp-test-support.exp.in: ..., and instead set
+   offload_targets, offload_additional_options, and
+   

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

2014-11-21 Thread Bernd Edlinger
Aehm Kirill,

excuse me please, but if I do

autogen Makefile.def


I get this from svn diff

Index: Makefile.in
===
--- Makefile.in    (revision 217890)
+++ Makefile.in    (working copy)
@@ -35238,9 +35238,6 @@
 $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/liboffloadmic ; \
 $(NORMAL_TARGET_EXPORTS)  \
 echo Configuring in $(TARGET_SUBDIR)/liboffloadmic; \
-     \
-    this_target=${target_alias}; \
-     \
 cd $(TARGET_SUBDIR)/liboffloadmic || exit 1; \
 case $(srcdir) in \
   /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -35248,14 +35245,12 @@
     sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
 esac; \
 module_srcdir=liboffloadmic; \
-    srcdiroption=--srcdir=$${topdir}/liboffloadmic; \
-    libsrcdir=$$s/liboffloadmic; \
 rm -f no-such-file || : ; \
 CONFIG_SITE=no-such-file $(SHELL) \
   $$s/$$module_srcdir/configure \
   --srcdir=$${topdir}/$$module_srcdir \
   $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
-      --target=$${this_target} $${srcdiroption} 
@extra_liboffloadmic_configure_flags@ \
+      --target=${target_alias} @extra_liboffloadmic_configure_flags@ \
   || exit 1
 @endif target-liboffloadmic
 

svn blame Makefile.in points to:

r217498 | kyukhin | 2014-11-13 15:03:17 +0100 (Thu, 13 Nov 2014) | 110 lines

[PATCH 2/4] OpenMP 4.0 offloading to Intel MIC: liboffloadmic.

    * Makefile.def: Add liboffloadmic to target_modules.  Make
    liboffloadmic depend on libgomp's configure, libstdc++ and libgcc.
    * Makefile.in: Regenerate.
    * configure: Regenerate.
    * configure.ac: Add liboffloadmic to target binaries.
    Restrict liboffloadmic for POSIX and i*86, and x86_64 architectures.
    Add liboffloadmic to noconfig list when C++ is not supported.


so, did you really regenerate Makefile.in in that patch, or am I missing 
something ?


Regards,
Bernd.
  

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

2014-11-21 Thread Ilya Verbin
Hi,

On 21 Nov 19:19, Bernd Edlinger wrote:
 so, did you really regenerate Makefile.in in that patch, or am I missing 
 something ?

You're right.  This patch was rebased so many times, that we may forget to
regenerate it before committing.

Do you plan to submit any patch for Makefile.in?
Or should I post this change separately for review? (with regtesting)

  -- Ilya


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

2014-11-21 Thread Bernd Edlinger
Hi Ilya,

On Fri, 21 Nov 2014 21:44:40, Ilya Verbin wrote:

 Hi,

 On 21 Nov 19:19, Bernd Edlinger wrote:
 so, did you really regenerate Makefile.in in that patch, or am I missing 
 something ?

 You're right. This patch was rebased so many times, that we may forget to
 regenerate it before committing.

 Do you plan to submit any patch for Makefile.in?
 Or should I post this change separately for review? (with regtesting)

 -- Ilya


No, at least not immediately, so I would prefer if you go ahead with your patch 
ASAP.


Thanks,
Bernd.
  

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

2014-11-21 Thread Ilya Verbin
Hi Jakub!

 On Fri, 21 Nov 2014 21:44:40, Ilya Verbin wrote:
  You're right. This patch was rebased so many times, that we may forget to
  regenerate it before committing.

Build with liboffloadmic passed.  OK for trunk?

  -- Ilya


* Makefile.in: Regenerate.


diff --git a/Makefile.in b/Makefile.in
index f1ff972..0bae570 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -35238,9 +35238,6 @@ configure-target-liboffloadmic:
$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/liboffloadmic ; \
$(NORMAL_TARGET_EXPORTS)  \
echo Configuring in $(TARGET_SUBDIR)/liboffloadmic; \
-\
-   this_target=${target_alias}; \
-\
cd $(TARGET_SUBDIR)/liboffloadmic || exit 1; \
case $(srcdir) in \
  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
@@ -35248,14 +35245,12 @@ configure-target-liboffloadmic:
sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
esac; \
module_srcdir=liboffloadmic; \
-   srcdiroption=--srcdir=$${topdir}/liboffloadmic; \
-   libsrcdir=$$s/liboffloadmic; \
rm -f no-such-file || : ; \
CONFIG_SITE=no-such-file $(SHELL) \
  $$s/$$module_srcdir/configure \
  --srcdir=$${topdir}/$$module_srcdir \
  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
- --target=$${this_target} $${srcdiroption} 
@extra_liboffloadmic_configure_flags@ \
+ --target=${target_alias} @extra_liboffloadmic_configure_flags@ \
  || exit 1
 @endif target-liboffloadmic
 


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

2014-11-21 Thread Jakub Jelinek
On Fri, Nov 21, 2014 at 10:14:21PM +0300, Ilya Verbin wrote:
  On Fri, 21 Nov 2014 21:44:40, Ilya Verbin wrote:
   You're right. This patch was rebased so many times, that we may forget to
   regenerate it before committing.
 
 Build with liboffloadmic passed.  OK for trunk?
 
   -- Ilya
 
 
   * Makefile.in: Regenerate.

Ok.
 --- a/Makefile.in
 +++ b/Makefile.in
 @@ -35238,9 +35238,6 @@ configure-target-liboffloadmic:
   $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/liboffloadmic ; \
   $(NORMAL_TARGET_EXPORTS)  \
   echo Configuring in $(TARGET_SUBDIR)/liboffloadmic; \
 -  \
 - this_target=${target_alias}; \
 -  \
   cd $(TARGET_SUBDIR)/liboffloadmic || exit 1; \
   case $(srcdir) in \
 /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
 @@ -35248,14 +35245,12 @@ configure-target-liboffloadmic:
   sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
   esac; \
   module_srcdir=liboffloadmic; \
 - srcdiroption=--srcdir=$${topdir}/liboffloadmic; \
 - libsrcdir=$$s/liboffloadmic; \
   rm -f no-such-file || : ; \
   CONFIG_SITE=no-such-file $(SHELL) \
 $$s/$$module_srcdir/configure \
 --srcdir=$${topdir}/$$module_srcdir \
 $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
 -   --target=$${this_target} $${srcdiroption} 
 @extra_liboffloadmic_configure_flags@ \
 +   --target=${target_alias} @extra_liboffloadmic_configure_flags@ \
 || exit 1
  @endif target-liboffloadmic
  

Jakub


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

2014-11-12 Thread Jakub Jelinek
On Mon, Nov 10, 2014 at 05:34:30PM +0300, Ilya Verbin wrote:
  I don't like this, that is too fragile.  If automake is changed, we'll
  forget to update this.
  If all you are about are the 3 additional variables, can't you instead
  put them into env vars and query them in the tcl code using getenv?
  Or append them into AM_RUNTESTFLAGS ?
  AM_RUNTESTFLAGS += @something@
 
 Done, I put them into env vars.

Thanks.

   +lappend ALWAYS_CFLAGS 
   additional_flags=${offload_additional_options}
}
  
  Perhaps add this only if offload_additional_options is non-empty?
 
 Done.

Ok for trunk.

Jakub


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

2014-11-10 Thread Jakub Jelinek
On Mon, Nov 10, 2014 at 05:34:30PM +0300, Ilya Verbin wrote:
 Done, I put them into env vars.
 
   +lappend ALWAYS_CFLAGS 
   additional_flags=${offload_additional_options}
}
  
  Perhaps add this only if offload_additional_options is non-empty?
 
 Done.

Ok (with appropriate ChangeLog entry).

Jakub


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

2014-11-10 Thread Ilya Verbin
On 06 Nov 18:55, Jakub Jelinek wrote:
 Looks mostly good, but:
 
  +# We need more things in site.exp, but automake completely controls the
  +# creation of that file; there's no way to append to it without messing up
  +# the dependancy chains.  So we overrule automake.  This rule is exactly
  +# what it would have generated, plus our own additions.
  +site.exp: Makefile
  +   @echo 'Making a new site.exp file...'
  +   @echo '## these variables are automatically generated by make ##' 
  site.tmp
  +   @echo '# Do not edit here.  If you wish to override these values' 
  site.tmp
  +   @echo '# edit the last section' site.tmp
  +   @echo 'set srcdir $(srcdir)' site.tmp
  +   @echo set objdir `pwd` site.tmp
  +   @echo 'set build_alias $(build_alias)' site.tmp
  +   @echo 'set build_triplet $(build_triplet)' site.tmp
  +   @echo 'set host_alias $(host_alias)' site.tmp
  +   @echo 'set host_triplet $(host_triplet)' site.tmp
  +   @echo 'set target_alias $(target_alias)' site.tmp
  +   @echo 'set target_triplet $(target_triplet)' site.tmp
  +   @echo 'set offload_targets $(offload_targets)' site.tmp
  +   @echo 'set offload_additional_options $(offload_additional_options)' 
  site.tmp
  +   @echo 'set offload_additional_lib_paths 
  $(offload_additional_lib_paths)' site.tmp
  +   @echo '## All variables above are generated by configure. Do Not Edit 
  ##' site.tmp
  +   @test ! -f site.exp || \
  + sed '1,/^## All variables above are.*##/ d' site.exp  site.tmp
  +   @-rm -f site.bak
  +   @test ! -f site.exp || mv site.exp site.bak
  +   @mv site.tmp site.exp
 
 I don't like this, that is too fragile.  If automake is changed, we'll
 forget to update this.
 If all you are about are the 3 additional variables, can't you instead
 put them into env vars and query them in the tcl code using getenv?
 Or append them into AM_RUNTESTFLAGS ?
 AM_RUNTESTFLAGS += @something@

Done, I put them into env vars.

  +lappend ALWAYS_CFLAGS additional_flags=${offload_additional_options}
   }
 
 Perhaps add this only if offload_additional_options is non-empty?

Done.

Thanks,
  -- Ilya


---

diff --git a/libgomp/Makefile.in b/libgomp/Makefile.in
index 5cd666f..8e4774f 100644
--- a/libgomp/Makefile.in
+++ b/libgomp/Makefile.in
@@ -268,6 +268,9 @@ lt_host_flags = @lt_host_flags@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 multi_basedir = @multi_basedir@
+offload_additional_lib_paths = @offload_additional_lib_paths@
+offload_additional_options = @offload_additional_options@
+offload_targets = @offload_targets@
 oldincludedir = @oldincludedir@
 pdfdir = @pdfdir@
 prefix = @prefix@
diff --git a/libgomp/configure b/libgomp/configure
index 97c9be6..aabf25f 100755
--- a/libgomp/configure
+++ b/libgomp/configure
@@ -616,6 +616,9 @@ OMP_LOCK_SIZE
 USE_FORTRAN_FALSE
 USE_FORTRAN_TRUE
 link_gomp
+offload_additional_lib_paths
+offload_additional_options
+offload_targets
 XLDFLAGS
 XCFLAGS
 config_path
@@ -11094,7 +11097,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat  conftest.$ac_ext _LT_EOF
-#line 11097 configure
+#line 11100 configure
 #include confdefs.h
 
 #if HAVE_DLFCN_H
@@ -11200,7 +11203,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat  conftest.$ac_ext _LT_EOF
-#line 11203 configure
+#line 11206 configure
 #include confdefs.h
 
 #if HAVE_DLFCN_H
@@ -16207,9 +16210,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-*)
@@ -16222,6 +16229,13 @@ 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
 
@@ -16230,6 +16244,9 @@ cat confdefs.h _ACEOF
 _ACEOF
 
 
+
+
+
 # Set up the set of libraries that we need to link against for libgomp.
 # Note that the GOMP_SELF_SPEC in gcc.c may force -pthread,
 # which will force linkage against -lpthread (or equivalent for the system).
diff --git a/libgomp/configure.ac b/libgomp/configure.ac
index 3f34ff8..cea6366 100644
--- a/libgomp/configure.ac
+++ b/libgomp/configure.ac
@@ -280,9 +280,13 @@ else
   multilib_arg=
 fi
 
+# Get accel target and path to install tree 

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

2014-11-06 Thread Jakub Jelinek
On Thu, Oct 30, 2014 at 02:40:01PM +0300, Ilya Verbin wrote:
 2014-10-30  Andrey Turetskiy  andrey.turets...@intel.com
   Ilya Verbin  ilya.ver...@intel.com
 
 libgomp/
   * Makefile.in: Regenerate.
   * configure: Regenerate.
   * configure.ac: Set up offload_additional_options,
   offload_additional_lib_paths and offload_targets.
   * testsuite/Makefile.am: Overrule site.exp.
   * testsuite/Makefile.in: Regenerate.
   * testsuite/lib/libgomp.exp (libgomp_init): Append
   offload_additional_lib_paths to LD_LIBRARY_PATH.  Append
   offload_additional_options to ALWAYS_CFLAGS.  Append liboffloadmic
   build directory to LD_LIBRARY_PATH for intelmic offload targets.

Looks mostly good, but:

 --- a/libgomp/testsuite/Makefile.am
 +++ b/libgomp/testsuite/Makefile.am
 @@ -11,3 +11,30 @@ EXPECT = $(shell if test -f 
 $(top_builddir)/../expect/expect; then \
  _RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \
echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)
  RUNTEST = $(_RUNTEST) $(AM_RUNTESTFLAGS)
 +
 +# We need more things in site.exp, but automake completely controls the
 +# creation of that file; there's no way to append to it without messing up
 +# the dependancy chains.  So we overrule automake.  This rule is exactly
 +# what it would have generated, plus our own additions.
 +site.exp: Makefile
 + @echo 'Making a new site.exp file...'
 + @echo '## these variables are automatically generated by make ##' 
 site.tmp
 + @echo '# Do not edit here.  If you wish to override these values' 
 site.tmp
 + @echo '# edit the last section' site.tmp
 + @echo 'set srcdir $(srcdir)' site.tmp
 + @echo set objdir `pwd` site.tmp
 + @echo 'set build_alias $(build_alias)' site.tmp
 + @echo 'set build_triplet $(build_triplet)' site.tmp
 + @echo 'set host_alias $(host_alias)' site.tmp
 + @echo 'set host_triplet $(host_triplet)' site.tmp
 + @echo 'set target_alias $(target_alias)' site.tmp
 + @echo 'set target_triplet $(target_triplet)' site.tmp
 + @echo 'set offload_targets $(offload_targets)' site.tmp
 + @echo 'set offload_additional_options $(offload_additional_options)' 
 site.tmp
 + @echo 'set offload_additional_lib_paths 
 $(offload_additional_lib_paths)' site.tmp
 + @echo '## All variables above are generated by configure. Do Not Edit 
 ##' site.tmp
 + @test ! -f site.exp || \
 +   sed '1,/^## All variables above are.*##/ d' site.exp  site.tmp
 + @-rm -f site.bak
 + @test ! -f site.exp || mv site.exp site.bak
 + @mv site.tmp site.exp

I don't like this, that is too fragile.  If automake is changed, we'll
forget to update this.
If all you are about are the 3 additional variables, can't you instead
put them into env vars and query them in the tcl code using getenv?
Or append them into AM_RUNTESTFLAGS ?
AM_RUNTESTFLAGS += @something@

 @@ -169,6 +186,10 @@ proc libgomp_init { args } {
  
  # Disable color diagnostics
  lappend ALWAYS_CFLAGS additional_flags=-fdiagnostics-color=never
 +
 +# Required to support non-fallback testing of '#pragma omp target'.
 +# Help GCC to find target mkoffload.
 +lappend ALWAYS_CFLAGS additional_flags=${offload_additional_options}
  }

Perhaps add this only if offload_additional_options is non-empty?

Jakub