Could you please clarify about GCC optimizations?

2014-08-08 Thread Evgeniya Maenkova
Dear GCC Developers!
May I ask you regarding how you make a decision whether implement some
optimization or not?
As far as I know, there are so many configurations (frontends x
backends x applications(benchmarks) x etc), that the same optimization
could improve performance in one configuration and degrade at other
conditions.
What performance tests do you perform before including an optimization
in GCC? How do you aggregate the results (taking into account
different behavior on different frontend/backend/benchmarks)?
Excuse me, if some information is available in GCC documentation,
didn’t found so far.

Thank you!
Evgeniya


GIMPLE optimization passes: any Road Map?

2014-08-08 Thread Evgeniya Maenkova
Dear GCC Developers!

Could you please clarify about GIMPLE loop passes?

Where could I find the latest changes in these passes? Is it trunk or
some of the branches? May I look at some RoadMap on GIMPLE loop
optimizations?

Actually, I ask these questions because I would like to contribute to
GCC. GIMPLE optimizations would be interesting to me (in particular,
loop optimizations).

However, I’m newbie at GCC and have not enough time, so would not
commit to manage a task which is on the critical path.

So it would be great if you could advise some tasks, which could be
useful to gcc in some future, however nobody will miss if I can’t do
it (as you had not time/people for these tasks anyway :) ).

Thank you!

Evgeniya

m


Re: Could you please clarify about GCC optimizations?

2014-08-12 Thread Evgeniya Maenkova
Got it. Thank you.

On Fri, Aug 8, 2014 at 11:07 PM, Jeff Law  wrote:
> On 08/08/14 06:18, Evgeniya Maenkova wrote:
>>
>> As far as I know, there are so many configurations (frontends x
>> backends x applications(benchmarks) x etc), that the same optimization
>> could improve performance in one configuration and degrade at other
>> conditions.
>
> Correct.
>
>
>> What performance tests do you perform before including an optimization
>> in GCC? How do you aggregate the results (taking into account
>> different behavior on different frontend/backend/benchmarks)?
>> Excuse me, if some information is available in GCC documentation,
>> didn’t found so far.
>
> Each developer makes their own determination as to what performance tests
> are appropriate to run and on what platforms to run those tests. Some rely
> largely on SPEC, others utilize large desktop applications such as firefox
> and others are more focused on EEMBC, etc.  It really depends on each
> developer's focus.
>
> In general optimizations on GIMPLE/SSA are in large designed to eliminate as
> much redundancy as possible independent of the target processor.  There are
> exceptions, but as a guiding principle that is correct.
>
> When GIMPLE is lowered to RTL, the expanders query the backend for a
> information to guide lowering to RTL in a target dependent way. Similarly
> the RTL optimizers are designed to query the backend for information to
> guide low level aspects of code generation and optimization.
>
> When optimizations are submitted for inclusion, there's a review process
> where the code reviewers may ask questions or ask for further benchmarks,
> etc.  The reviewers also use their experience to guide submissions in the
> right direction.
>
> So there's no single simple answer.  It varies based on many factors.
>
> jeff



-- 
Thanks,

Evgeniya

perfstories.wordpress.com


What are open tasks about GIMPLE loop optimizations?

2014-08-15 Thread Evgeniya Maenkova
Dear GCC Developers,

Nobody answers my question below, so perhaps something wrong with my email :)

So let me clarify in more details what I’m asking about.

I’ve made some very very very basic evaluation of GCC code ([1]) and
started to think about concrete task to contribute to GCC (language
and machine optimization would be interesting to me, in particular,
loop optimization).

I cannot invent this task myself because my knowledge of GCC and
compilers in general is not enough for this.  And even if I could
think out something perhaps GCC developers have their own
understanding of the world.

Then I have looked at GCC site to answer my question. What I could
find about loop optimizations is information from GNU Tools Cauldron
2012, “Status of High level Loop Optimizations”.  So perhaps this is
out-of-date in 2014.

Unfortunately, I have not enough time, so I would not commit to manage
a task which is on the critical task.  (Are you interested only in
full time developers?)

So it would be great if you could advise some tasks, which could be

useful to gcc in some future, however nobody will miss if I cannot do

it (as you had not time/people for these tasks anyway :) ).



What do you think?



Thanks,



Evgeniya



