Re: [Patch,optimization]: Optimized changes in the estimate register pressure cost.

2015-10-16 Thread Bin.Cheng
On Wed, Sep 30, 2015 at 12:00 AM, Pat Haugen
 wrote:
> On 09/25/2015 11:51 PM, Ajit Kumar Agarwal wrote:
>>
>> I have made the following changes in the estimate_reg_pressure_cost
>> function used
>> by the loop invariant and IVOPTS.
>>
>> Earlier the estimate_reg_pressure cost uses the cost of n_new variables
>> that are generated by the Loop Invariant
>>   and IVOPTS. These are not sufficient for register pressure calculation.
>> The register pressure cost calculation should
>> use the n_new + n_old (numbers) to consider the cost. n_old is the
>> register  used inside the loops and the effect of
>>   n_new new variables generated by loop invariant and IVOPTS on register
>> pressure is based on how the new
>> variables impact on register used inside the loops. The increase or
>> decrease in register pressure is due to the impact
>> of new variables on the register used  inside the loops. The
>> register-register move cost or the spill cost should consider
>> the cost associated with register used and the new variables generated.
>> The movement  of new variables increases or
>> decreases the register pressure, which is based on  overall cost of n_new
>> + n_old variables.
>>
>> The increase and decrease in register pressure is based on the overall
>> cost of n_new + n_old as the changes in the
>> register pressure caused due to new variables is based on how the changes
>> behave with respect to the register used
>> in the loops.
>>
>> Thus the register pressure caused to new variables is based on the new
>> variables and its impact on register used inside
>>   the loops and thus consider the overall  cost of n_new + n_old.
>>
>> Bootstrap for i386 and reg tested on i386 with the change is fine.
>>
>> SPEC CPU 2000 benchmarks are run and there is following impact on the
>> performance
>> and code size.
>>
>> ratio with the optimization vs ratio without optimization for INT
>> benchmarks
>> (3807.632 vs 3804.661)
>>
>> ratio with the optimization vs ratio without optimization for FP
>> benchmarks
>> ( 4668.743 vs 4778.741)
>>
>> Code size reduction with respect to FP SPEC CPU 2000 benchmarks
>>
>> Number of instruction with optimization = 1094117
>> Number of instruction without optimization = 1094659
>>
>> Reduction in number of instruction with the optimization = 542
>> instruction.
>
> I tried your patch on powerpc64le using CPU2006. There was a small
> degradation in mcf (-1.5%) and small improvement in bwaves (+1.3%), the
> remaining benchmarks (and overall results) were neutral.
We collected performance data on AArch64 for spec2k6, Most cases vary
within [-1%, 1%], three cases vary from +/-[1%, 2%].  INT cases are
generally slightly regressed, while FP cases are generally slightly
improved.  INT overall score is regressed by 0.25%; FP overall score
is improved by 0.35%.

Thanks,
bin
>
> -Pat
>


RE: [Patch,optimization]: Optimized changes in the estimate register pressure cost.

2015-09-29 Thread Ajit Kumar Agarwal


-Original Message-
From: Aaron Sawdey [mailto:acsaw...@linux.vnet.ibm.com] 
Sent: Monday, September 28, 2015 11:55 PM
To: Ajit Kumar Agarwal
Cc: GCC Patches; Vinod Kathail; Shail Aditya Gupta; Vidhumouli Hunsigida; 
Nagaraju Mekala
Subject: Re: [Patch,optimization]: Optimized changes in the estimate register 
pressure cost.

