www: Adding webpage to track memory access transformation

llvm-svn: 133354
This commit is contained in:
Raghesh Aloor 2011-06-18 17:17:16 +00:00
parent 94085eaa83
commit 49a3a7ba20
1 changed files with 143 additions and 0 deletions

View File

@ -0,0 +1,143 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<title>memaccess.html</title>
</head>
<body>
<div style="margin-left: 320px;"><small style="font-weight: bold;"><small><a><big><big><big>Support
for
memory access
transformations in Polly</big></big></big></a></small></small><big><span
style="font-weight: bold;"></span></big><br>
<big><span style="font-weight: bold;"></span></big><br>
<div style="text-align: left;"><strong></strong>This project adds
memory access transformations to Polly. In many cases<br>
changing the memory access pattern yields to better data
locality or removes<br>
dependences that would otherwise block
transformations. They may also<br>
allow LLVM to use registers to store
certain values.<br>
</div>
<br>
An examples which uses this feature is given below<br>
</div>
<div style="margin-left: 320px;"><br>
Consider the following loop
<ul>
<ul>
</ul>
</ul>
<div style="margin-left: 40px;"><small style="font-style: italic;">for
(i = 0; i &lt; 8; i++)</small><br>
<small style="font-style: italic;">sum += A[i];</small><br
style="font-style: italic;">
</div>
<br>
With support for memory access transformation this loop can be executed<br>
in parallel. It can be
transformed to<small style="font-style: italic;"><br>
<br>
</small>
<div style="margin-left: 40px;"><small style="font-style: italic;">&lt;create
and
initialize an array 'tmp'
with size 4&gt;</small><br>
<small style="font-style: italic;">for (i = 0; i &lt; 8; i++) {</small><br>
<small style="font-style: italic;">tmp[i % 4] += A[i];</small><br>
<small style="font-style: italic;">}</small><small><span
style="font-style: italic;"></span></small><br>
<small><span style="font-style: italic;">sum = tmp[0] + tmp[1] + tmp[2]
+ tmp[3];</span></small><br>
</div>
<br>
With the help of some optimizer (like
PluTo) the following code can be <br>
generated, where the outer loop is
parallel.
<p style="padding-left: 30px; font-style: italic;"><small>parfor (ii =
0; ii &lt; 4; ii++) {<br>
&nbsp; &nbsp; tmp[ii] = 0;<br>
&nbsp;&nbsp;&nbsp; for (i = ii * 2; i &lt; (ii+1) * 2; i++)<br>
&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; tmp[ii] += A[i];</small></p>
<p style="padding-left: 30px; font-style: italic; font-weight: bold;"><small><span
style="font-weight: normal;">}</span><br style="font-weight: normal;">
<span style="font-weight: normal;">sum = tmp[0] + tmp[1] + tmp[2] +
tmp[3];</span><br>
<strong></strong></small></p>
<p><strong><span style="text-decoration: underline;">TODO<br>
</span></strong></p>
<p><strong><span style="text-decoration: underline;"><small>Step 1</small><br>
</span></strong></p>
Polly exports its polyhedral description in a JSCoP file. Define how
memory <small><br>
</small>layout transformations are going to be expressed in Polly and
in
the JSCOP file. <br>
A simple example is given below.<br>
<br>
Consider the following loop.<br>
<br>
<div style="margin-left: 40px;"><small><span style="font-style: italic;">for
(i
= 0; i &lt; 12; i++)</span><br style="font-style: italic;">
<span style="font-style: italic;">&nbsp;&nbsp;&nbsp;&nbsp; A[i] = 0;</span><br
style="font-style: italic;">
</small></div>
<br>
In the JSCOP file the memory is represented as follows.<br>
<br>
<div style="margin-left: 40px;"><small><span style="font-style: italic;">&nbsp;&nbsp;
"accesses":
[{</span></small><br style="font-style: italic;">
<small><span style="font-style: italic;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
"kind":
"write",</span></small><br style="font-style: italic;">
<small><span style="font-style: italic;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
"relation":
"{
Stmt[i] -&gt; </span><strong
style="font-style: italic; font-weight: bold;">A</strong><span
style="font-style: italic;"><span style="font-weight: bold;">[i]</span>
}"</span></small><br style="font-style: italic;">
<small><span style="font-style: italic;">&nbsp;&nbsp;&nbsp; }]</span></small><br
style="font-style: italic;">
</div>
<br>
Suppose
we want to perform a transformation such that the following<br>
code is generated<br>
<br>
<div style="margin-left: 40px;"><small><span style="font-style: italic;">for
(i
= 0; i &lt; 12; i++)</span><br style="font-style: italic;">
<span style="font-style: italic;">
&nbsp;&nbsp;&nbsp;&nbsp; A[0] = i;</span><br style="font-style: italic;">
</small></div>
<br>
The corresponding JSCOP file represenation would be<br>
<br>
<div style="margin-left: 40px;"><small><span style="font-style: italic;">&nbsp;&nbsp;&nbsp;
"accesses":
[{</span><br style="font-style: italic;">
<span style="font-style: italic;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
"kind":
"read",</span><br style="font-style: italic;">
<span style="font-style: italic;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
"relation":
"{
Stmt[i] -&gt; </span><strong
style="font-style: italic; font-weight: bold;">A</strong><span
style="font-style: italic;"><span style="font-weight: bold;">[0]</span>
}"</span><br style="font-style: italic;">
<span style="font-style: italic;">&nbsp;&nbsp;&nbsp; }]</span><br
style="font-style: italic;">
</small></div>
<br>
We need to detect this access function change.<br>
</div>
<span id="q_12f99e5de7fd0932_1" class="h4"></span>
</body>
</html>