Refactor intelmic-mkoffload.c argv building to use obstacks (was: [PATCH 1/4] Add mkoffload for Intel MIC)

2015-09-30 Thread Thomas Schwinge
Hi! On Mon, 28 Sep 2015 13:27:32 +0200, Bernd Schmidt wrote: > On 09/28/2015 01:25 PM, Ilya Verbin wrote: > > On Mon, Sep 28, 2015 at 12:09:19 +0200, Bernd Schmidt wrote: > >> On 09/28/2015 12:03 PM, Bernd Schmidt wrote: > >>> On 09/28/2015 10:26 AM, Thomas Schwinge wrote: > - objcopy_argv[

Re: [PATCH 1/4] Add mkoffload for Intel MIC

2015-09-29 Thread Bernd Schmidt
On 09/29/2015 12:29 PM, Richard Biener wrote: I agree that obstacks are better here. Efficiency shouldn't matter here. But we're in C++ now so can't we statically construct the array with sth like const char *new_argv[] = { "objcopy", ... }; ? Thus have the compiler figure out the number of a

Re: [PATCH 1/4] Add mkoffload for Intel MIC

2015-09-29 Thread Richard Biener
On Mon, Sep 28, 2015 at 2:05 PM, Bernd Schmidt wrote: > On 09/28/2015 02:00 PM, Jakub Jelinek wrote: >> >> On Mon, Sep 28, 2015 at 01:27:32PM +0200, Bernd Schmidt wrote: I've removed obstack_ptr_grow for arrays with known sizes after this review: https://gcc.gnu.org/ml/gcc-patc

Re: [PATCH 1/4] Add mkoffload for Intel MIC

2015-09-28 Thread Bernd Schmidt
On 09/28/2015 02:00 PM, Jakub Jelinek wrote: On Mon, Sep 28, 2015 at 01:27:32PM +0200, Bernd Schmidt wrote: I've removed obstack_ptr_grow for arrays with known sizes after this review: https://gcc.gnu.org/ml/gcc-patches/2014-10/msg02210.html That's unfortunate, I think that made the code less

Re: [PATCH 1/4] Add mkoffload for Intel MIC

2015-09-28 Thread Jakub Jelinek
On Mon, Sep 28, 2015 at 01:27:32PM +0200, Bernd Schmidt wrote: > >I've removed obstack_ptr_grow for arrays with known sizes after this review: > >https://gcc.gnu.org/ml/gcc-patches/2014-10/msg02210.html > > That's unfortunate, I think that made the code less future-proof. IMO we > should revert to

Re: [PATCH 1/4] Add mkoffload for Intel MIC

2015-09-28 Thread Bernd Schmidt
On 09/28/2015 01:25 PM, Ilya Verbin wrote: On Mon, Sep 28, 2015 at 12:09:19 +0200, Bernd Schmidt wrote: On 09/28/2015 12:03 PM, Bernd Schmidt wrote: On 09/28/2015 10:26 AM, Thomas Schwinge wrote: - objcopy_argv[8] = NULL; + objcopy_argv[objcopy_argc++] = NULL; + gcc_checking_assert (objcopy

Re: [PATCH 1/4] Add mkoffload for Intel MIC

2015-09-28 Thread Ilya Verbin
On Mon, Sep 28, 2015 at 12:09:19 +0200, Bernd Schmidt wrote: > On 09/28/2015 12:03 PM, Bernd Schmidt wrote: > >On 09/28/2015 10:26 AM, Thomas Schwinge wrote: > >>- objcopy_argv[8] = NULL; > >>+ objcopy_argv[objcopy_argc++] = NULL; > >>+ gcc_checking_assert (objcopy_argc <= OBJCOPY_ARGC_MAX); > >

Re: [PATCH 1/4] Add mkoffload for Intel MIC

2015-09-28 Thread Bernd Schmidt
On 09/28/2015 12:03 PM, Bernd Schmidt wrote: On 09/28/2015 10:26 AM, Thomas Schwinge wrote: - objcopy_argv[8] = NULL; + objcopy_argv[objcopy_argc++] = NULL; + gcc_checking_assert (objcopy_argc <= OBJCOPY_ARGC_MAX); On its own this is not an improvement - you're trading a compile time error

Re: [PATCH 1/4] Add mkoffload for Intel MIC

2015-09-28 Thread Bernd Schmidt
On 09/28/2015 10:26 AM, Thomas Schwinge wrote: - objcopy_argv[8] = NULL; + objcopy_argv[objcopy_argc++] = NULL; + gcc_checking_assert (objcopy_argc <= OBJCOPY_ARGC_MAX); On its own this is not an improvement - you're trading a compile time error for a runtime error. So, what is the other ch

Re: [PATCH 1/4] Add mkoffload for Intel MIC

2015-09-28 Thread Thomas Schwinge
Hi! On Wed, 22 Oct 2014 22:57:01 +0400, Ilya Verbin wrote: > On 22 Oct 09:57, Jakub Jelinek wrote: > > On Wed, Oct 22, 2014 at 02:30:44AM +0400, Ilya Verbin wrote: > > > + obstack_init (&argv_obstack); > > > + obstack_ptr_grow (&argv_obstack, "objcopy"); > > > + obstack_ptr_grow (&argv_obstack

Use gcc/coretypes.h:enum offload_abi in mkoffloads (was: [PATCH 1/4] Add mkoffload for Intel MIC)

2015-08-04 Thread Thomas Schwinge
Hi! On Thu, 8 Jan 2015 07:02:19 -0800, "H.J. Lu" wrote: > On Thu, Jan 8, 2015 at 6:59 AM, Thomas Schwinge > wrote: > > On Mon, 22 Dec 2014 12:28:20 +0100, Jakub Jelinek wrote: > >> On Mon, Dec 22, 2014 at 12:25:32PM +0100, Thomas Schwinge wrote: > >> > On Wed, 22 Oct 2014 22:57:01 +0400, Ilya

Re: [PATCH] Fix intelmic-mkoffload (was: [PATCH 1/4] Add mkoffload for Intel MIC)

2015-03-09 Thread Jakub Jelinek
On Fri, Mar 06, 2015 at 04:55:07PM +0300, Ilya Verbin wrote: > Hi, > > I've found a bug in intelmic-mkoffload, it works only when the path to gcc is > absolute or relative, but doesn't work when it's specified in the PATH env > var. > Here is the fix, I've got a piece of code from gcc/config/nvpt

[PATCH] Fix intelmic-mkoffload (was: [PATCH 1/4] Add mkoffload for Intel MIC)

2015-03-06 Thread Ilya Verbin
Hi, I've found a bug in intelmic-mkoffload, it works only when the path to gcc is absolute or relative, but doesn't work when it's specified in the PATH env var. Here is the fix, I've got a piece of code from gcc/config/nvptx/mkoffload.c. Regtested on x86_64-linux and i686-linux. Ok for trunk?

Re: [PATCH 1/4] Add mkoffload for Intel MIC

2015-02-18 Thread Jakub Jelinek
On Wed, Feb 18, 2015 at 12:48:21PM +0100, Thomas Schwinge wrote: > > --- /dev/null > > +++ b/gcc/config/i386/t-intelmic > > @@ -0,0 +1,9 @@ > > +mkoffload.o: $(srcdir)/config/i386/intelmic-mkoffload.c | insn-modes.h > > + $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ > > +

Re: [PATCH 1/4] Add mkoffload for Intel MIC

2015-02-18 Thread Ilya Verbin
On Wed, Feb 18, 2015 at 12:48:21 +0100, Thomas Schwinge wrote: > What is the rationale for the insn-modes.h order-only prerequisites for > mkoffload.o? Is this simply to get past the build issue which, for > example, Jakub also reported for the nvptx mkoffload, >

Re: [PATCH 1/4] Add mkoffload for Intel MIC

2015-02-18 Thread Thomas Schwinge
Hi! On Wed, 22 Oct 2014 22:57:01 +0400, Ilya Verbin wrote: > --- /dev/null > +++ b/gcc/config/i386/intelmic-mkoffload.c > +[...] > +#include "config.h" > +#include > +#include "system.h" > +#include "coretypes.h" > +#include "obstack.h" > +#include "intl.h" > +#include "diagnostic.h" > +#include

Re: OMP builtins in offloading (was: [PATCH 1/4] Add mkoffload for Intel MIC)

2015-02-16 Thread Ilya Verbin
On Thu, Jan 08, 2015 at 16:49:40 +0100, Jakub Jelinek wrote: > BTW, today when looking at the TARGET_OPTION_NODE streaming caused > regressions, I've discovered that it is very hard to debug issues in the > offloading compiler. Would be nice if > -save-temps -v > printed enough information that it

Re: OMP builtins in offloading (was: [PATCH 1/4] Add mkoffload for Intel MIC)

2015-01-09 Thread Jakub Jelinek
On Fri, Jan 09, 2015 at 11:36:54AM +0100, Richard Biener wrote: > Maybe pass it through if you specify -Wl,-debug -v -save-temps > (that also makes sure to disable collect2s error output buffering > which is annoying with LTO) Works with me too (but should be documented somewhere). Jakub

Re: OMP builtins in offloading (was: [PATCH 1/4] Add mkoffload for Intel MIC)

2015-01-09 Thread Richard Biener
On Thu, Jan 8, 2015 at 5:39 PM, Jakub Jelinek wrote: > On Thu, Jan 08, 2015 at 07:32:13PM +0300, Ilya Verbin wrote: >> On 08 Jan 16:49, Jakub Jelinek wrote: >> > BTW, today when looking at the TARGET_OPTION_NODE streaming caused >> > regressions, I've discovered that it is very hard to debug issue

Re: OMP builtins in offloading (was: [PATCH 1/4] Add mkoffload for Intel MIC)

2015-01-08 Thread Jakub Jelinek
On Thu, Jan 08, 2015 at 07:32:13PM +0300, Ilya Verbin wrote: > On 08 Jan 16:49, Jakub Jelinek wrote: > > BTW, today when looking at the TARGET_OPTION_NODE streaming caused > > regressions, I've discovered that it is very hard to debug issues in the > > offloading compiler. Would be nice if > > -sa

Re: OMP builtins in offloading (was: [PATCH 1/4] Add mkoffload for Intel MIC)

2015-01-08 Thread Ilya Verbin
On 08 Jan 16:49, Jakub Jelinek wrote: > BTW, today when looking at the TARGET_OPTION_NODE streaming caused > regressions, I've discovered that it is very hard to debug issues in the > offloading compiler. Would be nice if > -save-temps -v > printed enough information that it is actually possible t

Re: [PATCH 1/4] Add mkoffload for Intel MIC

2015-01-08 Thread Thomas Schwinge
Hi! On Thu, 8 Jan 2015 07:02:19 -0800, "H.J. Lu" wrote: > On Thu, Jan 8, 2015 at 6:59 AM, Thomas Schwinge > wrote: > > commit c049b358f961f72d0c0cf61a707e9a5855b12b28 > > Author: tschwinge > > Date: Thu Jan 8 14:58:45 2015 + > > > > intelmic-mkoffload: Deal with linker defaulting to

Re: OMP builtins in offloading (was: [PATCH 1/4] Add mkoffload for Intel MIC)

2015-01-08 Thread Jakub Jelinek
Hi! On Thu, Jan 08, 2015 at 04:41:50PM +0100, Thomas Schwinge wrote: > On Fri, 26 Dec 2014 16:22:43 +0300, Ilya Verbin wrote: BTW, today when looking at the TARGET_OPTION_NODE streaming caused regressions, I've discovered that it is very hard to debug issues in the offloading compiler. Would be

Re: OMP builtins in offloading (was: [PATCH 1/4] Add mkoffload for Intel MIC)

2015-01-08 Thread Thomas Schwinge
Hi! On Fri, 26 Dec 2014 16:22:43 +0300, Ilya Verbin wrote: > On 22 Dec 12:26, Jakub Jelinek wrote: > > On Mon, Dec 22, 2014 at 12:20:58PM +0100, Thomas Schwinge wrote: > > > What is the reason that you're adding -fopenmp here? I assume it is that > > > otherwise you'd get tree streaming errors b

Re: [PATCH 1/4] Add mkoffload for Intel MIC

2015-01-08 Thread H.J. Lu
On Thu, Jan 8, 2015 at 6:59 AM, Thomas Schwinge wrote: > Hi! > > On Mon, 22 Dec 2014 12:28:20 +0100, Jakub Jelinek wrote: >> On Mon, Dec 22, 2014 at 12:25:32PM +0100, Thomas Schwinge wrote: >> > On Wed, 22 Oct 2014 22:57:01 +0400, Ilya Verbin wrote: >> > > --- /dev/null >> > > +++ b/gcc/config/i

Re: [PATCH 1/4] Add mkoffload for Intel MIC

2015-01-08 Thread Thomas Schwinge
Hi! On Mon, 22 Dec 2014 12:28:20 +0100, Jakub Jelinek wrote: > On Mon, Dec 22, 2014 at 12:25:32PM +0100, Thomas Schwinge wrote: > > On Wed, 22 Oct 2014 22:57:01 +0400, Ilya Verbin wrote: > > > --- /dev/null > > > +++ b/gcc/config/i386/intelmic-mkoffload.c > > > @@ -0,0 +1,541 @@ > > > +/* Offloa

Re: OMP builtins in offloading (was: [PATCH 1/4] Add mkoffload for Intel MIC)

2014-12-26 Thread Ilya Verbin
On 22 Dec 12:26, Jakub Jelinek wrote: > On Mon, Dec 22, 2014 at 12:20:58PM +0100, Thomas Schwinge wrote: > > What is the reason that you're adding -fopenmp here? I assume it is that > > otherwise you'd get tree streaming errors because of different builtins > > configurations, like this? > > > >

Re: [PATCH 1/4] Add mkoffload for Intel MIC

2014-12-22 Thread Jakub Jelinek
On Mon, Dec 22, 2014 at 12:25:32PM +0100, Thomas Schwinge wrote: > Hi! > > On Wed, 22 Oct 2014 22:57:01 +0400, Ilya Verbin wrote: > > --- /dev/null > > +++ b/gcc/config/i386/intelmic-mkoffload.c > > @@ -0,0 +1,541 @@ > > +/* Offload image generation tool for Intel MIC devices. > > > +/* Shows if

Re: OMP builtins in offloading (was: [PATCH 1/4] Add mkoffload for Intel MIC)

2014-12-22 Thread Jakub Jelinek
On Mon, Dec 22, 2014 at 12:20:58PM +0100, Thomas Schwinge wrote: > On Wed, 22 Oct 2014 22:57:01 +0400, Ilya Verbin wrote: > > --- /dev/null > > +++ b/gcc/config/i386/intelmic-mkoffload.c > > @@ -0,0 +1,541 @@ > > +/* Offload image generation tool for Intel MIC devices. > > > +static const char *

Re: [PATCH 1/4] Add mkoffload for Intel MIC

2014-12-22 Thread Thomas Schwinge
Hi! On Wed, 22 Oct 2014 22:57:01 +0400, Ilya Verbin wrote: > --- /dev/null > +++ b/gcc/config/i386/intelmic-mkoffload.c > @@ -0,0 +1,541 @@ > +/* Offload image generation tool for Intel MIC devices. > +/* Shows if we should compile binaries for i386 instead of x86-64. */ > +bool target_ilp32 =

OMP builtins in offloading (was: [PATCH 1/4] Add mkoffload for Intel MIC)

2014-12-22 Thread Thomas Schwinge
Hi! On Wed, 22 Oct 2014 22:57:01 +0400, Ilya Verbin wrote: > --- /dev/null > +++ b/gcc/config/i386/intelmic-mkoffload.c > @@ -0,0 +1,541 @@ > +/* Offload image generation tool for Intel MIC devices. > +static const char * > +prepare_target_image (const char *target_compiler, int argc, char **arg

Re: [PATCH 1/4] Add mkoffload for Intel MIC

2014-11-06 Thread Jakub Jelinek
On Wed, Oct 22, 2014 at 10:57:01PM +0400, Ilya Verbin wrote: > gcc/ > * config.gcc (*-intelmic-* | *-intelmicemul-*): Add i386/t-intelmic to > tmake_file. > (i[34567]86-*-* | x86_64-*-*): Build mkoffload$(exeext) with the > accelerator compiler. > * config/i386/intelmi

Re: [PATCH 1/4] Add mkoffload for Intel MIC

2014-10-22 Thread Ilya Verbin
On 22 Oct 09:57, Jakub Jelinek wrote: > On Wed, Oct 22, 2014 at 02:30:44AM +0400, Ilya Verbin wrote: > > This mkoffload is expected to be built only with the offload compiler, > > which is expected to be configured with > > '--enable-as-accelerator-for=... --host=x86_64-*-linux-gnu > > --target=x86

Re: [PATCH 1/4] Add mkoffload for Intel MIC

2014-10-22 Thread Jakub Jelinek
On Tue, Oct 21, 2014 at 09:16:02PM +0400, Ilya Verbin wrote: > --- a/gcc/Makefile.in > +++ b/gcc/Makefile.in > @@ -3895,3 +3895,14 @@ DEPFILES = \ >$(foreach obj,$(ALL_HOST_OBJS),\ > $(dir $(obj))$(DEPDIR)/$(patsubst %.o,%.Po,$(notdir $(obj > -include $(DEPFILES) > + > + > +mkoffload.

Re: [PATCH 1/4] Add mkoffload for Intel MIC

2014-10-22 Thread Jakub Jelinek
On Wed, Oct 22, 2014 at 02:30:44AM +0400, Ilya Verbin wrote: > > I don't see anything restricting this program to being built for GNU > > *hosts*. Thus, it needs to be portable (to different hosts; obviously > > it's target-architecture-specific) rather than relying on glibc > > interfaces. (Prov

Re: [PATCH 1/4] Add mkoffload for Intel MIC

2014-10-21 Thread Ilya Verbin
2014-10-22 1:55 GMT+04:00 Joseph S. Myers : > On Tue, 21 Oct 2014, Ilya Verbin wrote: > >> +#include >> +#include "config.h" >> +#include "system.h" > > You should never include system headers before config.h because config.h > may define feature test macros such as _FILE_OFFSET_BITS=64 that are >

Re: [PATCH 1/4] Add mkoffload for Intel MIC

2014-10-21 Thread Joseph S. Myers
On Tue, 21 Oct 2014, Ilya Verbin wrote: > +#include > +#include "config.h" > +#include "system.h" You should never include system headers before config.h because config.h may define feature test macros such as _FILE_OFFSET_BITS=64 that are ineffective if defined after any system header is incl

[PATCH 1/4] Add mkoffload for Intel MIC

2014-10-21 Thread Ilya Verbin
Hello, This patch contains mkoffload tool and the appropriate changes for makefiles. mkoffload is executed by lto-wrapper. It runs offload compiler, which produces a dynamic shared library for MIC (so far, it requires offload compiler to be installed). Then mkoffload copies the DSO into a new o