On Sat, 2015-09-26 at 04:51 +, Ajit Kumar Agarwal wrote:
> I have made the following changes in the estimate_reg_pressure_cost 
> function used by the loop invariant and IVOPTS.
> 
> Earlier the estimate_reg_pressure cost uses the cost of n_new 
> variables that are generated by the Loop Invariant  and IVOPTS. These 
> are not sufficient for register pressure calculation. The register 
> pressure cost calculation should use the n_new + n_old (numbers) to 
> consider the cost. n_old is the register  used inside the loops and 
> the effect of  n_new new variables generated by loop invariant and 
> IVOPTS on register pressure is based on how the new variables impact 
> on register used inside the loops. The increase or decrease in register 
> pressure is due to the impact of new variables on the register used  inside 
> the loops. The register-register move cost or the spill cost should consider 
> the cost associated with register used and the new variables generated. The 
> movement  of new variables increases or decreases the register pressure, 
> which is based on  overall cost of n_new + n_old variables.
> 
> The increase and decrease in register pressure is based on the overall 
> cost of n_new + n_old as the changes in the register pressure caused 
> due to new variables is based on how the changes behave with respect to the 
> register used in the loops.
> 
> Thus the register pressure caused to new variables is based on the new 
> variables and its impact on register used inside  the loops and thus consider 
> the overall  cost of n_new + n_old.
> 
> Bootstrap for i386 and reg tested on i386 with the change is fine.
> 
> SPEC CPU 2000 benchmarks are run and there is following impact on the 
> performance and code size.
> 
> ratio with the optimization vs ratio without optimization for INT 
> benchmarks
> (3807.632 vs 3804.661)
> 
> ratio with the optimization vs ratio without optimization for FP 
> benchmarks ( 4668.743 vs 4778.741)
> 
> Code size reduction with respect to FP SPEC CPU 2000 benchmarks
> 
> Number of instruction with optimization = 1094117 Number of 
> instruction without optimization = 1094659
> 
> Reduction in number of instruction with the optimization = 542 instruction.
> 
> [Patch,optimization]: Optimized changes in the estimate  register 
> pressure cost.
> 
> Earlier the estimate_reg_pressure cost uses the cost of n_new 
> variables that are generated by the Loop Invariant and IVOPTS. These 
> are not sufficient for register pressure calculation. The register 
> pressure cost calculation should use the n_new + n_old (numbers) to 
> consider the cost. n_old is the register used inside the loops and the 
> affect of n_new new variables generated by loop invariant and IVOPTS 
> on register pressure is based on how the new variables impact on register 
> used inside the loops.
> 
> ChangeLog:
> 2015-09-26  Ajit Agarwal  <ajit...@xilinx.com>
> 
>   * cfgloopanal.c (estimate_reg_pressure_cost) : Add changes
>   to consider the n_new plus n_old in the register pressure
>   cost.
> 
> Signed-off-by:Ajit Agarwal ajit...@xilinx.com

>>Ajit,

 >>It looks to me like your change doesn't do anything at all inside the 
 >>loop-invariant.c code. There it's doing a difference between two 
 >>>>estimate_reg_pressure_cost calls so adding n_old (regs_used) to both is 
 >>canceled out.

>>  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));

>>I'm not quite sure I understand the "why" of the heuristic you've added here 
>>-- can you explain your reasoning further?

Aaron:

Extract from function estimate_reg_pressure_cost() where the changes are made.

if (regs_needed <= available_regs)
/* If we are close to running out of registers, try to preserve
   them.  */
/* Case 1 */
cost = target_reg_cost [speed] * regs_needed ;
  else
/* If we run out of registers, it is very expensive to add another
   one.  */
 /* Case 2*/
cost = target_spill_cost [speed] * regs_needed;

If the first estimate_reg_pressure falls into the category of Case I or Case 2 
and the second estimate_reg_pressure falls into same Category for C

Re: [Patch,optimization]: Optimized changes in the estimate register pressure cost.

2015-09-29 Thread Pat Haugen

On 09/25/2015 11:51 PM, Ajit Kumar Agarwal wrote:

I have made the following changes in the estimate_reg_pressure_cost function 
used
by the loop invariant and IVOPTS.

Earlier the estimate_reg_pressure cost uses the cost of n_new variables that 
are generated by the Loop Invariant
  and IVOPTS. These are not sufficient for register pressure calculation. The 
register pressure cost calculation should
use the n_new + n_old (numbers) to consider the cost. n_old is the register  
used inside the loops and the effect of
  n_new new variables generated by loop invariant and IVOPTS on register 
pressure is based on how the new
variables impact on register used inside the loops. The increase or decrease in 
register pressure is due to the impact
of new variables on the register used  inside the loops. The register-register 
move cost or the spill cost should consider
the cost associated with register used and the new variables generated. The 
movement  of new variables increases or
decreases the register pressure, which is based on  overall cost of n_new + 
n_old variables.

The increase and decrease in register pressure is based on the overall cost of 
n_new + n_old as the changes in the
register pressure caused due to new variables is based on how the changes 
behave with respect to the register used
in the loops.

