public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Devang Patel <dpatel@apple.com>
To: Richard Henderson <rth@redhat.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] AV - Use distance vector
Date: Wed, 22 Sep 2004 19:54:00 -0000	[thread overview]
Message-ID: <9A02536A-0CCE-11D9-9D86-000393A91CAA@apple.com> (raw)
In-Reply-To: <20040921214329.GB32068@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1237 bytes --]


On Sep 21, 2004, at 2:43 PM, Richard Henderson wrote:

> On Thu, Sep 16, 2004 at 09:48:51AM -0700, Devang Patel wrote:
>> +       if (SUB_DISTANCE (subscript) == integer_zero_node)
>
> integer_zerop.
>
>> +       else if (INT_CST_LT (vf, SUB_DISTANCE (subscript)))
>> + 	{
>> + 	  dep_exists = false;
>> +
>> + 	  if (TREE_INT_CST_LOW (vf) == TREE_INT_CST_LOW (SUB_DISTANCE 
>> (subscript))
>> + 	      && TREE_INT_CST_HIGH (vf) == TREE_INT_CST_HIGH (SUB_DISTANCE 
>> (subscript)))
>
> Both can be done with one tree_int_cst_compare.

How about following? Bootstrapped and tested on powerpc-darwin. I also 
included Dorit's
feedback to check subscript for given loop depth only.

ChangeLog entry is same.

OK?
Thanks,
-
Devang


2004-09-22  Devang Patel  <dpatel@apple.com>

         * tree-data-ref.c (compute_distance_vector): Export.
         * tree-data-ref.h (compute_distance_vector): Same.
         * tree-vectorizer.c (vect_analyze_data_ref_dependence): new 
parameter,
         loop_vinfo. Use distance vector.
         (vect_analyze_data_ref_dependences): Supply new parameter.
         (vect_analyze_loop): Analyze operations before data dependences.

         testsuite

         * gcc.dg/vect/vect-20040915-1.c: New test.


[-- Attachment #2: ifc2_fsf_mainline.2.1.diff --]
[-- Type: application/octet-stream, Size: 7814 bytes --]

Index: gcc/tree-data-ref.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-data-ref.h,v
retrieving revision 2.4
diff -Idpatel.pbxuser -c -3 -p -r2.4 tree-data-ref.h
*** gcc/tree-data-ref.h	10 Sep 2004 15:09:38 -0000	2.4
--- gcc/tree-data-ref.h	22 Sep 2004 19:25:04 -0000
*************** struct data_dependence_relation
*** 147,152 ****
--- 147,153 ----
  struct data_dependence_relation *initialize_data_dependence_relation 
  (struct data_reference *, struct data_reference *);
  void compute_affine_dependence (struct data_dependence_relation *);
+ void compute_distance_vector (struct data_dependence_relation *ddr);
  extern void analyze_all_data_dependences (struct loops *);
  extern void compute_data_dependences_for_loop (unsigned, struct loop *, 
  					       varray_type *, varray_type *);
Index: gcc/tree-data-ref.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-data-ref.c,v
retrieving revision 2.7
diff -Idpatel.pbxuser -c -3 -p -r2.7 tree-data-ref.c
*** gcc/tree-data-ref.c	10 Sep 2004 15:09:38 -0000	2.7
--- gcc/tree-data-ref.c	22 Sep 2004 19:25:04 -0000
*************** init_data_ref (tree stmt, 
*** 598,604 ****
  /* When there exists a dependence relation, determine its distance
     vector.  */
  
! static void
  compute_distance_vector (struct data_dependence_relation *ddr)
  {
    if (DDR_ARE_DEPENDENT (ddr) == NULL_TREE)
--- 598,604 ----
  /* When there exists a dependence relation, determine its distance
     vector.  */
  
! void
  compute_distance_vector (struct data_dependence_relation *ddr)
  {
    if (DDR_ARE_DEPENDENT (ddr) == NULL_TREE)
Index: gcc/tree-vectorizer.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-vectorizer.c,v
retrieving revision 2.8
diff -Idpatel.pbxuser -c -3 -p -r2.8 tree-vectorizer.c
*** gcc/tree-vectorizer.c	10 Sep 2004 10:44:47 -0000	2.8
--- gcc/tree-vectorizer.c	22 Sep 2004 19:25:05 -0000
*************** vect_analyze_scalar_cycles (loop_vec_inf
*** 1973,1982 ****
  static bool
  vect_analyze_data_ref_dependence (struct data_reference *dra,
  				  struct data_reference *drb, 
! 				  struct loop *loop)
  {
    bool differ_p;
    struct data_dependence_relation *ddr;
  
    if (!array_base_name_differ_p (dra, drb, &differ_p))
      {
--- 2116,2131 ----
  static bool
  vect_analyze_data_ref_dependence (struct data_reference *dra,
  				  struct data_reference *drb, 
! 				  struct loop *loop,
! 				  loop_vec_info loop_info)
  {
    bool differ_p;
    struct data_dependence_relation *ddr;
+   unsigned int i, loop_depth = 0;
+   struct loop *tloop;
+   struct subscript *subscript;
+   int vectorization_factor = LOOP_VINFO_VECT_FACTOR (loop_info);
+   tree vf = NULL_TREE;
  
    if (!array_base_name_differ_p (dra, drb, &differ_p))
      {
*************** vect_analyze_data_ref_dependence (struct
*** 2000,2005 ****
--- 2149,2166 ----
    if (DDR_ARE_DEPENDENT (ddr) == chrec_known)
      return false;
    
+   /* Check distance vector.  */
+   compute_distance_vector (ddr);
+   vf = build_int_cst (unsigned_type_node, vectorization_factor);
+ 
+   tloop = loop->outer;
+   for (i = 0; tloop; tloop = tloop->outer, loop_depth++);
+   loop_depth--;
+   subscript = DDR_SUBSCRIPT (ddr, loop_depth);
+   if (integer_zerop (SUB_DISTANCE (subscript))
+       || (tree_int_cst_compare (SUB_DISTANCE (subscript), vf) == 1))
+     return false;
+ 
    if (vect_debug_stats (loop) || vect_debug_details (loop))
      {
        fprintf (dump_file,
*************** vect_analyze_data_ref_dependences (loop_
*** 2045,2051 ****
  	    VARRAY_GENERIC_PTR (loop_write_refs, i);
  	  struct data_reference *drb =
  	    VARRAY_GENERIC_PTR (loop_write_refs, j);
! 	  if (vect_analyze_data_ref_dependence (dra, drb, loop))
  	    return false;
  	}
      }
--- 2206,2212 ----
  	    VARRAY_GENERIC_PTR (loop_write_refs, i);
  	  struct data_reference *drb =
  	    VARRAY_GENERIC_PTR (loop_write_refs, j);
! 	  if (vect_analyze_data_ref_dependence (dra, drb, loop, loop_vinfo))
  	    return false;
  	}
      }
*************** vect_analyze_data_ref_dependences (loop_
*** 2062,2068 ****
  	  struct data_reference *dra = VARRAY_GENERIC_PTR (loop_read_refs, i);
  	  struct data_reference *drb =
  	    VARRAY_GENERIC_PTR (loop_write_refs, j);
! 	  if (vect_analyze_data_ref_dependence (dra, drb, loop))
  	    return false;
  	}
      }
--- 2223,2229 ----
  	  struct data_reference *dra = VARRAY_GENERIC_PTR (loop_read_refs, i);
  	  struct data_reference *drb =
  	    VARRAY_GENERIC_PTR (loop_write_refs, j);
! 	  if (vect_analyze_data_ref_dependence (dra, drb, loop, loop_vinfo))
  	    return false;
  	}
      }
*************** vect_analyze_loop (struct loop *loop)
*** 3275,3327 ****
      }
  
  
!   /* Analyze data dependences between the data-refs in the loop. 
!      FORNOW: fail at the first data dependence that we encounter.  */
  
!   ok = vect_analyze_data_ref_dependences (loop_vinfo);
    if (!ok)
      {
        if (vect_debug_details (loop))
! 	fprintf (dump_file, "bad data dependence.");
        destroy_loop_vec_info (loop_vinfo);
        return NULL;
      }
  
  
!   /* Analyze the access patterns of the data-refs in the loop (consecutive,
!      complex, etc.). FORNOW: Only handle consecutive access pattern.  */
  
!   ok = vect_analyze_data_ref_accesses (loop_vinfo);
    if (!ok)
      {
        if (vect_debug_details (loop))
! 	fprintf (dump_file, "bad data access.");
        destroy_loop_vec_info (loop_vinfo);
        return NULL;
      }
  
  
!   /* Analyze the alignment of the data-refs in the loop.
!      FORNOW: Only aligned accesses are handled.  */
! 
!   ok = vect_analyze_data_refs_alignment (loop_vinfo);
    if (!ok)
      {
        if (vect_debug_details (loop))
! 	fprintf (dump_file, "bad data alignment.");
        destroy_loop_vec_info (loop_vinfo);
        return NULL;
      }
  
  
!   /* Scan all the operations in the loop and make sure they are
!      vectorizable.  */
! 
!   ok = vect_analyze_operations (loop_vinfo);
    if (!ok)
      {
        if (vect_debug_details (loop))
! 	fprintf (dump_file, "bad operation or unsupported loop bound.");
        destroy_loop_vec_info (loop_vinfo);
        return NULL;
      }
--- 3436,3486 ----
      }
  
  
!   /* Analyze the alignment of the data-refs in the loop.
!      FORNOW: Only aligned accesses are handled.  */
  
!   ok = vect_analyze_data_refs_alignment (loop_vinfo);
    if (!ok)
      {
        if (vect_debug_details (loop))
! 	fprintf (dump_file, "bad data alignment.");
        destroy_loop_vec_info (loop_vinfo);
        return NULL;
      }
  
  
!   /* Scan all the operations in the loop and make sure they are
!      vectorizable.  */
  
!   ok = vect_analyze_operations (loop_vinfo);
    if (!ok)
      {
        if (vect_debug_details (loop))
! 	fprintf (dump_file, "bad operation or unsupported loop bound.");
        destroy_loop_vec_info (loop_vinfo);
        return NULL;
      }
  
+   /* Analyze data dependences between the data-refs in the loop. 
+      FORNOW: fail at the first data dependence that we encounter.  */
  
!   ok = vect_analyze_data_ref_dependences (loop_vinfo);
    if (!ok)
      {
        if (vect_debug_details (loop))
! 	fprintf (dump_file, "bad data dependence.");
        destroy_loop_vec_info (loop_vinfo);
        return NULL;
      }
  
+   /* Analyze the access patterns of the data-refs in the loop (consecutive,
+      complex, etc.). FORNOW: Only handle consecutive access pattern.  */
  
!   ok = vect_analyze_data_ref_accesses (loop_vinfo);
    if (!ok)
      {
        if (vect_debug_details (loop))
! 	fprintf (dump_file, "bad data access.");
        destroy_loop_vec_info (loop_vinfo);
        return NULL;
      }

[-- Attachment #3: Type: text/plain, Size: 1 bytes --]



  parent reply	other threads:[~2004-09-22 19:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-16 17:01 Devang Patel
2004-09-21 22:07 ` Richard Henderson
2004-09-21 22:17   ` Devang Patel
2004-09-22 19:54   ` Devang Patel [this message]
2004-09-22 20:37     ` Richard Henderson
2004-09-22 22:19       ` Devang Patel
2004-09-22 23:45         ` Richard Henderson
2004-09-28 20:04           ` Devang Patel
2004-10-12 21:36             ` Ping : " Devang Patel
2004-09-23  0:29 Richard Kenner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9A02536A-0CCE-11D9-9D86-000393A91CAA@apple.com \
    --to=dpatel@apple.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=rth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).