[1] Used GDB to look inside GCC. Wrote some notes in my blog which
could be useful to other newbies
(http://perfstories.wordpress.com/2013/11/17/compiler-internals-introduction-to-a-new-post-series/).




-- Forwarded message --
From: Evgeniya Maenkova 
Date: Fri, Aug 8, 2014 at 6:50 PM
Subject: GIMPLE optimization passes: any Road Map?
To: gcc@gcc.gnu.org


Dear GCC Developers!

Could you please clarify about GIMPLE loop passes?

Where could I find the latest changes in these passes? Is it trunk or
some of the branches? May I look at some RoadMap on GIMPLE loop
optimizations?

Actually, I ask these questions because I would like to contribute to
GCC. GIMPLE optimizations would be interesting to me (in particular,
loop optimizations).

However, I’m newbie at GCC and have not enough time, so would not
commit to manage a task which is on the critical path.

So it would be great if you could advise some tasks, which could be
useful to gcc in some future, however nobody will miss if I can’t do
it (as you had not time/people for these tasks anyway :) ).

Thank you!

Evgeniya


Re: What are open tasks about GIMPLE loop optimizations?

2014-08-20 Thread Evgeniya Maenkova
Dear Manuel and Ilya.

Thank you very much for you advices.

I'll take it into consideration.



Evgeniya



On Mon, Aug 18, 2014 at 3:46 PM, Manuel López-Ibáñez
 wrote:
> The wiki also contains the following: https://gcc.gnu.org/wiki/LoopOptTasks
>
> Probably very outdated, but updating it might be a helpful learning
> experience. Don't be afraid to edit the wiki, we can always revert
> your changes ;-)
>
> Cheers,
>
> Manuel.
>
>
> On 18 August 2014 13:43, Manuel López-Ibáñez  wrote:
>>> *From:* Evgeniya Maenkova 
>>> *Sent:* Friday, August 15, 2014 4:45PM
>>> *To:* gcc@gcc.gnu.org
>>> *Subject:* What are open tasks about GIMPLE loop optimizations?
>>>
>>> Dear GCC Developers,
>>>
>>> Nobody answers my question below, so perhaps something wrong with my email
>>> :)
>>>
>>
>> Starting as a newbie in GCC requires a lot of self-motivation. The
>> general answer to your question is to try. If something is wrong or
>> not what the GCC devs want, don't worry they will tell you.
>>
>> See also the general advice here on how to interact with the GCC
>> community: https://gcc.gnu.org/wiki/GCC_Research
>>
>> I would say your email falls into: "too long", "too general", "not
>> specific question", "not aimed at anyone in particular". :-)
>>
>> For newbie tasks, the Summer of Code page has many ideas, some of them
>> with specific contact persons: https://gcc.gnu.org/wiki/SummerOfCode
>>
>> See also the links under "Getting Started with GCC Development" at
>> https://gcc.gnu.org/wiki/
>>
>> And also https://gcc.gnu.org/wiki/ImprovementProjects
>>
>> I would suggest to start fixing bug in the areas that interest you. If
>> you search in GCC's bugzilla, there must be plenty of bugs about
>> anything you can imagine. Even if you don't fix it, analyzing it would
>> be already helpful for you (to learn how to debug GCC, modify it and
>> rebuild) and for us to save us time.
>>
>> Once you get enough knowledge, you will also get ideas of what
>> features are actually missing or could be improved.
>>
>> Cheers,
>>
>> Manuel.



-- 
Thanks,

Evgeniya

perfstories.wordpress.com


predicated code motion (in lim)

2014-10-10 Thread Evgeniya Maenkova
Hi,
could anyone clarify about predicated code motion in lim?

After reading a TODO in /tree-ssa-loop-im.c (see [1]) I tried several
examples, say [2]. However, in all of them the code was moved out of
the loop successfully (either by pre or by lim, as in [2]).

So my question is: what the author of this code did mean by
"predicated code motion"? (what is the TODO)

Thanks,

Evgeniya

[1]
TODO:  Support for predicated code motion.  I.e.

   while (1)
 {
   if (cond)
 {
   a = inv;
   something;
 }
 }

[2]

void foo(int cond, int inv)
{

int a;
int i = 0;
int j = 0;
while (j++ < 100) {
while (i++ < 2000)
 {
   if (j % 2)
{
a = 528*j;
printf("Hey1%d %d", a, i);//something;
 }
}

 }
}

lim:

;; Function foo (foo, funcdef_no=0, decl_uid=1394, cgraph_uid=0, symbol_order=0)