Thus the register pressure caused to new variables is based on the new 
variables and its impact on register used inside
  the loops and thus consider the overall  cost of n_new + n_old.

Bootstrap for i386 and reg tested on i386 with the change is fine.

SPEC CPU 2000 benchmarks are run and there is following impact on the 
performance
and code size.

ratio with the optimization vs ratio without optimization for INT benchmarks
(3807.632 vs 3804.661)

ratio with the optimization vs ratio without optimization for FP benchmarks
( 4668.743 vs 4778.741)

Code size reduction with respect to FP SPEC CPU 2000 benchmarks

Number of instruction with optimization = 1094117
Number of instruction without optimization = 1094659

Reduction in number of instruction with the optimization = 542 instruction.
I tried your patch on powerpc64le using CPU2006. There was a small 
degradation in mcf (-1.5%) and small improvement in bwaves (+1.3%), the 
remaining benchmarks (and overall results) were neutral.


-Pat



Re: [Patch,optimization]: Optimized changes in the estimate register pressure cost.

2015-09-28 Thread Aaron Sawdey
On Sat, 2015-09-26 at 04:51 +, Ajit Kumar Agarwal wrote:
> I have made the following changes in the estimate_reg_pressure_cost function 
> used 
> by the loop invariant and IVOPTS. 
> 
> Earlier the estimate_reg_pressure cost uses the cost of n_new variables that 
> are generated by the Loop Invariant
>  and IVOPTS. These are not sufficient for register pressure calculation. The 
> register pressure cost calculation should
> use the n_new + n_old (numbers) to consider the cost. n_old is the register  
> used inside the loops and the effect of
>  n_new new variables generated by loop invariant and IVOPTS on register 
> pressure is based on how the new
> variables impact on register used inside the loops. The increase or decrease 
> in register pressure is due to the impact
> of new variables on the register used  inside the loops. The 
> register-register move cost or the spill cost should consider
> the cost associated with register used and the new variables generated. The 
> movement  of new variables increases or 
> decreases the register pressure, which is based on  overall cost of n_new + 
> n_old variables.
> 
> The increase and decrease in register pressure is based on the overall cost 
> of n_new + n_old as the changes in the 
> register pressure caused due to new variables is based on how the changes 
> behave with respect to the register used 
> in the loops.
> 
> Thus the register pressure caused to new variables is based on the new 
> variables and its impact on register used inside
>  the loops and thus consider the overall  cost of n_new + n_old.
> 
> Bootstrap for i386 and reg tested on i386 with the change is fine.
> 
> SPEC CPU 2000 benchmarks are run and there is following impact on the 
> performance
> and code size.
> 
> ratio with the optimization vs ratio without optimization for INT benchmarks
> (3807.632 vs 3804.661)
> 
> ratio with the optimization vs ratio without optimization for FP benchmarks
> ( 4668.743 vs 4778.741)
> 
> Code size reduction with respect to FP SPEC CPU 2000 benchmarks
> 
> Number of instruction with optimization = 1094117
> Number of instruction without optimization = 1094659
> 
> Reduction in number of instruction with the optimization = 542 instruction.
> 
> [Patch,optimization]: Optimized changes in the estimate
>  register pressure cost.
> 
> Earlier the estimate_reg_pressure cost uses the cost of n_new variables that
> are generated by the Loop Invariant and IVOPTS. These are not sufficient for
> register pressure calculation. The register pressure cost calculation should
> use the n_new + n_old (numbers) to consider the cost. n_old is the register
> used inside the loops and the affect of n_new new variables generated by
> loop invariant and IVOPTS on register pressure is based on how the new
> variables impact on register used inside the loops.
> 
> ChangeLog:
> 2015-09-26  Ajit Agarwal  
> 
>   * cfgloopanal.c (estimate_reg_pressure_cost) : Add changes
>   to consider the n_new plus n_old in the register pressure
>   cost.
> 
> Signed-off-by:Ajit Agarwal ajit...@xilinx.com

Ajit,
  It looks to me like your change doesn't do anything at all inside the
loop-invariant.c code. There it's doing a difference between two
estimate_reg_pressure_cost calls so adding n_old (regs_used) to both is
canceled out.

  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));

I'm not quite sure I understand the "why" of the heuristic you've added
here -- can you explain your reasoning further?

