public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 1/2] [graphite] add testsuite automatic dg-options and dg-do action for isl-ast-gen-* and fuse-* files
@ 2015-11-11 19:40 Sebastian Pop
  2015-11-11 19:40 ` [PATCH 2/2] [graphite] improve construction of the original schedule Sebastian Pop
  0 siblings, 1 reply; 2+ messages in thread
From: Sebastian Pop @ 2015-11-11 19:40 UTC (permalink / raw)
  To: sebpop; +Cc: gcc-patches, hiraditya, Sebastian Pop

---
 gcc/testsuite/gcc.dg/graphite/fuse-1.c                  | 10 +++-------
 gcc/testsuite/gcc.dg/graphite/fuse-2.c                  |  4 +---
 gcc/testsuite/gcc.dg/graphite/graphite.exp              |  2 ++
 gcc/testsuite/gcc.dg/graphite/isl-ast-gen-blocks-1.c    |  3 ---
 gcc/testsuite/gcc.dg/graphite/isl-ast-gen-blocks-2.c    |  3 ---
 gcc/testsuite/gcc.dg/graphite/isl-ast-gen-blocks-3.c    |  3 ---
 gcc/testsuite/gcc.dg/graphite/isl-ast-gen-blocks-4.c    |  3 ---
 gcc/testsuite/gcc.dg/graphite/isl-ast-gen-if-1.c        |  3 ---
 gcc/testsuite/gcc.dg/graphite/isl-ast-gen-if-2.c        |  3 ---
 .../gcc.dg/graphite/isl-ast-gen-single-loop-1.c         |  3 ---
 .../gcc.dg/graphite/isl-ast-gen-single-loop-2.c         |  2 --
 .../gcc.dg/graphite/isl-ast-gen-single-loop-3.c         |  2 --
 gcc/testsuite/gcc.dg/graphite/isl-ast-gen-user-1.c      | 12 +++++-------
 .../gcc.dg/graphite/isl-codegen-loop-dumping.c          | 17 -----------------
 14 files changed, 11 insertions(+), 59 deletions(-)
 delete mode 100644 gcc/testsuite/gcc.dg/graphite/isl-codegen-loop-dumping.c

diff --git a/gcc/testsuite/gcc.dg/graphite/fuse-1.c b/gcc/testsuite/gcc.dg/graphite/fuse-1.c
index c9bb67d..249276c 100644
--- a/gcc/testsuite/gcc.dg/graphite/fuse-1.c
+++ b/gcc/testsuite/gcc.dg/graphite/fuse-1.c
@@ -1,7 +1,6 @@
 /* Check that the two loops are fused and that we manage to fold the two xor
    operations.  */
-/* { dg-options "-O2 -floop-nest-optimize -fdump-tree-forwprop-all" } */
-/* { dg-do run } */
+/* { dg-options "-O2 -floop-nest-optimize -fdump-tree-forwprop-all -fdump-tree-graphite-all" } */
 
 /* Make sure we fuse the loops like this:
 ISL AST generated by ISL:
@@ -9,15 +8,12 @@ for (int c0 = 0; c0 <= 99; c0 += 1) {
   S_3(c0);
   S_6(c0);
   S_9(c0);
-}
-*/
-/* { dg-final { scan-tree-dump-times "ISL AST generated by ISL:.*for (int c0 = 0; c0 <= 99; c0 += 1) \{.*S_.*(c0);.*S_.*(c0);.*S_.*(c0);.*\}" 1 "graphite" } } */
+} */
+/* { dg-final { scan-tree-dump-times "ISL AST generated by ISL:.*for \\(int c0 = 0; c0 <= 99; c0 \\+= 1\\) \\{.*S_.*\\(c0\\);.*S_.*\\(c0\\);.*S_.*\\(c0\\);.*\\}" 1 "graphite" } } */
 
 /* Check that after fusing the loops, the scalar computation is also fused.  */
 /* { dg-final { scan-tree-dump-times "gimple_simplified to\[^\\n\]*\\^ 12" 1 "forwprop4" } } */
 
-
-
 #define MAX 100
 int A[MAX];
 
diff --git a/gcc/testsuite/gcc.dg/graphite/fuse-2.c b/gcc/testsuite/gcc.dg/graphite/fuse-2.c
index aaa5e2f..2f27c66 100644
--- a/gcc/testsuite/gcc.dg/graphite/fuse-2.c
+++ b/gcc/testsuite/gcc.dg/graphite/fuse-2.c
@@ -1,6 +1,4 @@
 /* Check that the three loops are fused.  */
-/* { dg-options "-O2 -floop-nest-optimize" } */
-/* { dg-do run } */
 
 /* Make sure we fuse the loops like this:
 ISL AST generated by ISL:
@@ -11,7 +9,7 @@ for (int c0 = 0; c0 <= 99; c0 += 1) {
 }
 */
 
-/* { dg-final { scan-tree-dump-times "ISL AST generated by ISL:.*for (int c0 = 0; c0 <= 99; c0 += 1) \{.*S_.*(c0);.*S_.*(c0);.*S_.*(c0);.*\}" 1 "graphite" } } */
+/* { dg-final { scan-tree-dump-times "ISL AST generated by ISL:.*for \\(int c0 = 0; c0 <= 99; c0 \\+= 1\\) \\{.*S_.*\\(c0\\);.*S_.*\\(c0\\);.*S_.*\\(c0\\);.*\\}" 1 "graphite" } } */
 
 #define MAX 100
 int A[MAX], B[MAX], C[MAX];
diff --git a/gcc/testsuite/gcc.dg/graphite/graphite.exp b/gcc/testsuite/gcc.dg/graphite/graphite.exp
index f2d1417..8e1a229 100644
--- a/gcc/testsuite/gcc.dg/graphite/graphite.exp
+++ b/gcc/testsuite/gcc.dg/graphite/graphite.exp
@@ -43,6 +43,8 @@ set id_files          [lsort [glob -nocomplain $srcdir/$subdir/id-*.c ] ]
 set run_id_files      [lsort [glob -nocomplain $srcdir/$subdir/run-id-*.c ] ]
 set opt_files         [lsort [glob -nocomplain $srcdir/$subdir/interchange-*.c \
 					       $srcdir/$subdir/uns-interchange-*.c \
+					       $srcdir/$subdir/isl-ast-gen-*.c \
+					       $srcdir/$subdir/fuse-*.c \
 					       $srcdir/$subdir/block-*.c \
 					       $srcdir/$subdir/uns-block-*.c ] ]
 set vect_files        [lsort [glob -nocomplain $srcdir/$subdir/vect-*.c ] ]
diff --git a/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-blocks-1.c b/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-blocks-1.c
index 6146b18..cd67d87 100644
--- a/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-blocks-1.c
+++ b/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-blocks-1.c
@@ -1,6 +1,3 @@
-/* { dg-do run } */
-/* { dg-options "-O2 -fgraphite-identity" } */
-
 int n = 50;
 static int __attribute__((noinline))
 foo ()
diff --git a/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-blocks-2.c b/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-blocks-2.c
index 42ff30a..d97a8ab 100644
--- a/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-blocks-2.c
+++ b/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-blocks-2.c
@@ -1,6 +1,3 @@
-/* { dg-do run } */
-/* { dg-options "-O2 -fgraphite-identity" } */
-
 int k = 50;
 static int __attribute__((noinline))
 foo ()
diff --git a/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-blocks-3.c b/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-blocks-3.c
index 771d337..9c5223c 100644
--- a/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-blocks-3.c
+++ b/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-blocks-3.c
@@ -1,6 +1,3 @@
-/* { dg-do run } */
-/* { dg-options "-O2 -fgraphite-identity" } */
-
 /* We use a global variable 'k' to avoid ipa-cp. */
 int k = 50;
 static int __attribute__((noinline))
diff --git a/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-blocks-4.c b/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-blocks-4.c
index 803eea7..45ecad5 100644
--- a/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-blocks-4.c
+++ b/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-blocks-4.c
@@ -1,6 +1,3 @@
-/* { dg-do run } */
-/* { dg-options "-O2 -fgraphite-identity" } */
-
 static int __attribute__((noinline))
 foo (int k, int n1, int n2, int n3)
 {
diff --git a/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-if-1.c b/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-if-1.c
index 2b05c7b..a0eb242 100644
--- a/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-if-1.c
+++ b/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-if-1.c
@@ -1,6 +1,3 @@
-/* { dg-do run } */
-/* { dg-options "-O2 -fgraphite-identity" } */
-
 int st = 1;
 static void __attribute__((noinline))
 foo (int a[], int n)
diff --git a/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-if-2.c b/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-if-2.c
index 90111e7..27e7fa4 100644
--- a/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-if-2.c
+++ b/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-if-2.c
@@ -1,6 +1,3 @@
-/* { dg-do run } */
-/* { dg-options "-O2 -fgraphite-identity" } */
-
 /* This test case tests reduction, where the pbbs are duplicated.  */
 
 static int __attribute__((noinline))
diff --git a/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-single-loop-1.c b/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-single-loop-1.c
index 754452b..6c141a1 100644
--- a/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-single-loop-1.c
+++ b/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-single-loop-1.c
@@ -1,6 +1,3 @@
-/* { dg-do run } */
-/* { dg-options "-O2 -fgraphite-identity" } */
-
 int
 foo ()
 {
diff --git a/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-single-loop-2.c b/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-single-loop-2.c
index 04c7dba..d37a493 100644
--- a/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-single-loop-2.c
+++ b/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-single-loop-2.c
@@ -1,5 +1,3 @@
-/* { dg-do run } */
-/* { dg-options "-O2 -fgraphite-identity" } */
 int n = 50;
 
 void
diff --git a/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-single-loop-3.c b/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-single-loop-3.c
index 204acd3..d96f99f 100644
--- a/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-single-loop-3.c
+++ b/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-single-loop-3.c
@@ -1,5 +1,3 @@
-/* { dg-do run } */
-/* { dg-options "-O2 -fgraphite-identity" } */
 int n = 50;
 
 void
diff --git a/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-user-1.c b/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-user-1.c
index 760c1a2..8f246d8 100644
--- a/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-user-1.c
+++ b/gcc/testsuite/gcc.dg/graphite/isl-ast-gen-user-1.c
@@ -1,14 +1,10 @@
-/* { dg-do compile } */
-/* { dg-options "-O2 -fgraphite-identity" } */
-
-#include <stdio.h>
-#include <stdlib.h>
-
 static const int N = 12;
+int nSlip;
 
-void Crystal_Cholesky (int nSlip, int a[N][N])
+int main ()
 {
   int i, j, k, fdot = 0;
+  int a[N][N];
 
   for ( i = 1; i < nSlip; i++)
     {
@@ -19,6 +15,8 @@ void Crystal_Cholesky (int nSlip, int a[N][N])
           a[i][j] = a[i][j] - fdot;
         }
    }
+
+  return 0;
 }
 
 
diff --git a/gcc/testsuite/gcc.dg/graphite/isl-codegen-loop-dumping.c b/gcc/testsuite/gcc.dg/graphite/isl-codegen-loop-dumping.c
deleted file mode 100644
index 70ac24c..0000000
--- a/gcc/testsuite/gcc.dg/graphite/isl-codegen-loop-dumping.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/* { dg-options "-O2 -fgraphite-identity -fdump-tree-graphite-all" } */
-
-int
-main (int n, int *a)
-{
-  int i, j;
-
-  for (i = 0; i < n - 1; i++)
-    for (j = 0; j < n; j++)
-      a[j] = i + n;
-
-  return 0;
-}
-
-/* { dg-final { scan-tree-dump-times "ISL AST generated by ISL: \n\\{\n  S_2\\();\n  if \\(P_19 >= 1\\)\n
-    for \\(int c1 = 0; c1 < n - 1; c1 \\+= 1\\) \\{ \n      for \\(int c3 = 0; c3 < n; c3 \\+= 1\\)\n
-        S_4\\(c1, c3\\); \n      S_6\\(c1\\);\n    \\}    \n\\}" 1 "graphite"} } */
-- 
1.9.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 2/2] [graphite] improve construction of the original schedule
  2015-11-11 19:40 [PATCH 1/2] [graphite] add testsuite automatic dg-options and dg-do action for isl-ast-gen-* and fuse-* files Sebastian Pop
@ 2015-11-11 19:40 ` Sebastian Pop
  0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Pop @ 2015-11-11 19:40 UTC (permalink / raw)
  To: sebpop; +Cc: gcc-patches, hiraditya, Sebastian Pop

