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]

Re: [autovect] Make omega agree with existing dependence tester


On 3/22/06, Sebastian Pop <sebpop@gmail.com> wrote:
> On 3/22/06, Sebastian Pop <sebpop@gmail.com> wrote:
> > The patch bootstraps on amd64-linux and produces 2 fails that I think are not
> > important because I verified that the distance vectors are correct, and the
> > corresponding cases are vectorized, but it is safer to ask Dorit to
> > look at these:
> > FAIL: gcc.dg/vect/vect-104.c scan-tree-dump-times possible dependence
> > between data-refs 1
> > FAIL: gcc.dg/vect/vect-99.c scan-tree-dump-times dependence distance
> > modulo vf == 0 1
> >
>
> I have tracked down these fails and it seems that my patch was not complete
> as I missed to modify the uses of the data dep analyzer in the vectorizer.
> I'm working on a patch to correct these fails.
>
> Sebastian
>

Here is a patch that corrects these two fails.  Bootstrapped on amd64-linux
and tested with RUNTESTFLAGS=vect.exp
Committed to autovect branch.

Sebastian

	* tree-data-ref.c (index_in_loop_nest): Moved...
	* tree-data-ref.h: Remove duplicate definitions of some macros.
	(index_in_loop_nest): ...here.
	* tree-vect-analyze.c (vect_analyze_data_ref_dependence): Use
	DDR_LOOP_NEST and index_in_loop_nest to determine the dependence
	distance.
Index: tree-data-ref.c
===================================================================
--- tree-data-ref.c	(revision 112300)
+++ tree-data-ref.c	(working copy)
@@ -3386,22 +3386,6 @@ save_dir_v (struct data_dependence_relat
   VEC_safe_push (lambda_vector, heap, DDR_DIR_VECTS (ddr), dir_v);
 }
 
-/* Return the index of the variable VAR in the LOOP_NEST array.  */
-
-static int
-index_in_loop_nest (int var, VEC (loop_p, heap) *loop_nest)
-{
-  struct loop *loopi;
-  int var_index;
-
-  for (var_index = 0; VEC_iterate (loop_p, loop_nest, var_index, loopi);
-       var_index++)
-    if (loopi->num == var)
-      break;
-
-  return var_index;
-}
-
 /* Add a distance of 1 on all the loops outer than INDEX.  If we
    haven't yet determined a distance for this outer loop, push a new
    distance vector composed of the previous distance, and a distance
Index: tree-data-ref.h
===================================================================
--- tree-data-ref.h	(revision 112300)
+++ tree-data-ref.h	(working copy)
@@ -278,17 +278,6 @@ DEF_VEC_ALLOC_P(ddr_p,heap);
 #define DDR_CSYS(DDR) DDR->dependence_constraint_system
 #define DDR_POLYHEDRON(DDR) DDR->dependence_polyhedron
 
-#define DDR_DIST_VECTS(DDR) ((DDR)->dist_vects)
-#define DDR_DIR_VECTS(DDR) ((DDR)->dir_vects)
-#define DDR_NUM_DIST_VECTS(DDR) \
-  (VEC_length (lambda_vector, DDR_DIST_VECTS (DDR)))
-#define DDR_NUM_DIR_VECTS(DDR) \
-  (VEC_length (lambda_vector, DDR_DIR_VECTS (DDR)))
-#define DDR_DIR_VECT(DDR, I) \
-  VEC_index (lambda_vector, DDR_DIR_VECTS (DDR), I)
-#define DDR_DIST_VECT(DDR, I) \
-  VEC_index (lambda_vector, DDR_DIST_VECTS (DDR), I)
-
 
 
 extern tree find_data_references_in_loop (struct loop *, varray_type *);
@@ -314,6 +303,22 @@ extern void free_data_refs (varray_type)
 extern struct data_reference *analyze_array (tree, tree, bool);
 extern void estimate_iters_using_array (tree, tree);
 
+/* Return the index of the variable VAR in the LOOP_NEST array.  */
+
+static inline int
+index_in_loop_nest (int var, VEC (loop_p, heap) *loop_nest)
+{
+  struct loop *loopi;
+  int var_index;
+
+  for (var_index = 0; VEC_iterate (loop_p, loop_nest, var_index, loopi);
+       var_index++)
+    if (loopi->num == var)
+      break;
+
+  return var_index;
+}
+
 
 
 #endif  /* GCC_TREE_DATA_REF_H  */
Index: tree-vect-analyze.c
===================================================================
--- tree-vect-analyze.c	(revision 112238)
+++ tree-vect-analyze.c	(working copy)
@@ -881,14 +881,14 @@ vect_analyze_data_ref_dependence (struct
   unsigned int i;
   struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
   int vectorization_factor = LOOP_VINFO_VECT_FACTOR (loop_vinfo);
-  unsigned int loop_depth = 0;
-  struct loop *loop_nest = loop;
   struct data_reference *dra = DDR_A (ddr);
   struct data_reference *drb = DDR_B (ddr);
   stmt_vec_info stmtinfo_a = vinfo_for_stmt (DR_STMT (dra)); 
   stmt_vec_info stmtinfo_b = vinfo_for_stmt (DR_STMT (drb));
   int dra_size = GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (DR_REF (dra))));
   int drb_size = GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (DR_REF (drb))));
+  lambda_vector dist_v;
+  unsigned int loop_depth;
          
   if (DDR_ARE_DEPENDENT (ddr) == chrec_known)
     {
@@ -925,16 +925,10 @@ vect_analyze_data_ref_dependence (struct
       return true;
     }    
 
-  /* Find loop depth.  */
-  while (loop_nest && loop_nest->outer && loop_nest->outer->outer)
+  loop_depth = index_in_loop_nest (loop->num, DDR_LOOP_NEST (ddr));
+  for (i = 0; VEC_iterate (lambda_vector, DDR_DIST_VECTS (ddr), i, dist_v); i++)
     {
-      loop_nest = loop_nest->outer;
-      loop_depth++;
-    }
-
-  for (i = 0; i < DDR_NUM_DIST_VECTS (ddr); i++)
-    {
-      int dist = DDR_DIST_VECT (ddr, i)[loop_depth];
+      int dist = dist_v[loop_depth];
 
       if (vect_print_dump_info (REPORT_DR_DETAILS))
 	fprintf (vect_dump, "dependence distance  = %d.", dist);

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