> 
> Thanks & Regards
> Ajit
> 

Thanks,
Aaron

-- 
Aaron Sawdey, Ph.D.  acsaw...@linux.vnet.ibm.com
050-2/C113  (507) 253-7520 home: 507/263-0782
IBM Linux Technology Center - PPC Toolchain



Re: [Patch,optimization]: Optimized changes in the estimate register pressure cost.

2015-09-28 Thread Bin.Cheng
On Tue, Sep 29, 2015 at 2:25 AM, Aaron Sawdey
 wrote:
> On Sat, 2015-09-26 at 04:51 +, Ajit Kumar Agarwal wrote:
>> I have made the following changes in the estimate_reg_pressure_cost function 
>> used
>> by the loop invariant and IVOPTS.
>>
>> Earlier the estimate_reg_pressure cost uses the cost of n_new variables that 
>> are generated by the Loop Invariant
>>  and IVOPTS. These are not sufficient for register pressure calculation. The 
>> register pressure cost calculation should
>> use the n_new + n_old (numbers) to consider the cost. n_old is the register  
>> used inside the loops and the effect of
>>  n_new new variables generated by loop invariant and IVOPTS on register 
>> pressure is based on how the new
>> variables impact on register used inside the loops. The increase or decrease 
>> in register pressure is due to the impact
>> of new variables on the register used  inside the loops. The 
>> register-register move cost or the spill cost should consider
>> the cost associated with register used and the new variables generated. The 
>> movement  of new variables increases or
>> decreases the register pressure, which is based on  overall cost of n_new + 
>> n_old variables.
>>
>> The increase and decrease in register pressure is based on the overall cost 
>> of n_new + n_old as the changes in the
>> register pressure caused due to new variables is based on how the changes 
>> behave with respect to the register used
>> in the loops.
>>
>> Thus the register pressure caused to new variables is based on the new 
>> variables and its impact on register used inside
>>  the loops and thus consider the overall  cost of n_new + n_old.
>>
>> Bootstrap for i386 and reg tested on i386 with the change is fine.
>>
>> SPEC CPU 2000 benchmarks are run and there is following impact on the 
>> performance
>> and code size.
>>
>> ratio with the optimization vs ratio without optimization for INT benchmarks
>> (3807.632 vs 3804.661)
>>
>> ratio with the optimization vs ratio without optimization for FP benchmarks
>> ( 4668.743 vs 4778.741)
>>
>> Code size reduction with respect to FP SPEC CPU 2000 benchmarks
>>
>> Number of instruction with optimization = 1094117
>> Number of instruction without optimization = 1094659
>>
>> Reduction in number of instruction with the optimization = 542 instruction.
>>
>> [Patch,optimization]: Optimized changes in the estimate
>>  register pressure cost.
>>
>> Earlier the estimate_reg_pressure cost uses the cost of n_new variables that
>> are generated by the Loop Invariant and IVOPTS. These are not sufficient for
>> register pressure calculation. The register pressure cost calculation should
>> use the n_new + n_old (numbers) to consider the cost. n_old is the register
>> used inside the loops and the affect of n_new new variables generated by
>> loop invariant and IVOPTS on register pressure is based on how the new
>> variables impact on register used inside the loops.
>>
>> ChangeLog:
>> 2015-09-26  Ajit Agarwal  
>>
>>   * cfgloopanal.c (estimate_reg_pressure_cost) : Add changes
>>   to consider the n_new plus n_old in the register pressure
>>   cost.
>>
>> Signed-off-by:Ajit Agarwal ajit...@xilinx.com
>
> Ajit,
>   It looks to me like your change doesn't do anything at all inside the
> loop-invariant.c code. There it's doing a difference between two
> estimate_reg_pressure_cost calls so adding n_old (regs_used) to both is
> canceled out.
>
>   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));
>
> I'm not quite sure I understand the "why" of the heuristic you've added
> here -- can you explain your reasoning further?

With this, I think the only change would be in GIMPLE IVOPT?  The
patch increases register pressure if it exceeds available register
number when choosing iv candidates.  As I mentioned, it may only have
impact on scenarios that's on the verge of available register number,
otherwise the reg_old is added(thus cancelled) for both ends of
comparison.
The result isn't clear enough even for boundary cases because IVO now
has issues in computing the "starting register pressure".  I also
planned to visit the pressure model in IVO later.

