Consider the following loop
for
(i = 0; i < 8; i++)
sum += A[i];
With support for memory access transformation this loop can be executed
in parallel. It can be
transformed to
<create
and
initialize an array 'tmp'
with size 4>
for (i = 0; i < 8; i++) {
tmp[i % 4] += A[i];
}
sum = tmp[0] + tmp[1] + tmp[2]
+ tmp[3];
With the help of some optimizer (like
PluTo) the following code can be
generated, where the outer loop is
parallel.
parfor (ii =
0; ii < 4; ii++) {
tmp[ii] = 0;
for (i = ii * 2; i < (ii+1) * 2; i++)
tmp[ii] += A[i];
}
sum = tmp[0] + tmp[1] + tmp[2] +
tmp[3];
TODO
Step 1
Polly exports its polyhedral description in a JSCoP file. Define how
memory
layout transformations are going to be expressed in Polly and
in
the JSCOP file.
A simple example is given below.
Consider the following loop.
for
(i
= 0; i < 12; i++)
A[i] = 0;
In the JSCOP file the memory is represented as follows.
"accesses":
[{
"kind":
"write",
"relation":
"{
Stmt[i] -> A[i]
}"
}]
Suppose
we want to perform a transformation such that the following
code is generated
for
(i
= 0; i < 12; i++)
A[0] = i;
The corresponding JSCOP file represenation would be
"accesses":
[{
"kind":
"read",
"relation":
"{
Stmt[i] -> A[0]
}"
}]
We need to detect this access function change.