foo (int cond, int inv)
{
  int j;
  int i;
  int a;
  unsigned int j.0_12;
  unsigned int _13;
  unsigned int _18;
  unsigned int _21;

  :
  goto ;

  :
  if (_13 != 0)
goto ;
  else
goto ;

  :
  goto ;

  :
  printf ("Hey1%d %d", a_14, i_11);

  :

  :
  # i_1 = PHI 
  i_11 = i_1 + 1;
  if (i_1 <= 1999)
goto ;
  else
goto ;

  :
  # i_20 = PHI 
  j_9 = j_23 + 1;
  if (j_23 != 100)
goto ;
  else
goto ;

  :

  :
  # i_22 = PHI 
  # j_23 = PHI 
  j.0_12 = (unsigned int) j_23;
  _13 = j.0_12 & 1;
  _21 = (unsigned int) j_23;
  _18 = _21 * 528;
  a_14 = (int) _18;
  goto ;

  :
  return;

}


However, in loopinit (the optimization before lim) there was no motion
(So this was done by lim:
  :
  a_14 = j_23 * 528;
  printf ("Hey1%d %d", a_14, i_11);


Re: predicated code motion (in lim)

2014-10-10 Thread Evgeniya Maenkova
Got it, thanks.

(Now there are phi instead of if)

On Fri, Oct 10, 2014 at 6:18 PM, Richard Biener
 wrote:
> On Fri, Oct 10, 2014 at 3:44 PM, Evgeniya Maenkova
>  wrote:
>> Hi,
>> could anyone clarify about predicated code motion in lim?
>>
>> After reading a TODO in /tree-ssa-loop-im.c (see [1]) I tried several
>> examples, say [2]. However, in all of them the code was moved out of
>> the loop successfully (either by pre or by lim, as in [2]).
>>
>> So my question is: what the author of this code did mean by
>> "predicated code motion"? (what is the TODO)
>
> It means transforming
>
>> Thanks,
>>
>> Evgeniya
>>
>> [1]
>> TODO:  Support for predicated code motion.  I.e.
>>
>>while (1)
>>  {
>>if (cond)
>>  {
>>a = inv;
>>something;
>>  }
>>  }
>
> this to
>
> if (cond)
>  {
>a= inv;
>something;
>  }
>while (1)
>  ;
>
> which is currently supported in a very limited way by emitting
> this as
>
>a = cond ? inv : a;
>
> for at most two statements.  As it executes stmts unconditionally
> that way it is limited to non-trapping operations.
>
> Richard.
>
>
>> [2]
>>
>> void foo(int cond, int inv)
>> {
>>
>> int a;
>> int i = 0;
>> int j = 0;
>> while (j++ < 100) {
>> while (i++ < 2000)
>>  {
>>if (j % 2)
>> {
>> a = 528*j;
>> printf("Hey1%d %d", a, i);//something;
>>  }
>> }
>>
>>  }
>> }
>>
>> lim:
>>
>> ;; Function foo (foo, funcdef_no=0, decl_uid=1394, cgraph_uid=0, 
>> symbol_order=0)
>>
>> foo (int cond, int inv)
>> {
>>   int j;
>>   int i;
>>   int a;
>>   unsigned int j.0_12;
>>   unsigned int _13;
>>   unsigned int _18;
>>   unsigned int _21;
>>
>>   :
>>   goto ;
>>
>>   :
>>   if (_13 != 0)
>> goto ;
>>   else
>> goto ;
>>
>>   :
>>   goto ;
>>
>>   :
>>   printf ("Hey1%d %d", a_14, i_11);
>>
>>   :
>>
>>   :
>>   # i_1 = PHI 
>>   i_11 = i_1 + 1;
>>   if (i_1 <= 1999)
>> goto ;
>>   else
>> goto ;
>>
>>   :
>>   # i_20 = PHI 
>>   j_9 = j_23 + 1;
>>   if (j_23 != 100)
>> goto ;
>>   else
>> goto ;
>>
>>   :
>>
>>   :
>>   # i_22 = PHI 
>>   # j_23 = PHI 
>>   j.0_12 = (unsigned int) j_23;
>>   _13 = j.0_12 & 1;
>>   _21 = (unsigned int) j_23;
>>   _18 = _21 * 528;
>>   a_14 = (int) _18;
>>   goto ;
>>
>>   :
>>   return;
>>
>> }
>>
>>
>> However, in loopinit (the optimization before lim) there was no motion
>> (So this was done by lim:
>>   :
>>   a_14 = j_23 * 528;
>>   printf ("Hey1%d %d", a_14, i_11);



-- 
Thanks,

Evgeniya

perfstories.wordpress.com