Thanks,
bin
>
>>
>> Thanks & Regards
>> Ajit
>>
>
> Thanks,
> Aaron
>
> --
> Aaron Sawdey, Ph.D.  acsaw...@linux.vnet.ibm.com
> 050-2/C113  (507) 253-7520 home: 507/263-0782
> IBM Linux Technology Center - PPC Toolchain
>


Re: [Patch,optimization]: Optimized changes in the estimate register pressure cost.

2015-09-27 Thread Segher Boessenkool
On Sat, Sep 26, 2015 at 04:51:20AM +, Ajit Kumar Agarwal wrote:
> SPEC CPU 2000 benchmarks are run and there is following impact on the 
> performance
> and code size.
> 
> ratio with the optimization vs ratio without optimization for INT benchmarks
> (3807.632 vs 3804.661)
> 
> ratio with the optimization vs ratio without optimization for FP benchmarks
> ( 4668.743 vs 4778.741)

Did you swap these?  You're saying FP got significantly worse?


Segher


RE: [Patch,optimization]: Optimized changes in the estimate register pressure cost.

2015-09-27 Thread Ajit Kumar Agarwal


-Original Message-
From: Segher Boessenkool [mailto:seg...@kernel.crashing.org] 
Sent: Sunday, September 27, 2015 7:49 PM
To: Ajit Kumar Agarwal
Cc: GCC Patches; Vinod Kathail; Shail Aditya Gupta; Vidhumouli Hunsigida; 
Nagaraju Mekala
Subject: Re: [Patch,optimization]: Optimized changes in the estimate register 
pressure cost.

On Sat, Sep 26, 2015 at 04:51:20AM +, Ajit Kumar Agarwal wrote:
> SPEC CPU 2000 benchmarks are run and there is following impact on the 
> performance and code size.
> 
> ratio with the optimization vs ratio without optimization for INT 
> benchmarks
> (3807.632 vs 3804.661)
> 
> ratio with the optimization vs ratio without optimization for FP 
> benchmarks ( 4668.743 vs 4778.741)

>>Did you swap these?  You're saying FP got significantly worse?

Sorry for the typo error.  Please find the corrected one.

Ratio  with the optimization vs ratio without optimization for FP  benchmarks ( 
4668.743 vs 4668.741). With the optimization
FP is slightly better performance.

Thanks & Regards
Ajit

Segher


RE: [Patch,optimization]: Optimized changes in the estimate register pressure cost.

2015-09-27 Thread Bernhard Reutner-Fischer
On September 27, 2015 5:13:59 PM GMT+02:00, Ajit Kumar Agarwal 
<ajit.kumar.agar...@xilinx.com> wrote:
>
>
>-Original Message-
>From: Segher Boessenkool [mailto:seg...@kernel.crashing.org] 
>Sent: Sunday, September 27, 2015 7:49 PM
>To: Ajit Kumar Agarwal
>Cc: GCC Patches; Vinod Kathail; Shail Aditya Gupta; Vidhumouli
>Hunsigida; Nagaraju Mekala
>Subject: Re: [Patch,optimization]: Optimized changes in the estimate
>register pressure cost.
>
>On Sat, Sep 26, 2015 at 04:51:20AM +, Ajit Kumar Agarwal wrote:
>> SPEC CPU 2000 benchmarks are run and there is following impact on the
>
>> performance and code size.
>> 
>> ratio with the optimization vs ratio without optimization for INT 
>> benchmarks
>> (3807.632 vs 3804.661)
>> 
>> ratio with the optimization vs ratio without optimization for FP 
>> benchmarks ( 4668.743 vs 4778.741)
>
>>>Did you swap these?  You're saying FP got significantly worse?
>
>Sorry for the typo error.  Please find the corrected one.
>
>Ratio  with the optimization vs ratio without optimization for FP 
>benchmarks ( 4668.743 vs 4668.741). With the optimization
>FP is slightly better performance.

Ah, I see. Sorry for the noise..

Thanks,



Re: [Patch,optimization]: Optimized changes in the estimate register pressure cost.

2015-09-27 Thread Bernhard Reutner-Fischer
On September 26, 2015 9:10:13 AM GMT+02:00, "Bin.Cheng"  
wrote:
>On Sat, Sep 26, 2015 at 12:51 PM, Ajit Kumar Agarwal
> wrote:

