RE: [Patch] OPT: Update heuristics for loop-invariant for address arithmetic.

2015-04-24 Thread Ajit Kumar Agarwal


-Original Message-
From: Richard Sandiford [mailto:rdsandif...@googlemail.com] 
Sent: Friday, April 24, 2015 12:40 AM
To: Ajit Kumar Agarwal
Cc: vmaka...@redhat.com; GCC Patches; Vinod Kathail; Shail Aditya Gupta; 
Vidhumouli Hunsigida; Nagaraju Mekala
Subject: Re: [Patch] OPT: Update heuristics for loop-invariant for address 
arithmetic.

Very delayed answer, sorry...

Ajit Kumar Agarwal ajit.kumar.agar...@xilinx.com writes:
 Hello All:

 The changes are made in the patch to update the heuristics for loop 
 invariant for address arithemetic at RTL Level.  The heuristics are 
 updated with the consideration of single def and use for register 
 pressure calculation instead Of ignoring it and also to update the 
 estimated register pressure cost along with the check of actual uses 
 with Address uses.

 With the above change, gains are seen in the Geomean for Mibench/EEMBC 
 benchmarks for microblaze target. No Regression is seen in deja GNU 
 regressions tests for microblaze.

Since thispatch is basically removing code, were you able to analyse why that 
code was having a detrimental effect?  I assume it benefited some target 
??originally.

This patch modified the estimated register pressure cost for non ira based 
register pressure(flag_ira_loop_pressure is not set).
Following changes were made in the estimated register pressure cost.

size_cost = (estimate_reg_pressure_cost (new_regs[0] + regs_needed[0],
   regs_used, speed, call_p)
   - estimate_reg_pressure_cost (new_regs[0],
 regs_used, speed, call_p));

is changed to 

size_cost =  estimate_reg_pressure_cost (regs_needed[0],
   regs_used, speed, call_p);

This looks reasonable change for the estimated_reg_pressure_cost calculation. 
The other changes I have made, For the single use for the given
Def the current code does not include such invariants in the register pressure 
calculation which I have enabled including the single use for the
Given def for the register pressure calculation. Though the comment in the code 
says that there won't be a new register for single use after moving,
But moving such invariants outside the loop will affect the register pressures 
as  the spans of the live range after moving out of loops differs from 
The original loop. Since the Live range spans varies such cases should surely 
affect the registers pressure.

The above explanation looks reasonable and the code that does not include such 
invariants into register pressure is removed in the patch.

I don't any see background or the patches in the past that explicit made the 
above check as part of  any performance improvement or bug fix.

Thanks  Regards
Ajit

 



Thanks,
Richard


Re: [Patch] OPT: Update heuristics for loop-invariant for address arithmetic.

2015-04-23 Thread Jeff Law

On 03/23/2015 10:35 AM, Ajit Kumar Agarwal wrote:

Hello All:

Did you get a chance to look at the below patch.

Thanks  Regards
Ajit

-Original Message-
From: gcc-patches-ow...@gcc.gnu.org [mailto:gcc-patches-ow...@gcc.gnu.org] On 
Behalf Of Ajit Kumar Agarwal
Sent: Wednesday, March 04, 2015 3:57 PM
To: vmaka...@redhat.com; GCC Patches
Cc: Vinod Kathail; Shail Aditya Gupta; Vidhumouli Hunsigida; Nagaraju Mekala
Subject: [Patch] OPT: Update heuristics for loop-invariant for address 
arithmetic.

Hello All:

The changes are made in the patch to update the heuristics for loop invariant 
for address arithemetic at RTL Level.
The heuristics are updated with the consideration of single def and use for 
register pressure calculation instead Of ignoring it and also to update the 
estimated register pressure cost along with the check of actual uses with 
Address uses.

With the above change, gains are seen in the Geomean for Mibench/EEMBC 
benchmarks for microblaze target. No Regression is seen in deja GNU regressions 
tests for microblaze.

Please let us know your feedback.

