Re: GSoc-2015: Modular GCC

2015-03-05 Thread Trevor Saunders
On Thu, Mar 05, 2015 at 12:43:49AM +0530, Sidharth Chaturvedi wrote:
> Hi,
> 
> I came across this page while browsing through ideas for GSoc-2015:
> 
> https://gcc.gnu.org/wiki/ModularGCC
> 
> I like the overall task, but it seems somewhat overambitious. I wanted
> to verify if this is still a desirable architectural goal (as the last
> update on this page was around 3 years ago). Also, how feasible is
> this for GSoc?

I'd say it is desirable, various people are working on various bits of
it, and hopefully some of them will add there $0.02.  I would agree
doing everything on that page is completely unrealistic.  I'd encourage
you to pick a sub area you'd be interested in and see if someone wants
to mentor that.  Personally I'd really like to see someone take up
making intermediate representations more machine streamable.  There's
already machinary to print most data, but its not in a machine readable
form.

Trev

> 
> -- 
> Regards
> Sidharth Chaturvedi


Re: SPIR-V and GCC

2015-03-05 Thread Xerxes Rånby

On Wed, 2015-03-04 at 16:20 +, BogDan wrote:
> On Wednesday, March 4, 2015 5:22 PM, David Malcolm  
wrote:
> On Wed, 2015-03-04 at 14:36 +, BogDan wrote:
> > Hello folks,
> >
> >
> > Probably is a little bit too early, but I'd like to ask if there is
> > any chance to use gcc to produce SPIR-V [1].
> > It will be just great if we'll be able to write our shaders in e.g.
> > C/C++/(any language supported by gcc) and use GCC to compile them as
> > SPIR-V!
> > It will be fantastic to use only one compiler collection for CPU and
> > for GPU compute&graphics!
> >
> > Cheers,
> >
> > BogDan.
> > [1]https://www.khronos.org/registry/spir-v/
>
> I work on gcc, but in a former life I was a game developer [1], so this
> piqued my interest :)

...


> SPIR-V it's an Intermediate Language binary format. First versions were
> based on LLVM. SPIR-V has nothing to do with the old SPIR implementations,
> but for some reason khronos decide to keep the name :)
> Thishttp://www.g-truc.net/post-0714.html  great article explans better
> what SPIR-V is.

(nods); thanks.

> (B) Are you thinking about this for primarly ahead-of-time
> compilation, or are you interested in just-in-time compilation to
> SPIR-V? I ask since I maintain the new "libgccjit" feature in GCC 5.
> One of the current assumptions in libgccjit is that host==target, but I
> hope to relax that for gcc 6 so that libgccjit could e.g. generate code
> for a GPU. Another gcc 6 possibility could be multi-target support for
> libgccjit, so that you can populate a gcc_jit_context with code, then
> have it generate machine code for both the CPU and for the GPU (mostly
> just thinking aloud here).

> Even though most of the people will use it for ahead-of-time compilation,
> but IMHO it can be both!

Another use-case that occurred to me when I was looking at the link you
posted above: using gcc for optimizing SPIR-V and compiling it e.g. to
CPU code.

As of gcc 5, libgccjit can be hooked up to a pre-existing language
frontend, with the gcc backend emitting machine code for the CPU,
assuming that the frontend is license-compatible with libgccjit's
GPLv3-or-later.  See this example, which uses libgccjit to build a
compiler for brainf**k:
  https://gcc.gnu.org/onlinedocs/jit/intro/tutorial05.html

So if there's a SPIR-V loader library that's license-compatible, you
could write code to inject SPIR-V into libgccjit, and call
gcc_jit_context_compile_to_file on it to optimize it and turn it into
machine code.


Johann Sorel has written a SPIR-v binary reader and writer with a compatible 
license (public domain).
https://bitbucket.org/Eclesia/unlicense/src/tip/compiler/compiler-spir/src/main/java/un/language/spir/?at=default

To quote Johann Sorel: "it's public domain, copy what you need ;)"
https://jogamp.org/bugzilla/show_bug.cgi?id=1140#c2