>> SPEC CPU 2000 benchmarks are run and there is following impact on the
>performance
>> and code size.
>>
>> ratio with the optimization vs ratio without optimization for INT
>benchmarks
>> (3807.632 vs 3804.661)
>>
>> ratio with the optimization vs ratio without optimization for FP
>benchmarks
>> ( 4668.743 vs 4778.741)

Do I read this correctly to introduce a 2,4% regression for FP?

Thanks,
>>
>> Code size reduction with respect to FP SPEC CPU 2000 benchmarks
>>
>> Number of instruction with optimization = 1094117
>> Number of instruction without optimization = 1094659
>>
>> Reduction in number of instruction with the optimization = 542
>instruction.




Re: [Patch,optimization]: Optimized changes in the estimate register pressure cost.

2015-09-27 Thread Bin.Cheng
On Sun, Sep 27, 2015 at 11:13 PM, Ajit Kumar Agarwal
<ajit.kumar.agar...@xilinx.com> wrote:
>
>
> -Original Message-
> From: Segher Boessenkool [mailto:seg...@kernel.crashing.org]
> Sent: Sunday, September 27, 2015 7:49 PM
> To: Ajit Kumar Agarwal
> Cc: GCC Patches; Vinod Kathail; Shail Aditya Gupta; Vidhumouli Hunsigida; 
> Nagaraju Mekala
> Subject: Re: [Patch,optimization]: Optimized changes in the estimate register 
> pressure cost.
>
> On Sat, Sep 26, 2015 at 04:51:20AM +, Ajit Kumar Agarwal wrote:
>> SPEC CPU 2000 benchmarks are run and there is following impact on the
>> performance and code size.
>>
>> ratio with the optimization vs ratio without optimization for INT
>> benchmarks
>> (3807.632 vs 3804.661)
>>
>> ratio with the optimization vs ratio without optimization for FP
>> benchmarks ( 4668.743 vs 4778.741)
>
>>>Did you swap these?  You're saying FP got significantly worse?
>
> Sorry for the typo error.  Please find the corrected one.
>
> Ratio  with the optimization vs ratio without optimization for FP  benchmarks 
> ( 4668.743 vs 4668.741). With the optimization
> FP is slightly better performance.
Did you mis-type the number again?  Or this must be noise.  Now I
remember why I didn't get perf improvement from this.  Changing
reg_new to reg_new + reg_old doesn't have big impact because it just
increased the starting number for each scenarios.  Maybe it still
makes sense for cases on the verge of exceeding target's available
register number.  I will try to collect benchmark data on ARM, but it
may take some time.

Thanks,
bin
>
> Thanks & Regards
> Ajit
>
> Segher


RE: [Patch,optimization]: Optimized changes in the estimate register pressure cost.

2015-09-27 Thread Ajit Kumar Agarwal


-Original Message-
From: Bin.Cheng [mailto:amker.ch...@gmail.com] 
Sent: Monday, September 28, 2015 7:05 AM
To: Ajit Kumar Agarwal
Cc: Segher Boessenkool; GCC Patches; Vinod Kathail; Shail Aditya Gupta; 
Vidhumouli Hunsigida; Nagaraju Mekala
Subject: Re: [Patch,optimization]: Optimized changes in the estimate register 
pressure cost.

