This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch][graphite] Correct matrix format for polylib


Konrad,
I've committed your patch for fixing the size of the matrices for
the polylib format.  Could you verify in the attached patch that
the email address in the Changelog.graphite is the right one?

Thanks for the patch,
Sebastian
-- 
AMD - GNU Tools
Index: graphite.c
===================================================================
--- graphite.c	(revision 130805)
+++ graphite.c	(working copy)
@@ -885,13 +885,13 @@ scan_tree_for_params (scop_p scop, tree 
       break;
 
     case SSA_NAME:
-      col = scop_nb_loops (scop) + param_index (expr, scop);
+      col = scop_nb_loops (scop) + param_index (expr, scop) + 1;
       value_init (cstr->p[row][col]);
       value_assign (cstr->p[row][col], k);
       break;
 
     case INTEGER_CST:
-      col = scop_nb_loops (scop) + scop_nb_params (scop);
+      col = scop_nb_loops (scop) + scop_nb_params (scop) + 1;
       value_init (cstr->p[row][col]);
       value_set_si (cstr->p[row][col], int_cst_value (expr));
       break;
@@ -927,6 +927,8 @@ first_loop_in_scop (scop_p scop)
   return NULL;
 }
 
+static unsigned int nb_flat_iterator;
+
 /* Converts LOOP in SCOP to cloog's format.  NB_ITERATORS is the
    number of loops surrounding LOOP in SCOP.  OUTER_CSTR gives the
    constraints matrix for the surrounding loops.  */
@@ -935,7 +937,7 @@ static CloogLoop *
 setup_cloog_loop (scop_p scop, struct loop *loop, CloogMatrix *outer_cstr,
 		  int nb_iterators)
 {
-  unsigned i, j, row;
+  unsigned i, j, row, col;
   unsigned nb_rows = outer_cstr->NbRows + 1;
   unsigned nb_cols = outer_cstr->NbColumns;
   CloogMatrix *cstr;
@@ -958,23 +960,32 @@ setup_cloog_loop (scop_p scop, struct lo
 
   /* 0 <= loop_i */
   row = outer_cstr->NbRows;
-  value_init (cstr->p[row][row]);
-  value_set_si (cstr->p[row][row], 1);
+  col = ++nb_flat_iterator;
+
+  value_init (cstr->p[row][0]);
+  value_set_si (cstr->p[row][0], 1);
+  value_init (cstr->p[row][col]);
+  value_set_si (cstr->p[row][col], 1);
 
   /* loop_i <= nb_iters */
   row++;
-
+  value_init (cstr->p[row][0]);
+  value_set_si (cstr->p[row][0], 1);
+  
   if (TREE_CODE (nb_iters) == INTEGER_CST)
     {
-      value_init (cstr->p[row][row]);
-      value_set_si (cstr->p[row][row], -1);
+      value_init (cstr->p[row][col]);
+      value_set_si (cstr->p[row][col], -1);
 
-      value_init (cstr->p[row][scop_dim_domain (scop) - 1]);
-      value_set_si (cstr->p[row][scop_dim_domain (scop) - 1],
+      value_init (cstr->p[row][scop_dim_domain (scop)]);
+      value_set_si (cstr->p[row][scop_dim_domain (scop)],
 		    int_cst_value (nb_iters));
     }
   else if (!chrec_contains_undetermined (nb_iters))
     {
+      value_init (cstr->p[row][col]);
+      value_set_si (cstr->p[row][col], -1);
+
       /* Otherwise nb_iters contains parameters: scan the nb_iters
 	 expression and build its matrix representation.  */
       Value one;
@@ -1017,7 +1028,8 @@ build_scop_iteration_domain (scop_p scop
   if (loop == NULL)
     return false;
 
-  outer_cstr = cloog_matrix_alloc (0, scop_dim_domain (scop));
+  outer_cstr = cloog_matrix_alloc (0, scop_dim_domain (scop) + 1);
+  nb_flat_iterator = 0;
   SCOP_PROG (scop)->loop = setup_cloog_loop (scop, loop, outer_cstr, 0);
   return true;
 }
Index: ChangeLog.graphite
===================================================================
--- ChangeLog.graphite	(revision 130806)
+++ ChangeLog.graphite	(working copy)
@@ -1,3 +1,12 @@
+2007-12-12  Konrad Trifunovic  <konrad.trifunovic@inria.fr>
+
+	* graphite.c (scan_tree_for_params): Correct the number of columns
+	for polylib format.
+	(nb_flat_iterator): New.
+	(setup_cloog_loop): Initialize to 1 the first column for inequalities.
+	(build_scop_iteration_domain): Correct the number of columns for 
+	polylib format.
+
 2007-12-12  Sebastian Pop  <sebastian.pop@amd.com>
 
 	* Merge from mainline (129697:130800).

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]