These SPIR-v classes is to my knowledge the first public SPIR-v reader and 
writer with a free software compatible license.
You can use the GCC GCJ project and Johann Sorel's Java classes that gives you 
all SPIR-v spec constants in machine readable form
and a SPIR-v binary parser and writer as a foundation to create your SPIR-v 
compiler & assembler.

Cheers
Xerxes





[PATCH, committed] jit documentation fixes

2015-03-05 Thread David Malcolm
On Thu, 2015-03-05 at 07:37 +0100, Bert Wesarg wrote:
> Hi David,
> 
> while reading the very good tutorial at
> 
> https://gcc.gnu.org/onlinedocs/jit/intro/tutorial03.html
> 
> I noticed that the calls to  gcc_jit_block_end_with_conditional()
> misses the on_true and on_false parameters.

Good catch, thanks!

This also affected the corresponding docs for the C++ bindings, and I
noticed a few other issues whilst re-reading the docs, so I've
committed the following patch to trunk (as r221218).

Dave

gcc/jit/ChangeLog:
* docs/cp/intro/tutorial03.rst: Add missing arguments to
gccjit::block::end_with_conditional call.  Add on_true/on_false
comments.  Tweak the wording.
* docs/intro/tutorial03.rst: Add missing arguments to
gcc_jit_block_end_with_conditional call.  Add some clarifying
comments.
* docs/topics/compilation.rst: Tweak the wording to avoid an
ambiguous use of "this".
* docs/topics/contexts.rst: Fix a typo.
* docs/topics/expressions.rst (GCC_JIT_BINARY_OP_MINUS): Remove
a stray backtick.
---
 gcc/jit/docs/cp/intro/tutorial03.rst | 10 ++
 gcc/jit/docs/intro/tutorial03.rst| 12 +++-
 gcc/jit/docs/topics/compilation.rst  |  2 +-
 gcc/jit/docs/topics/contexts.rst |  2 +-
 gcc/jit/docs/topics/expressions.rst  |  2 +-
 5 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/gcc/jit/docs/cp/intro/tutorial03.rst 
b/gcc/jit/docs/cp/intro/tutorial03.rst
index aac781d..f4405ad 100644
--- a/gcc/jit/docs/cp/intro/tutorial03.rst
+++ b/gcc/jit/docs/cp/intro/tutorial03.rst
@@ -238,7 +238,9 @@ and can then use this to add `b_loop_cond`'s sole 
statement, via
 
 .. code-block:: c++
 
-  b_loop_cond.end_with_conditional (guard);
+  b_loop_cond.end_with_conditional (guard,
+b_after_loop, // on_true
+b_loop_body); // on_false
 
 However :type:`gccjit::rvalue` has overloaded operators for this, so we
 express the conditional as
@@ -247,14 +249,14 @@ express the conditional as
 
gccjit::rvalue guard = (i >= n);
 
-and hence write the block more concisely as:
+and hence we can write the block more concisely as:
 
 .. code-block:: c++
 
   b_loop_cond.end_with_conditional (
 i >= n,
-b_after_loop,
-b_loop_body);
+b_after_loop, // on_true
+b_loop_body); // on_false
 
 Next, we populate the body of the loop.
 
diff --git a/gcc/jit/docs/intro/tutorial03.rst 
b/gcc/jit/docs/intro/tutorial03.rst
index cd7136a..6c1ca3e 100644
--- a/gcc/jit/docs/intro/tutorial03.rst
+++ b/gcc/jit/docs/intro/tutorial03.rst
@@ -229,6 +229,7 @@ We build the comparison using 
:c:func:`gcc_jit_context_new_comparison`:
 
 .. code-block:: c
 