On Sun, Sep 27, 2015 at 11:13 PM, Ajit Kumar Agarwal 
<ajit.kumar.agar...@xilinx.com> wrote:
>
>
> -Original Message-
> From: Segher Boessenkool [mailto:seg...@kernel.crashing.org]
> Sent: Sunday, September 27, 2015 7:49 PM
> To: Ajit Kumar Agarwal
> Cc: GCC Patches; Vinod Kathail; Shail Aditya Gupta; Vidhumouli 
> Hunsigida; Nagaraju Mekala
> Subject: Re: [Patch,optimization]: Optimized changes in the estimate register 
> pressure cost.
>
> On Sat, Sep 26, 2015 at 04:51:20AM +, Ajit Kumar Agarwal wrote:
>> SPEC CPU 2000 benchmarks are run and there is following impact on the 
>> performance and code size.
>>
>> ratio with the optimization vs ratio without optimization for INT 
>> benchmarks
>> (3807.632 vs 3804.661)
>>
>> ratio with the optimization vs ratio without optimization for FP 
>> benchmarks ( 4668.743 vs 4778.741)
>
>>>Did you swap these?  You're saying FP got significantly worse?
>
> Sorry for the typo error.  Please find the corrected one.
>
> Ratio  with the optimization vs ratio without optimization for FP  
> benchmarks ( 4668.743 vs 4668.741). With the optimization FP is slightly 
> better performance.
>>Did you mis-type the number again?  Or this must be noise.  Now I remember 
>>why I didn't get perf improvement from this.  Changing reg_new to reg_new >>+ 
>>reg_old doesn't have big impact because it just increased the starting number 
>>for each scenarios.  Maybe it still makes sense for cases on the verge of 
>>>>exceeding target's available register number.  I will try to collect 
>>benchmark data on ARM, but it may take some time.

This is the correct one.

Thanks & Regards
Ajit

Thanks,
bin
>
> Thanks & Regards
> Ajit
>
> Segher


Re: [Patch,optimization]: Optimized changes in the estimate register pressure cost.

2015-09-26 Thread Bin.Cheng
On Sat, Sep 26, 2015 at 12:51 PM, Ajit Kumar Agarwal
 wrote:
> I have made the following changes in the estimate_reg_pressure_cost function 
> used
> by the loop invariant and IVOPTS.
>
> Earlier the estimate_reg_pressure cost uses the cost of n_new variables that 
> are generated by the Loop Invariant
>  and IVOPTS. These are not sufficient for register pressure calculation. The 
> register pressure cost calculation should
> use the n_new + n_old (numbers) to consider the cost. n_old is the register  
> used inside the loops and the effect of
>  n_new new variables generated by loop invariant and IVOPTS on register 
> pressure is based on how the new
> variables impact on register used inside the loops. The increase or decrease 
> in register pressure is due to the impact
> of new variables on the register used  inside the loops. The 
> register-register move cost or the spill cost should consider
> the cost associated with register used and the new variables generated. The 
> movement  of new variables increases or
> decreases the register pressure, which is based on  overall cost of n_new + 
> n_old variables.
>
> The increase and decrease in register pressure is based on the overall cost 
> of n_new + n_old as the changes in the
> register pressure caused due to new variables is based on how the changes 
> behave with respect to the register used
> in the loops.
>
> Thus the register pressure caused to new variables is based on the new 
> variables and its impact on register used inside
>  the loops and thus consider the overall  cost of n_new + n_old.
>
> Bootstrap for i386 and reg tested on i386 with the change is fine.
>
> SPEC CPU 2000 benchmarks are run and there is following impact on the 
> performance
> and code size.
>
> ratio with the optimization vs ratio without optimization for INT benchmarks
> (3807.632 vs 3804.661)
>
> ratio with the optimization vs ratio without optimization for FP benchmarks
> ( 4668.743 vs 4778.741)
>
> Code size reduction with respect to FP SPEC CPU 2000 benchmarks
>
> Number of instruction with optimization = 1094117
> Number of instruction without optimization = 1094659
>
> Reduction in number of instruction with the optimization = 542 instruction.
>
> [Patch,optimization]: Optimized changes in the estimate
>  register pressure cost.
>
> Earlier the estimate_reg_pressure cost uses the cost of n_new variables that
> are generated by the Loop Invariant and IVOPTS. These are not sufficient for
> register pressure calculation. The register pressure cost calculation should
> use the n_new + n_old (numbers) to consider the cost. n_old is the register
> used inside the loops and the affect of n_new new variables generated by
> loop invariant and IVOPTS on register pressure is based on how the new
> variables impact on register used inside the loops.

Hi,
I remember I did this experiment before when I was tuning register
pressure for embedded processors.  Don't remember why I didn't follow
up it.   I will collect data on arm processors for the patch.

Thanks,
bin
>
> ChangeLog:
> 2015-09-26  Ajit Agarwal  
>
> * cfgloopanal.c (estimate_reg_pressure_cost) : Add changes
> to consider the n_new plus n_old in the register pressure
> cost.
>
> Signed-off-by:Ajit Agarwal ajit...@xilinx.com
>
> Thanks & Regards
> Ajit
>