This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: Proposal on Unrolling factor based on Data reuse.
- From: Ajit Kumar Agarwal <ajit dot kumar dot agarwal at xilinx dot com>
- To: Richard Biener <richard dot guenther at gmail dot com>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Cc: Vinod Kathail <vinodk at xilinx dot com>, Shail Aditya Gupta <shailadi at xilinx dot com>, Vidhumouli Hunsigida <vidhum at xilinx dot com>, "Nagaraju Mekala" <nmekala at xilinx dot com>
- Date: Sat, 7 Mar 2015 10:25:55 +0000
- Subject: RE: Proposal on Unrolling factor based on Data reuse.
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=pass (sender IP is 149.199.60.100) smtp dot mailfrom=ajit dot kumar dot agarwal at xilinx dot com; gcc.gnu.org; dkim=none (message not signed) header.d=none;
- References: <BN1AFFO11FD0244DF36A48E226B681B6F0AE1D0 at BN1AFFO11FD024 dot protection dot gbl>
Hello All:
There is a typo error.
The fig(2) is corrected as follows.
For ( I = 1; I < size ; i+=3)
{
X[i] = z[i] * ( y[i] - x[i-1]);
X[i+1] = z[i] * ( y[i] - x[i]);
X[i+2] = z[i] * ( y[i] - x[i+1]]); }
Fig(2).
Thanks & Regards
Ajit
-----Original Message-----
From: gcc-owner@gcc.gnu.org [mailto:gcc-owner@gcc.gnu.org] On Behalf Of Ajit Kumar Agarwal
Sent: Saturday, March 07, 2015 3:31 PM
To: Richard Biener; gcc@gcc.gnu.org
Cc: Vinod Kathail; Shail Aditya Gupta; Vidhumouli Hunsigida; Nagaraju Mekala
Subject: Proposal on Unrolling factor based on Data reuse.
Hello All:
I would like to propose the Unrolling factor based on Data reuse between different iterations. This combines the data reuse of different iterations into single iterations. There is a use of MaxFactor which decides on the calculation of unroll factor based on Data reuse.The MaxFactor is calculated based on (MaxInsts/LoopBodyInsts). The MaxInsts decides on the number of instruction that doesn't degrades on the instruction cache. The calculation of the MaxInsts also considers the def and use distance for the max insts that does not degrades the instruction cache which leads to increase in the Live range width and multiplied with the MaxInsts calculated based on Instruction cache.
The following example from Livermore Loops benchmarks.
The data reuse from the previous iteration to current iteration makes the data reuse. Unrolling the Loop in Fig(1) can Reuse the data and thus increasing the performance. The unrolled loop is unrolled 3 times given in Fig(2) based on the algorithm for Calculation of unrolling factor used as given in Fig(3).
For ( I = 1; I < size; i++ )
{
X[i] = z[i] * ( y[i] - x[i-1]);
}
Fig(1).
For ( I = 1; I < size ; i+=3)
{
X[i] = z[i] * ( y[i] - x[i-1]);
X[i+1] = z[i] * ( y[i] - x[i]);
X[i] = z[i] * ( y[i] - x[i+1]]); }
Fig(2).
Algorithm for unroll factor based on data reuse.
If ( data_reuse == true)
{
Unroll_factor = Reuse_distance +1;
If(Unroll_factor < MaxFactor)
Return unroll_factor;;
Else{
Unroll_factor = MaxFactor - unroll_factor.
If( unroll_factor < MaxDistance)
Return unroll_factor;
}
}
Fig ( 3).
In the example given above in Fig(1) the data reuse distance and the MaxFactor calculated based on the maximum number of insts that don't degrades the instructions caches and doesn't exceed the maximum limit on def and use distance that increases the width of Live range. The above is considered and the Loop is 3 times.
Thoughts Please ?
Thanks & Regards
Ajit