commit 039b95028c93f99fc1da7fa255f9b5fff4e17223
Author: Ajit Kumar Agarwal ajitkum@xhdspdgnu.(none)
Date:   Wed Mar 4 15:46:45 2015 +0530

 [Patch] OPT: Update heuristics for loop-invariant for address arithmetic.

 The changes are made in the patch to update the heuristics
 for loop invariant for address arithmetic. The heuristics is
 changed to incorporate the single def and use in the register
 pressure calculation in order to move the invariant out of
 loop. The heuristics are further changed to not to use the
 check for addr uses with actual uses. Also changes are done in
 the heuristics of estimated register pressure cost.

 ChangeLog:
 2015-03-04  Ajit Agarwal  ajit...@xilinx.com

 * loop-invariant.c (gain_for_invariant): update the
 heuristics for estimate_reg_pressure_cost.
 (get_inv_cost): Remove the check for addr uses with
 actual uses. Add the single def and use in the register
 pressure for invariants.
This work should probably be coordinated with the Intel folks who are 
looking to change if/when LICM for address expressions.


See the thread:

[PATCH, PR target/65103, 2/3] Propagate address constants into loops for 
i386


jeff



Re: [Patch] OPT: Update heuristics for loop-invariant for address arithmetic.

2015-04-23 Thread Richard Sandiford
Very delayed answer, sorry...

Ajit Kumar Agarwal ajit.kumar.agar...@xilinx.com writes:
 Hello All:

 The changes are made in the patch to update the heuristics for loop
 invariant for address arithemetic at RTL Level.  The heuristics are
 updated with the consideration of single def and use for register
 pressure calculation instead Of ignoring it and also to update the
 estimated register pressure cost along with the check of actual uses
 with Address uses.

 With the above change, gains are seen in the Geomean for Mibench/EEMBC
 benchmarks for microblaze target. No Regression is seen in deja GNU
 regressions tests for microblaze.

Since thispatch is basically removing code, were you able to analyse why
that code was having a detrimental effect?  I assume it benefited some
target originally.

Thanks,
Richard


Re: [Patch] OPT: Update heuristics for loop-invariant for address arithmetic.

2015-03-23 Thread Vladimir Makarov


On 2015-03-23 12:35 PM, Ajit Kumar Agarwal wrote:
 Hello All:

 Did you get a chance to look at the below patch.

 Thanks  Regards
 Ajit

 -Original Message-
 From: gcc-patches-ow...@gcc.gnu.org [mailto:gcc-patches-ow...@gcc.gnu.org] On 
 Behalf Of Ajit Kumar Agarwal
 Sent: Wednesday, March 04, 2015 3:57 PM
 To: vmaka...@redhat.com; GCC Patches
 Cc: Vinod Kathail; Shail Aditya Gupta; Vidhumouli Hunsigida; Nagaraju Mekala
 Subject: [Patch] OPT: Update heuristics for loop-invariant for address 
 arithmetic.

 Hello All:

 The changes are made in the patch to update the heuristics for loop invariant 
 for address arithemetic at RTL Level. 
 The heuristics are updated with the consideration of single def and use for 
 register pressure calculation instead Of ignoring it and also to update the 
 estimated register pressure cost along with the check of actual uses with 
 Address uses.

 With the above change, gains are seen in the Geomean for Mibench/EEMBC 
 benchmarks for microblaze target. No Regression is seen in deja GNU 
 regressions tests for microblaze.


  Sorry, I am not a maintainer/reviewer of loop invariant motion pass. 
I had no power to approve this, especially when you change mostly code
for ! flag_ira_loop_pressure.

  I only should say that microblaze is not a primary target.  You should
demonstrate improvement on a primary target, x86/x86-64 the best. 
SPEC2000 or SPEC2006 would be a good benchmark for this.




RE: [Patch] OPT: Update heuristics for loop-invariant for address arithmetic.

2015-03-23 Thread Ajit Kumar Agarwal
Hello All:

Did you get a chance to look at the below patch.

