[PATCH 15/20] strip-mine with isl

Sebastian Pop sebpop@gmail.com
Mon Aug 15 07:14:00 GMT 2011


---
 gcc/graphite-blocking.c |   32 +++++++++++++++++++++++++++++++-
 1 files changed, 31 insertions(+), 1 deletions(-)

diff --git a/gcc/graphite-blocking.c b/gcc/graphite-blocking.c
index 429b405..0741f82 100644
--- a/gcc/graphite-blocking.c
+++ b/gcc/graphite-blocking.c
@@ -27,6 +27,7 @@ along with GCC; see the file COPYING3.  If not see
 #include <isl/set.h>
 #include <isl/map.h>
 #include <isl/union_map.h>
+#include <isl/constraint.h>
 #include <cloog/cloog.h>
 #include <cloog/isl/domain.h>
 #endif
@@ -112,9 +113,11 @@ pbb_strip_mine_time_depth (poly_bb_p pbb, int time_depth, int stride)
 
   psct_add_scattering_dimension (pbb, strip);
   psct_add_scattering_dimension (pbb, strip + 1);
-
   ppl_Polyhedron_space_dimension (res, &dim);
 
+  pbb->transformed = isl_map_insert_dims (pbb->transformed, isl_dim_out,
+					  strip, 2);
+
   /* Lower bound of the striped loop.  */
   {
     ppl_Constraint_t new_cstr;
@@ -128,6 +131,15 @@ pbb_strip_mine_time_depth (poly_bb_p pbb, int time_depth, int stride)
     ppl_delete_Linear_Expression (expr);
     ppl_Polyhedron_add_constraint (res, new_cstr);
     ppl_delete_Constraint (new_cstr);
+
+    {
+      isl_dim *d = isl_map_get_dim (pbb->transformed);
+      isl_constraint *c = isl_inequality_alloc (d);
+
+      c = isl_constraint_set_coefficient_si (c, isl_dim_out, strip, -stride);
+      c = isl_constraint_set_coefficient_si (c, isl_dim_out, iter, 1);
+      pbb->transformed = isl_map_add_constraint (pbb->transformed, c);
+    }
   }
 
   /* Upper bound of the striped loop.  */
@@ -144,6 +156,16 @@ pbb_strip_mine_time_depth (poly_bb_p pbb, int time_depth, int stride)
     ppl_delete_Linear_Expression (expr);
     ppl_Polyhedron_add_constraint (res, new_cstr);
     ppl_delete_Constraint (new_cstr);
+
+    {
+      isl_dim *d = isl_map_get_dim (pbb->transformed);
+      isl_constraint *c = isl_inequality_alloc (d);
+
+      c = isl_constraint_set_coefficient_si (c, isl_dim_out, strip, stride);
+      c = isl_constraint_set_coefficient_si (c, isl_dim_out, iter, -1);
+      c = isl_constraint_set_constant_si (c, stride - 1);
+      pbb->transformed = isl_map_add_constraint (pbb->transformed, c);
+    }
   }
 
   /* Static scheduling for ITER level.
@@ -160,6 +182,14 @@ pbb_strip_mine_time_depth (poly_bb_p pbb, int time_depth, int stride)
     ppl_delete_Linear_Expression (expr);
     ppl_Polyhedron_add_constraint (res, new_cstr);
     ppl_delete_Constraint (new_cstr);
+
+    {
+      isl_dim *d = isl_map_get_dim (pbb->transformed);
+      isl_constraint *c = isl_equality_alloc (d);
+
+      c = isl_constraint_set_coefficient_si (c, isl_dim_out, strip + 1, 1);
+      pbb->transformed = isl_map_add_constraint (pbb->transformed, c);
+    }
   }
 }
 
-- 
1.7.4.1



More information about the Gcc-patches mailing list