Commit e5ecf9c5 authored by Tobias Grosser's avatar Tobias Grosser
Browse files

Update matmul example to the latest polly version

As the namings of the scops have changed, polly was not able to read in the user
given .jscop files. By renaming the provided files, polly now finds them again
and can use them to optimize the matmul function. We also update the generated
files to reflect the very latest version of Polly.

Merged from: https://llvm.org/svn/llvm-project/polly/trunk@182265

llvm-svn: 183376
parent 92336236
Loading
Loading
Loading
Loading
+25 −25
Original line number Diff line number Diff line
@@ -110,7 +110,7 @@ view-scops-only:
<pre>
[...]
Printing analysis 'Polly - Create polyhedral description of Scops' for region:
'%1 =&gt;&nbsp;%17' in function 'init_array':
'for.cond =&gt; for.end19' in function 'init_array':
   Context:
   { [] }
   Statements {
@@ -135,7 +135,7 @@ Printing analysis 'Polly - Create polyhedral description of Scops' for region:
   }
[...]
Printing analysis 'Polly - Create polyhedral description of Scops' for region:
'%1 =&gt;&nbsp;%17' in function 'main':
'for.cond =&gt; for.end30' in function 'main':
   Context:
   { [] }
   Statements {
@@ -178,7 +178,7 @@ Printing analysis 'Polly - Create polyhedral description of Scops' for region:
<li><h4>Show the dependences for the SCoPs</h4>
<pre class="code">opt -basicaa -polly-dependences -analyze matmul.preopt.ll</pre>
<pre>Printing analysis 'Polly - Calculate dependences for SCoP' for region:
'for.cond =&gt; for.end28' in function 'init_array':
'for.cond =&gt; for.end19' in function 'init_array':
   Must dependences:
       {  }
   May dependences:
@@ -188,7 +188,7 @@ Printing analysis 'Polly - Create polyhedral description of Scops' for region:
   May no source:
       {  }
Printing analysis 'Polly - Calculate dependences for SCoP' for region:
'for.cond =&gt; for.end48' in function 'main':
'for.cond =&gt; for.end30' in function 'main':
   Must dependences:
       {  Stmt_4[i0, i1] -&gt; Stmt_6[i0, i1, 0]&nbsp;:
              i0 &gt;= 0 and i0 &lt;= 1023 and i1 &gt;= 0 and i1 &lt;= 1023;
@@ -221,8 +221,8 @@ Printing analysis 'Polly - Calculate dependences for SCoP' for region:
Polly can export the polyhedral representation in so called jscop files. Jscop
files contain the polyhedral representation stored in a JSON file.
<pre class="code">opt -basicaa -polly-export-jscop matmul.preopt.ll</pre>
<pre>Writing SCoP 'for.cond =&gt; for.end28' in function 'init_array' to './init_array___%for.cond---%for.end28.jscop'.
Writing SCoP 'for.cond =&gt; for.end48' in function 'main' to './main___%for.cond---%for.end48.jscop'.
<pre>Writing SCoP 'for.cond =&gt; for.end19' in function 'init_array' to './init_array___%for.cond---%for.end19.jscop'.
Writing SCoP 'for.cond =&gt; for.end30' in function 'main' to './main___%for.cond---%for.end30.jscop'.
</pre></li>

<li><h4>Import the changed jscop files and print the updated SCoP structure
@@ -268,7 +268,7 @@ opt matmul.preopt.ll -basicaa \
</pre>
<pre>
[...]
Reading JScop '%1 =&gt; %17' in function 'main' from './main___%1---%17.jscop.interchanged'.
Reading JScop 'for.cond =&gt; for.end30' in function 'main' from './main___%for.cond---%for.end30.jscop.interchanged+tiled'.
[...]
main():
for (c2=0;c2&lt;=1535;c2++) {
@@ -295,7 +295,7 @@ opt matmul.preopt.ll -basicaa \
</pre>
<pre>
[...]
Reading JScop '%1 =&gt; %17' in function 'main' from './main___%1---%17.jscop.interchanged+tiled'.
Reading JScop 'for.cond =&gt; for.end30' in function 'main' from './main___%for.cond---%for.end30.jscop.interchanged+tiled'.
[...]
main():
for (c2=0;c2&lt;=1535;c2++) {
@@ -329,7 +329,7 @@ opt matmul.preopt.ll -basicaa \

<pre>
[...]
Reading JScop '%1 =&gt; %17' in function 'main' from './main___%1---%17.jscop.interchanged+tiled+vector'.
Reading JScop 'for.cond =&gt; for.end30' in function 'main' from './main___%for.cond---%for.end30.jscop.interchanged+tiled+vector'.
[...]
main():
for (c2=0;c2&lt;=1535;c2++) {
@@ -369,11 +369,11 @@ opt -basicaa \
    -polly-codegen matmul.preopt.ll \
   | opt -O3 &gt; matmul.polly.interchanged.ll</pre>
<pre>
Reading JScop '%1 =&gt; %19' in function 'init_array' from
    './init_array___%1---%19.jscop.interchanged'.
Reading JScop 'for.cond =&gt; for.end19' in function 'init_array' from
    './init_array___%for.cond---%for.end19.jscop.interchanged'.
File could not be read: No such file or directory
Reading JScop '%1 =&gt; %17' in function 'main' from
    './main___%1---%17.jscop.interchanged'.
Reading JScop 'for.cond =&gt; for.end30' in function 'main' from
    './main___%for.cond---%for.end30.jscop.interchanged'.
</pre>
<pre class="code">
opt -basicaa \
@@ -381,11 +381,11 @@ opt -basicaa \
    -polly-codegen matmul.preopt.ll \
   | opt -O3 &gt; matmul.polly.interchanged+tiled.ll</pre>
<pre>
Reading JScop '%1 =&gt; %19' in function 'init_array' from
    './init_array___%1---%19.jscop.interchanged+tiled'.
Reading JScop 'for.cond =&gt; for.end19' in function 'init_array' from
    './init_array___%for.cond---%for.end19.jscop.interchanged+tiled'.
File could not be read: No such file or directory
Reading JScop '%1 =&gt; %17' in function 'main' from
    './main___%1---%17.jscop.interchanged+tiled'.
Reading JScop 'for.cond =&gt; for.end30' in function 'main' from
    './main___%for.cond---%for.end30.jscop.interchanged+tiled'.
</pre>
<pre class="code">
opt -basicaa \
@@ -393,11 +393,11 @@ opt -basicaa \
    -polly-codegen -polly-vectorizer=polly matmul.preopt.ll \
   | opt -O3 &gt; matmul.polly.interchanged+tiled+vector.ll</pre>
<pre>
Reading JScop '%1 =&gt; %19' in function 'init_array' from
    './init_array___%1---%19.jscop.interchanged+tiled+vector'.
Reading JScop 'for.cond =&gt; for.end19' in function 'init_array' from
    './init_array___%for.cond---%for.end19.jscop.interchanged+tiled+vector'.
File could not be read: No such file or directory
Reading JScop '%1 =&gt; %17' in function 'main' from
    './main___%1---%17.jscop.interchanged+tiled+vector'.
Reading JScop 'for.cond =&gt; for.end30' in function 'main' from
    './main___%for.cond---%for.end30.jscop.interchanged+tiled+vector'.
</pre>
<pre class="code">
opt -basicaa \
@@ -405,11 +405,11 @@ opt -basicaa \
    -polly-codegen -polly-vectorizer=polly -enable-polly-openmp matmul.preopt.ll \
  | opt -O3 &gt; matmul.polly.interchanged+tiled+openmp.ll</pre>
<pre>
Reading JScop '%1 =&gt; %19' in function 'init_array' from
    './init_array___%1---%19.jscop.interchanged+tiled+vector'.
Reading JScop 'for.cond =&gt; for.end19' in function 'init_array' from
    './init_array___%for.cond---%for.end19.jscop.interchanged+tiled+vector'.
File could not be read: No such file or directory
Reading JScop '%1 =&gt; %17' in function 'main' from
    './main___%1---%17.jscop.interchanged+tiled+vector'.
Reading JScop 'for.cond =&gt; for.end30' in function 'main' from
    './main___%for.cond---%for.end30.jscop.interchanged+tiled+vector'.
</pre>

<li><h4>Create the executables</h4>
+21 −0
Original line number Diff line number Diff line
{
   "context" : "{ [] }",
   "name" : "%1 => %19",
   "context" : "{  :  }",
   "name" : "for.cond => for.end19",
   "statements" : [
      {
         "accesses" : [
            {
               "kind" : "write",
               "relation" : "{ Stmt_5[i0, i1] -> MemRef_A[1536i0 + i1] }"
               "relation" : "{ Stmt_for_body3[i0, i1] -> MemRef_A[1536i0 + i1] }"
            },
            {
               "kind" : "write",
               "relation" : "{ Stmt_5[i0, i1] -> MemRef_B[1536i0 + i1] }"
               "relation" : "{ Stmt_for_body3[i0, i1] -> MemRef_B[1536i0 + i1] }"
            }
         ],
         "domain" : "{ Stmt_5[i0, i1] : i0 >= 0 and i0 <= 1535 and i1 >= 0 and i1 <= 1535 }",
         "name" : "Stmt_5",
         "schedule" : "{ Stmt_5[i0, i1] -> scattering[0, i0, 0, i1, 0] }"
         "domain" : "{ Stmt_for_body3[i0, i1] : i0 >= 0 and i0 <= 1535 and i1 >= 0 and i1 <= 1535 }",
         "name" : "Stmt_for_body3",
         "schedule" : "{ Stmt_for_body3[i0, i1] -> scattering[0, i0, 0, i1, 0] }"
      }
   ]
}
+40 −0
Original line number Diff line number Diff line
{
   "context" : "{  :  }",
   "name" : "%1 => %17",
   "name" : "for.cond => for.end30",
   "statements" : [
      {
         "accesses" : [
            {
               "kind" : "write",
               "relation" : "{ Stmt_4[i0, i1] -> MemRef_C[1536i0 + i1] }"
               "relation" : "{ Stmt_for_body3[i0, i1] -> MemRef_C[1536i0 + i1] }"
            }
         ],
         "domain" : "{ Stmt_4[i0, i1] : i0 >= 0 and i0 <= 1535 and i1 >= 0 and i1 <= 1535 }",
         "name" : "Stmt_4",
         "schedule" : "{ Stmt_4[i0, i1] -> scattering[0, i0, 0, i1, 0, 0, 0] }"
         "domain" : "{ Stmt_for_body3[i0, i1] : i0 >= 0 and i0 <= 1535 and i1 >= 0 and i1 <= 1535 }",
         "name" : "Stmt_for_body3",
         "schedule" : "{ Stmt_for_body3[i0, i1] -> scattering[0, i0, 0, i1, 0, 0, 0] }"
      },
      {
         "accesses" : [
            {
               "kind" : "read",
               "relation" : "{ Stmt_6[i0, i1, i2] -> MemRef_C[1536i0 + i1] }"
               "relation" : "{ Stmt_for_body8[i0, i1, i2] -> MemRef_C[1536i0 + i1] }"
            },
            {
               "kind" : "read",
               "relation" : "{ Stmt_6[i0, i1, i2] -> MemRef_A[1536i0 + i2] }"
               "relation" : "{ Stmt_for_body8[i0, i1, i2] -> MemRef_A[1536i0 + i2] }"
            },
            {
               "kind" : "read",
               "relation" : "{ Stmt_6[i0, i1, i2] -> MemRef_B[i1 + 1536i2] }"
               "relation" : "{ Stmt_for_body8[i0, i1, i2] -> MemRef_B[i1 + 1536i2] }"
            },
            {
               "kind" : "write",
               "relation" : "{ Stmt_6[i0, i1, i2] -> MemRef_C[1536i0 + i1] }"
               "relation" : "{ Stmt_for_body8[i0, i1, i2] -> MemRef_C[1536i0 + i1] }"
            }
         ],
         "domain" : "{ Stmt_6[i0, i1, i2] : i0 >= 0 and i0 <= 1535 and i1 >= 0 and i1 <= 1535 and i2 >= 0 and i2 <= 1535 }",
         "name" : "Stmt_6",
         "schedule" : "{ Stmt_6[i0, i1, i2] -> scattering[0, i0, 0, i1, 1, i2, 0] }"
         "domain" : "{ Stmt_for_body8[i0, i1, i2] : i0 >= 0 and i0 <= 1535 and i1 >= 0 and i1 <= 1535 and i2 >= 0 and i2 <= 1535 }",
         "name" : "Stmt_for_body8",
         "schedule" : "{ Stmt_for_body8[i0, i1, i2] -> scattering[0, i0, 0, i1, 1, i2, 0] }"
      }
   ]
}
Loading