Thanks  Regards
Ajit

-Original Message-
From: gcc-patches-ow...@gcc.gnu.org [mailto:gcc-patches-ow...@gcc.gnu.org] On 
Behalf Of Ajit Kumar Agarwal
Sent: Wednesday, March 04, 2015 3:57 PM
To: vmaka...@redhat.com; GCC Patches
Cc: Vinod Kathail; Shail Aditya Gupta; Vidhumouli Hunsigida; Nagaraju Mekala
Subject: [Patch] OPT: Update heuristics for loop-invariant for address 
arithmetic.

Hello All:

The changes are made in the patch to update the heuristics for loop invariant 
for address arithemetic at RTL Level. 
The heuristics are updated with the consideration of single def and use for 
register pressure calculation instead Of ignoring it and also to update the 
estimated register pressure cost along with the check of actual uses with 
Address uses.

With the above change, gains are seen in the Geomean for Mibench/EEMBC 
benchmarks for microblaze target. No Regression is seen in deja GNU regressions 
tests for microblaze.

Please let us know your feedback.

commit 039b95028c93f99fc1da7fa255f9b5fff4e17223
Author: Ajit Kumar Agarwal ajitkum@xhdspdgnu.(none)
Date:   Wed Mar 4 15:46:45 2015 +0530

[Patch] OPT: Update heuristics for loop-invariant for address arithmetic.

The changes are made in the patch to update the heuristics
for loop invariant for address arithmetic. The heuristics is
changed to incorporate the single def and use in the register
pressure calculation in order to move the invariant out of
loop. The heuristics are further changed to not to use the
check for addr uses with actual uses. Also changes are done in
the heuristics of estimated register pressure cost.

ChangeLog:
2015-03-04  Ajit Agarwal  ajit...@xilinx.com

* loop-invariant.c (gain_for_invariant): update the
heuristics for estimate_reg_pressure_cost.
(get_inv_cost): Remove the check for addr uses with
actual uses. Add the single def and use in the register
pressure for invariants.

Signed-off-by:Ajit Agarwal ajit...@xilinx.com

Thanks  Regards
Ajit


[Patch] OPT: Update heuristics for loop-invariant for address arithmetic.

2015-03-04 Thread Ajit Kumar Agarwal
Hello All:

The changes are made in the patch to update the heuristics for loop invariant 
for address arithemetic at RTL Level. 
The heuristics are updated with the consideration of single def and use for 
register pressure calculation instead 
Of ignoring it and also to update the estimated register pressure cost along 
with the check of actual uses with
Address uses.

With the above change, gains are seen in the Geomean for Mibench/EEMBC 
benchmarks for microblaze target. No
Regression is seen in deja GNU regressions tests for microblaze.

Please let us know your feedback.

commit 039b95028c93f99fc1da7fa255f9b5fff4e17223
Author: Ajit Kumar Agarwal ajitkum@xhdspdgnu.(none)
Date:   Wed Mar 4 15:46:45 2015 +0530

[Patch] OPT: Update heuristics for loop-invariant for address arithmetic.

The changes are made in the patch to update the heuristics
for loop invariant for address arithmetic. The heuristics is
changed to incorporate the single def and use in the register
pressure calculation in order to move the invariant out of
loop. The heuristics are further changed to not to use the
check for addr uses with actual uses. Also changes are done in
the heuristics of estimated register pressure cost.

ChangeLog:
2015-03-04  Ajit Agarwal  ajit...@xilinx.com

* loop-invariant.c (gain_for_invariant): update the
heuristics for estimate_reg_pressure_cost.
(get_inv_cost): Remove the check for addr uses with
actual uses. Add the single def and use in the register
pressure for invariants.

Signed-off-by:Ajit Agarwal ajit...@xilinx.com

Thanks  Regards
Ajit


0001-Patch-OPT-Update-heuristics-for-loop-invariant-for-a.patch
Description: 0001-Patch-OPT-Update-heuristics-for-loop-invariant-for-a.patch