The patch builds the original schedule based on the now optimized scattering
dimension instead of building one based on the loop index only.

The implementation is simpler and catches more cases where the original schedule
and the transformed schedule are the same, such as the one below:

for (i = 0; i < 1000; i++)
{
  Temp = F[i];
  for (j = 0; j < 1000; j++)
 {
    D[j] = E[j]  * Temp;
    A[i][j] = A[i][j]  + B[i][j] * C[i][j] - D[j] ;
  }
  D[i] = E[i] * F[i];
}

  * graphite-sese-to-poly.c (build_scop_original_schedule): Call
  isl_union_map_add_map on every pbb->schedule.
---
 gcc/graphite-sese-to-poly.c | 27 +++++++++++----------------
 1 file changed, 11 insertions(+), 16 deletions(-)

diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
index ba45199..3c24512 100644
--- a/gcc/graphite-sese-to-poly.c
+++ b/gcc/graphite-sese-to-poly.c
@@ -446,31 +446,26 @@ build_scop_minimal_scattering (scop_p scop)
      }
 
    Static schedules for A to D expressed in a union map:
-
-   { S_A[i0, i1] -> [i0, i1]; S_B[i0] -> [i0]; S_C[] -> []; S_9[i0] -> [i0] }
-
+   {
+     S_A[i0, i1] -> [0, i0, 0, i1];
+     S_B[i0]     -> [0, i0, 1];
+     S_C[]       -> [1];
+     S_D[i0]     -> [2, i0, 0]
+   }
 */
 
 static void
 build_scop_original_schedule (scop_p scop)
 {
+  int i;
+  poly_bb_p pbb;
+
   isl_space *space = isl_set_get_space (scop->param_context);
   isl_union_map *res = isl_union_map_empty (space);
 
-  int i;
-  poly_bb_p pbb;
   FOR_EACH_VEC_ELT (scop->pbbs, i, pbb)
-    {
-      int nb_dimensions = isl_set_dim (pbb->domain, isl_dim_set);
-      isl_space *dc = isl_set_get_space (pbb->domain);
-      isl_space *dm = isl_space_add_dims (isl_space_from_domain (dc),
-					  isl_dim_out, nb_dimensions);
-      isl_map *mp = isl_map_universe (dm);
-      for (int i = 0; i < nb_dimensions; i++)
-	mp = isl_map_equate (mp, isl_dim_in, i, isl_dim_out, i);
-
-      res = isl_union_map_add_map (res, mp);
-    }
+    res = isl_union_map_add_map (res, isl_map_copy (pbb->schedule));
+
   scop->original_schedule = res;
 }
 
-- 
1.9.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-11-11 19:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-11 19:40 [PATCH 1/2] [graphite] add testsuite automatic dg-options and dg-do action for isl-ast-gen-* and fuse-* files Sebastian Pop
2015-11-11 19:40 ` [PATCH 2/2] [graphite] improve construction of the original schedule Sebastian Pop

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).