+  /* (i >= n) */
gcc_jit_rvalue *guard =
  gcc_jit_context_new_comparison (
ctxt, NULL,
@@ -241,7 +242,16 @@ and can then use this to add `b_loop_cond`'s sole 
statement, via
 
 .. code-block:: c
 
-  gcc_jit_block_end_with_conditional (b_loop_cond, NULL, guard);
+  /* Equivalent to:
+   if (guard)
+ goto after_loop;
+   else
+ goto loop_body;  */
+  gcc_jit_block_end_with_conditional (
+b_loop_cond, NULL,
+guard,
+b_after_loop, /* on_true */
+b_loop_body); /* on_false */
 
 Next, we populate the body of the loop.
 
diff --git a/gcc/jit/docs/topics/compilation.rst 
b/gcc/jit/docs/topics/compilation.rst
index 708d009..4eddf76 100644
--- a/gcc/jit/docs/topics/compilation.rst
+++ b/gcc/jit/docs/topics/compilation.rst
@@ -37,7 +37,7 @@ In-memory compilation
This calls into GCC and builds the code, returning a
`gcc_jit_result *`.
 
-   If this is non-NULL, the caller becomes responsible for
+   If the result is non-NULL, the caller becomes responsible for
calling :func:`gcc_jit_result_release` on it once they're done
with it.
 
diff --git a/gcc/jit/docs/topics/contexts.rst b/gcc/jit/docs/topics/contexts.rst
index 46a08bd..b7f281a 100644
--- a/gcc/jit/docs/topics/contexts.rst
+++ b/gcc/jit/docs/topics/contexts.rst
@@ -138,7 +138,7 @@ be responsible for all of the rest:
If no errors occurred, this will be NULL.
 
 If you are wrapping the C API for a higher-level language that supports
-exception-handling, you may instead by interested in the last error that
+exception-handling, you may instead be interested in the last error that
 occurred on the context, so that you can embed this in an exception:
 
 .. function:: const char *\
diff --git a/gcc/jit/docs/topics/expressions.rst 
b/gcc/jit/docs/topics/expressions.rst
index 1cedb66..49317b9 100644
--- a/gcc/jit/docs/topics/expressions.rst
+++ b/gcc/jit/docs/topics/expressions.rst
@@ -233,7 +233,7 @@ Binary Operation  C equivalent
 
For pointer addition, use :c:func:`gcc_jit_context_new_array_access`.
 
-.. c:macro:: GCC_JIT_BINARY_OP_MINUS`
+.. c:macro:: GCC_JIT_BINARY_OP_MINUS
 
Subtraction of arithmetic values; analogous to:
 
-- 
1.8.5.3



Re: GSoc-2015: Modular GCC

2015-03-05 Thread Jeff Law

On 03/04/15 12:13, Sidharth Chaturvedi wrote:

Hi,

I came across this page while browsing through ideas for GSoc-2015:

https://gcc.gnu.org/wiki/ModularGCC

I like the overall task, but it seems somewhat overambitious. I wanted
to verify if this is still a desirable architectural goal (as the last
update on this page was around 3 years ago). Also, how feasible is
this for GSoc?
Certainly still useful, the trick is finding a hunk of that work that 
can be tackled via GSoc.


jeff



Re: SPIR-V and GCC

2015-03-05 Thread David Malcolm
On Thu, 2015-03-05 at 12:27 +0100, Xerxes Rånby wrote:
> > On Wed, 2015-03-04 at 16:20 +, BogDan wrote:
> > > On Wednesday, March 4, 2015 5:22 PM, David Malcolm  
> > > wrote:
> > > On Wed, 2015-03-04 at 14:36 +, BogDan wrote:
> > > > Hello folks,
> > > >
> > > >
> > > > Probably is a little bit too early, but I'd like to ask if there is
> > > > any chance to use gcc to produce SPIR-V [1].
> > > > It will be just great if we'll be able to write our shaders in e.g.
> > > > C/C++/(any language supported by gcc) and use GCC to compile them as
> > > > SPIR-V!
> > > > It will be fantastic to use only one compiler collection for CPU and
> > > > for GPU compute&graphics!
> > > >
> > > > Cheers,
> > > >
> > > > BogDan.
> > > > [1]https://www.khronos.org/registry/spir-v/
> > >
> > > I work on gcc, but in a former life I was a game developer [1], so this
> > > piqued my interest :)
> ...
> >
> > > SPIR-V it's an Intermediate Language binary format. First versions were
> > > based on LLVM. SPIR-V has nothing to do with the old SPIR implementations,
> > > but for some reason khronos decide to keep the name :)
> > > Thishttp://www.g-truc.net/post-0714.html  great article explans better
> > > what SPIR-V is.
> >
> > (nods); thanks.
> >
> > > (B) Are you thinking about this for primarly ahead-of-time
> > > compilation, or are you interested in just-in-time compilation to
> > > SPIR-V? I ask since I maintain the new "libgccjit" feature in GCC 5.
> > > One of the current assumptions in libgccjit is that host==target, but I
> > > hope to relax that for gcc 6 so that libgccjit could e.g. generate code
> > > for a GPU. Another gcc 6 possibility could be multi-target support for
> > > libgccjit, so that you can populate a gcc_jit_context with code, then
> > > have it generate machine code for both the CPU and for the GPU (mostly
> > > just thinking aloud here).
> >
> > > Even though most of the people will use it for ahead-of-time compilation,
> > > but IMHO it can be both!
> >
> > Another use-case that occurred to me when I was looking at the link you
> > posted above: using gcc for optimizing SPIR-V and compiling it e.g. to
> > CPU code.
> >
> > As of gcc 5, libgccjit can be hooked up to a pre-existing language
> > frontend, with the gcc backend emitting machine code for the CPU,
> > assuming that the frontend is license-compatible with libgccjit's
> > GPLv3-or-later.  See this example, which uses libgccjit to build a
> > compiler for brainf**k:
> >   https://gcc.gnu.org/onlinedocs/jit/intro/tutorial05.html
> >
> > So if there's a SPIR-V loader library that's license-compatible, you
> > could write code to inject SPIR-V into libgccjit, and call
> > gcc_jit_context_compile_to_file on it to optimize it and turn it into
> > machine code.
> >
> Johann Sorel has written a SPIR-v binary reader and writer with a compatible 
> license (public domain).
> https://bitbucket.org/Eclesia/unlicense/src/tip/compiler/compiler-spir/src/main/java/un/language/spir/?at=default
> 
> To quote Johann Sorel: "it's public domain, copy what you need ;)"
> https://jogamp.org/bugzilla/show_bug.cgi?id=1140#c2
> 
> These SPIR-v classes is to my knowledge the first public SPIR-v reader and 
> writer with a free software compatible license.
> You can use the GCC GCJ project and Johann Sorel's Java classes that gives 
> you all SPIR-v spec constants in machine readable form
> and a SPIR-v binary parser and writer as a foundation to create your SPIR-v 
> compiler & assembler.

Thanks.

FWIW, we don't yet have java bindings for libgccjit.  Writing java
bindings would be a non-trivial project, but probably not too hard for a
java expert (perhaps suitable as a GSoC project, if anyone's
interested?).

Dave



Re: GSoc-2015: Modular GCC

2015-03-05 Thread Sidharth Chaturvedi
I like the idea of making the intermediate representations more
streamable. But I think this task should also involve creating
separate front-end and middle-end modules, as then there can be a
clear distinction of what IR is an input to a module and what IR is
output from a module(including a more specific structure to each IR).
This would give a pipeline structure to GCC. I don't know how much of
this can be achieved via GSoc, but I would still like to give it a
try. Any interested mentors? Thanks.

Sidharth

On Thu, Mar 5, 2015 at 3:59 PM, Trevor Saunders  wrote:
> On Thu, Mar 05, 2015 at 12:43:49AM +0530, Sidharth Chaturvedi wrote:
>> Hi,
>>
>> I came across this page while browsing through ideas for GSoc-2015:
>>
>> https://gcc.gnu.org/wiki/ModularGCC
>>
>> I like the overall task, but it seems somewhat overambitious. I wanted
>> to verify if this is still a desirable architectural goal (as the last
>> update on this page was around 3 years ago). Also, how feasible is
>> this for GSoc?
>
> I'd say it is desirable, various people are working on various bits of
> it, and hopefully some of them will add there $0.02.  I would agree
> doing everything on that page is completely unrealistic.  I'd encourage
> you to pick a sub area you'd be interested in and see if someone wants
> to mentor that.  Personally I'd really like to see someone take up
> making intermediate representations more machine streamable.  There's
> already machinary to print most data, but its not in a machine readable
> form.
>
> Trev
>
>>
>> --
>> Regards
>> Sidharth Chaturvedi



-- 
Regards
Sidharth Chaturvedi


Re: Listing a maintainer for libcilkrts, and GCC's Cilk Plus implementation generally?

2015-03-05 Thread Jeff Law

On 02/23/15 14:41, H.J. Lu wrote:

On Mon, Sep 29, 2014 at 4:00 AM, Jakub Jelinek  wrote:

On Mon, Sep 29, 2014 at 12:56:06PM +0200, Thomas Schwinge wrote:

Hi!

On Tue, 23 Sep 2014 11:02:30 +, "Zamyatin, Igor"  
wrote:

Jeff Law wrote:

The original plan was for Balaji to take on this role; however, his assignment
within Intel has changed and thus he's not going to have time to work on
Cilk+ anymore.

Igor Zamyatin has been doing a fair amount of Cilk+ maintenance/bugfixing
and it might make sense for him to own it in the long term if he's interested.


That's right.


Thanks!


Can I add 2 records (cilk plus and libcilkrts) to Various Maintainers section?


I understand Jeff's email as a pre-approval of such a patch.


I think only SC can appoint maintainers, and while Jeff is in the SC,
my reading of that mail wasn't that it was the SC that has acked that, but
rather a question if Igor is willing to take that role, which then would
need to be acked by SC.



Where are we on this?  Do we have a maintainer for Cilk Plus
and its run-time library?
Not at this time.  There was a bit of blockage on various things with 
the steering committee (who approves maintainers).  I've got a 
half-dozen or so proposals queued (including Cilk maintainership).


Jeff



gcc-4.8-20150305 is now available

2015-03-05 Thread gccadmin
Snapshot gcc-4.8-20150305 is now available on
  ftp://gcc.gnu.org/pub/gcc/snapshots/4.8-20150305/
and on various mirrors, see http://gcc.gnu.org/mirrors.html for details.

This snapshot has been generated from the GCC 4.8 SVN branch
with the following options: svn://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch 
revision 221226

You'll find:

 gcc-4.8-20150305.tar.bz2 Complete GCC

  MD5=f2fe9b624ab34d2b729e9213d105f16d
  SHA1=163bd989d529028155ee83a3f5f5afc48d68b371

Diffs from 4.8-20150226 are available in the diffs/ subdirectory.

When a particular snapshot is ready for public consumption the LATEST-4.8
link is updated and a message is sent to the gcc list.  Please do not use
a snapshot before it has been announced that way.


bfin fails to build on 4.9 but builds on head

2015-03-05 Thread Joel Sherrill
Hi

Anyone happen to know what patch might need to be backported?
I didn't see a PR I have filed on this but someone might know.

 -c ../../../gcc-4.9-branch/libgcc/fp-bit.c -fvisibility=hidden
-DHIDE_EXPORTS
../../../gcc-4.9-branch/libgcc/fp-bit.c: In function '__divsf3':
../../../gcc-4.9-branch/libgcc/fp-bit.c:1082:1: internal compiler error:
in cfg_layout_initialize, at cfgrtl.c:4249
 }
 ^
0x4f0f82 cfg_layout_initialize(unsigned int)
../../gcc-4.9-branch/gcc/cfgrtl.c:4249
0x9bc661 reorder_loops
../../gcc-4.9-branch/gcc/hw-doloop.c:500
0x9bc661 reorg_loops(bool, hw_doloop_hooks*)
../../gcc-4.9-branch/gcc/hw-doloop.c:641
0x93b02e bfin_reorg_loops
../../gcc-4.9-branch/gcc/config/bfin/bfin.c:3888
0x93b02e bfin_reorg
../../gcc-4.9-branch/gcc/config/bfin/bfin.c:4630
0x7120a9 rest_of_handle_machine_reorg
../../gcc-4.9-branch/gcc/reorg.c:3936
0x7120a9 execute
../../gcc-4.9-branch/gcc/reorg.c:3966
Please submit a full bug report,

-- 
Joel Sherrill, Ph.D. Director of Research & Development
joel.sherr...@oarcorp.comOn-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available(256) 722-9985



Re: Listing a maintainer for libcilkrts, and GCC's Cilk Plus implementation generally?

2015-03-05 Thread Thomas Schwinge
Hi!

On Thu, 5 Mar 2015 13:39:44 -0700, Jeff Law  wrote:
> On 02/23/15 14:41, H.J. Lu wrote:
> > On Mon, Sep 29, 2014 at 4:00 AM, Jakub Jelinek  wrote:
> >> On Mon, Sep 29, 2014 at 12:56:06PM +0200, Thomas Schwinge wrote:
> >>> On Tue, 23 Sep 2014 11:02:30 +, "Zamyatin, Igor" 
> >>>  wrote:
>  Jeff Law wrote:
> > The original plan was for Balaji to take on this role; however, his 
> > assignment
> > within Intel has changed and thus he's not going to have time to work on
> > Cilk+ anymore.
> >
> > Igor Zamyatin has been doing a fair amount of Cilk+ 
> > maintenance/bugfixing
> > and it might make sense for him to own it in the long term if he's 
> > interested.
> 
>  That's right.
> >>>
> >>> Thanks!
> >>>
>  Can I add 2 records (cilk plus and libcilkrts) to Various Maintainers 
>  section?
> >>>
> >>> I understand Jeff's email as a pre-approval of such a patch.
> >>
> >> I think only SC can appoint maintainers, and while Jeff is in the SC,
> >> my reading of that mail wasn't that it was the SC that has acked that, but
> >> rather a question if Igor is willing to take that role, which then would
> >> need to be acked by SC.
> >
> > Where are we on this?  Do we have a maintainer for Cilk Plus
> > and its run-time library?
> Not at this time.  There was a bit of blockage on various things with 
> the steering committee (who approves maintainers).  I've got a 
> half-dozen or so proposals queued (including Cilk maintainership).

What's the process then, that I get my Cilk Plus (libcilkrts) portability
patches committed to GCC?  I was advisd this must be routed through Intel
(Barry M Tannenbaum CCed), which I have done months ago: I submitted the
patches to Intel, and -- as I understood it -- Barry and I seemed to
agree about them (at least I don't remember any requests for changes to
be made on my side), but I have not seen a merge from Intel to update
GCC's libcilkrts.  Should I now commit to GCC the pending patches,

and following?


Grüße,
 Thomas


pgptiHSNiVrwS.pgp
Description: PGP signature


Re: GSoc-2015: Modular GCC

2015-03-05 Thread Trevor Saunders
On Fri, Mar 06, 2015 at 12:21:58AM +0530, Sidharth Chaturvedi wrote:
> I like the idea of making the intermediate representations more
> streamable. But I think this task should also involve creating
> separate front-end and middle-end modules, as then there can be a
> clear distinction of what IR is an input to a module and what IR is
> output from a module(including a more specific structure to each IR).

making the front / middle ends more modular is certainly also a worth
while activity, but I'd advise against merging the issues.  They are
each fairly big projects on there own, and its much better to check in
patches that solve one small part of the problem than to have a half way
working patch to fix everything.

> This would give a pipeline structure to GCC. I don't know how much of
> this can be achieved via GSoc, but I would still like to give it a
> try. Any interested mentors? Thanks.

I can help some, but I don't think I am qualified to mentor, or can
commit to spending the time saddly.

Trev

> 
> Sidharth
> 
> On Thu, Mar 5, 2015 at 3:59 PM, Trevor Saunders  wrote:
> > On Thu, Mar 05, 2015 at 12:43:49AM +0530, Sidharth Chaturvedi wrote:
> >> Hi,
> >>
> >> I came across this page while browsing through ideas for GSoc-2015:
> >>
> >> https://gcc.gnu.org/wiki/ModularGCC
> >>
> >> I like the overall task, but it seems somewhat overambitious. I wanted
> >> to verify if this is still a desirable architectural goal (as the last
> >> update on this page was around 3 years ago). Also, how feasible is
> >> this for GSoc?
> >
> > I'd say it is desirable, various people are working on various bits of
> > it, and hopefully some of them will add there $0.02.  I would agree
> > doing everything on that page is completely unrealistic.  I'd encourage
> > you to pick a sub area you'd be interested in and see if someone wants
> > to mentor that.  Personally I'd really like to see someone take up
> > making intermediate representations more machine streamable.  There's
> > already machinary to print most data, but its not in a machine readable
> > form.
> >
> > Trev
> >
> >>
> >> --
> >> Regards
> >> Sidharth Chaturvedi
> 
> 
> 
> -- 
> Regards
> Sidharth Chaturvedi