public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch] fix vectorizer dump print
@ 2007-12-17 20:55 Dorit Nuzman
  0 siblings, 0 replies; only message in thread
From: Dorit Nuzman @ 2007-12-17 20:55 UTC (permalink / raw)
  To: gcc-patches

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


In response to http://gcc.gnu.org/ml/gcc/2007-12/msg00459.html, this patch:

- removes the confusing printing "not vectorized: vectorization may not be
profitable" from REPORT_UNVECTORIZED_LOOPS
- instead print "vectorization may not be profitable" under a new verbosity
level REPORT_COST
- change (hopefully all) other cost-model printings to be printed under
REPORT_COST

Bootstrapped with vectorization enabled on powerp64-linux, and passed full
regression testing.
Also bootstrapped on i686-linux and passed full regression testing.
To be committed to mainline.

dorit

        * tree-vectorizer.h (verbosity_levels): Add new verbosity level
        REPORT_COST.
        * tree-vect-transform.c (vect_estimate_min_profitable_iters):
Change
        verbosity level to REPORT_COST.
        (vect_model_reduction_cost): Likewise.
        (vect_model_induction_cost): Likewise.
        (vect_model_simple_cost): likewise.
        (vect_model_store_cost): likewise..
        (vect_model_load_cost): likewise...
        (conservative_cost_threshold): Likewise. Remove print.

        * gcc.dg/tree-ssa/gen-vect-2.c: Change verbosity level to 4.:
        * gcc.dg/tree-ssa/gen-vect-32.c: Likewise
        * gcc.dg/tree-ssa/gen-vect-25.c: Likewise
        * gcc.dg/tree-ssa/gen-vect-26.c: Likewise
        * gcc.dg/tree-ssa/gen-vect-28.c: Likewise

(See attached file: printfix.txt)

[-- Attachment #2: printfix.txt --]
[-- Type: text/plain, Size: 18938 bytes --]

Index: ChangeLog
===================================================================
*** ChangeLog	(revision 131015)
--- ChangeLog	(working copy)
***************
*** 1,3 ****
--- 1,16 ----
+ 2007-12-17  Dorit Nuzman  <dorit@il.ibm.com>
+ 
+ 	* tree-vectorizer.h (verbosity_levels): Add new verbosity level
+ 	REPORT_COST.
+ 	* tree-vect-transform.c (vect_estimate_min_profitable_iters): Change
+ 	verbosity level to REPORT_COST.
+ 	(vect_model_reduction_cost): Likewise.
+ 	(vect_model_induction_cost): Likewise.
+ 	(vect_model_simple_cost): likewise.
+ 	(vect_model_store_cost): likewise.
+ 	(vect_model_load_cost): likewise.
+ 	(conservative_cost_threshold): Likewise. Remove print.
+ 
  2007-12-17  Rask Ingemann Lambertsen  <rask@sygehus.dk>
  
  	* doc/tm.texi (TARGET_SECONDARY_RELOAD): Fix typos.
Index: testsuite/gcc.dg/tree-ssa/gen-vect-2.c
===================================================================
*** testsuite/gcc.dg/tree-ssa/gen-vect-2.c	(revision 131015)
--- testsuite/gcc.dg/tree-ssa/gen-vect-2.c	(working copy)
***************
*** 1,5 ****
  /* { dg-do run { target vect_cmdline_needed } } */
! /* { dg-options "-O2 -ftree-vectorize -ftree-vectorizer-verbose=3 -fdump-tree-vect-stats" } */
  
  #include <stdlib.h>
  
--- 1,5 ----
  /* { dg-do run { target vect_cmdline_needed } } */
! /* { dg-options "-O2 -ftree-vectorize -ftree-vectorizer-verbose=4 -fdump-tree-vect-stats" } */
  
  #include <stdlib.h>
  
Index: testsuite/gcc.dg/tree-ssa/gen-vect-32.c
===================================================================
*** testsuite/gcc.dg/tree-ssa/gen-vect-32.c	(revision 131015)
--- testsuite/gcc.dg/tree-ssa/gen-vect-32.c	(working copy)
***************
*** 1,5 ****
  /* { dg-do run { target vect_cmdline_needed } } */
! /* { dg-options "-O2 -ftree-vectorize -ftree-vectorizer-verbose=3 -fdump-tree-vect-stats" } */
  
  #include <stdlib.h>
  
--- 1,5 ----
  /* { dg-do run { target vect_cmdline_needed } } */
! /* { dg-options "-O2 -ftree-vectorize -ftree-vectorizer-verbose=4 -fdump-tree-vect-stats" } */
  
  #include <stdlib.h>
  
Index: testsuite/gcc.dg/tree-ssa/gen-vect-25.c
===================================================================
*** testsuite/gcc.dg/tree-ssa/gen-vect-25.c	(revision 131015)
--- testsuite/gcc.dg/tree-ssa/gen-vect-25.c	(working copy)
***************
*** 1,5 ****
  /* { dg-do run { target vect_cmdline_needed } } */
! /* { dg-options "-O2 -ftree-vectorize -ftree-vectorizer-verbose=3 -fdump-tree-vect-stats" } */
  
  #include <stdlib.h>
  
--- 1,5 ----
  /* { dg-do run { target vect_cmdline_needed } } */
! /* { dg-options "-O2 -ftree-vectorize -ftree-vectorizer-verbose=4 -fdump-tree-vect-stats" } */
  
  #include <stdlib.h>
  
Index: testsuite/gcc.dg/tree-ssa/gen-vect-26.c
===================================================================
*** testsuite/gcc.dg/tree-ssa/gen-vect-26.c	(revision 131015)
--- testsuite/gcc.dg/tree-ssa/gen-vect-26.c	(working copy)
***************
*** 1,5 ****
  /* { dg-do run { target vect_cmdline_needed } } */
! /* { dg-options "-O2 -ftree-vectorize -ftree-vectorizer-verbose=3 -fdump-tree-vect-stats" } */
  
  #include <stdlib.h>
  
--- 1,5 ----
  /* { dg-do run { target vect_cmdline_needed } } */
! /* { dg-options "-O2 -ftree-vectorize -ftree-vectorizer-verbose=4 -fdump-tree-vect-stats" } */
  
  #include <stdlib.h>
  
Index: testsuite/gcc.dg/tree-ssa/gen-vect-28.c
===================================================================
*** testsuite/gcc.dg/tree-ssa/gen-vect-28.c	(revision 131015)
--- testsuite/gcc.dg/tree-ssa/gen-vect-28.c	(working copy)
***************
*** 1,5 ****
  /* { dg-do run { target vect_cmdline_needed } } */
! /* { dg-options "-O2 -ftree-vectorize -ftree-vectorizer-verbose=3 -fdump-tree-vect-stats" } */
  
  #include <stdlib.h>
  
--- 1,5 ----
  /* { dg-do run { target vect_cmdline_needed } } */
! /* { dg-options "-O2 -ftree-vectorize -ftree-vectorizer-verbose=4 -fdump-tree-vect-stats" } */
  
  #include <stdlib.h>
  
Index: testsuite/ChangeLog
===================================================================
*** testsuite/ChangeLog	(revision 131015)
--- testsuite/ChangeLog	(working copy)
***************
*** 1,3 ****
--- 1,11 ----
+ 2007-12-17  Dorit Nuzman  <dorit@il.ibm.com>
+ 
+ 	* gcc.dg/tree-ssa/gen-vect-2.c: Change verbosity level to 4.	
+ 	* gcc.dg/tree-ssa/gen-vect-32.c: Likewise
+ 	* gcc.dg/tree-ssa/gen-vect-25.c: Likewise
+ 	* gcc.dg/tree-ssa/gen-vect-26.c: Likewise
+ 	* gcc.dg/tree-ssa/gen-vect-28.c: Likewise
+ 
  2007-12-17  Jakub Jelinek  <jakub@redhat.com>
  
  	PR c/34506
Index: tree-vectorizer.h
===================================================================
*** tree-vectorizer.h	(revision 131015)
--- tree-vectorizer.h	(working copy)
*************** enum verbosity_levels {
*** 73,78 ****
--- 73,79 ----
    REPORT_NONE,
    REPORT_VECTORIZED_LOOPS,
    REPORT_UNVECTORIZED_LOOPS,
+   REPORT_COST,
    REPORT_ALIGNMENT,
    REPORT_DR_DETAILS,
    REPORT_BAD_FORM_LOOPS,
Index: tree-vect-transform.c
===================================================================
*** tree-vect-transform.c	(revision 131015)
--- tree-vect-transform.c	(working copy)
*************** vect_estimate_min_profitable_iters (loop
*** 134,140 ****
    /* Cost model disabled.  */
    if (!flag_vect_cost_model)
      {
!       if (vect_print_dump_info (REPORT_DETAILS))
          fprintf (vect_dump, "cost model disabled.");      
        return 0;
      }
--- 134,140 ----
    /* Cost model disabled.  */
    if (!flag_vect_cost_model)
      {
!       if (vect_print_dump_info (REPORT_COST))
          fprintf (vect_dump, "cost model disabled.");      
        return 0;
      }
*************** vect_estimate_min_profitable_iters (loop
*** 153,159 ****
        /*  FIXME: Make cost depend on complexity of individual check.  */
        vec_outside_cost +=
          VEC_length (tree, LOOP_VINFO_MAY_MISALIGN_STMTS (loop_vinfo));
!       if (vect_print_dump_info (REPORT_DETAILS))
          fprintf (vect_dump, "cost model: Adding cost of checks for loop "
                   "versioning to treat misalignment.\n");
      }
--- 153,159 ----
        /*  FIXME: Make cost depend on complexity of individual check.  */
        vec_outside_cost +=
          VEC_length (tree, LOOP_VINFO_MAY_MISALIGN_STMTS (loop_vinfo));
!       if (vect_print_dump_info (REPORT_COST))
          fprintf (vect_dump, "cost model: Adding cost of checks for loop "
                   "versioning to treat misalignment.\n");
      }
*************** vect_estimate_min_profitable_iters (loop
*** 163,169 ****
        /*  FIXME: Make cost depend on complexity of individual check.  */
        vec_outside_cost +=
          VEC_length (ddr_p, LOOP_VINFO_MAY_ALIAS_DDRS (loop_vinfo));
!       if (vect_print_dump_info (REPORT_DETAILS))
          fprintf (vect_dump, "cost model: Adding cost of checks for loop "
                   "versioning aliasing.\n");
      }
--- 163,169 ----
        /*  FIXME: Make cost depend on complexity of individual check.  */
        vec_outside_cost +=
          VEC_length (ddr_p, LOOP_VINFO_MAY_ALIAS_DDRS (loop_vinfo));
!       if (vect_print_dump_info (REPORT_COST))
          fprintf (vect_dump, "cost model: Adding cost of checks for loop "
                   "versioning aliasing.\n");
      }
*************** vect_estimate_min_profitable_iters (loop
*** 224,237 ****
    if (byte_misalign < 0)
      {
        peel_iters_prologue = vf/2;
!       if (vect_print_dump_info (REPORT_DETAILS))
          fprintf (vect_dump, "cost model: "
                   "prologue peel iters set to vf/2.");
  
        /* If peeling for alignment is unknown, loop bound of main loop becomes
           unknown.  */
        peel_iters_epilogue = vf/2;
!       if (vect_print_dump_info (REPORT_DETAILS))
          fprintf (vect_dump, "cost model: "
                   "epilogue peel iters set to vf/2 because "
                   "peeling for alignment is unknown .");
--- 224,237 ----
    if (byte_misalign < 0)
      {
        peel_iters_prologue = vf/2;
!       if (vect_print_dump_info (REPORT_COST))
          fprintf (vect_dump, "cost model: "
                   "prologue peel iters set to vf/2.");
  
        /* If peeling for alignment is unknown, loop bound of main loop becomes
           unknown.  */
        peel_iters_epilogue = vf/2;
!       if (vect_print_dump_info (REPORT_COST))
          fprintf (vect_dump, "cost model: "
                   "epilogue peel iters set to vf/2 because "
                   "peeling for alignment is unknown .");
*************** vect_estimate_min_profitable_iters (loop
*** 261,267 ****
        if (!LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo))
          {
            peel_iters_epilogue = vf/2;
!           if (vect_print_dump_info (REPORT_DETAILS))
              fprintf (vect_dump, "cost model: "
                       "epilogue peel iters set to vf/2 because "
                       "loop iterations are unknown .");
--- 261,267 ----
        if (!LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo))
          {
            peel_iters_epilogue = vf/2;
!           if (vect_print_dump_info (REPORT_COST))
              fprintf (vect_dump, "cost model: "
                       "epilogue peel iters set to vf/2 because "
                       "loop iterations are unknown .");
*************** vect_estimate_min_profitable_iters (loop
*** 391,397 ****
    /* vector version will never be profitable.  */
    else
      {
!       if (vect_print_dump_info (REPORT_DETAILS))
          fprintf (vect_dump, "cost model: vector iteration cost = %d "
                   "is divisible by scalar iteration cost = %d by a factor "
                   "greater than or equal to the vectorization factor = %d .",
--- 391,397 ----
    /* vector version will never be profitable.  */
    else
      {
!       if (vect_print_dump_info (REPORT_COST))
          fprintf (vect_dump, "cost model: vector iteration cost = %d "
                   "is divisible by scalar iteration cost = %d by a factor "
                   "greater than or equal to the vectorization factor = %d .",
*************** vect_estimate_min_profitable_iters (loop
*** 399,405 ****
        return -1;
      }
  
!   if (vect_print_dump_info (REPORT_DETAILS))
      {
        fprintf (vect_dump, "Cost model analysis: \n");
        fprintf (vect_dump, "  Vector inside of loop cost: %d\n",
--- 399,405 ----
        return -1;
      }
  
!   if (vect_print_dump_info (REPORT_COST))
      {
        fprintf (vect_dump, "Cost model analysis: \n");
        fprintf (vect_dump, "  Vector inside of loop cost: %d\n",
*************** vect_estimate_min_profitable_iters (loop
*** 425,431 ****
         then skip the vectorized loop.  */
    min_profitable_iters--;
  
!   if (vect_print_dump_info (REPORT_DETAILS))
      fprintf (vect_dump, "  Profitability threshold = %d\n",
  	     min_profitable_iters);
      
--- 425,431 ----
         then skip the vectorized loop.  */
    min_profitable_iters--;
  
!   if (vect_print_dump_info (REPORT_COST))
      fprintf (vect_dump, "  Profitability threshold = %d\n",
  	     min_profitable_iters);
      
*************** vect_model_reduction_cost (stmt_vec_info
*** 465,471 ****
    vectype = get_vectype_for_scalar_type (TREE_TYPE (reduction_op));
    if (!vectype)
      {
!       if (vect_print_dump_info (REPORT_DETAILS))
          {
            fprintf (vect_dump, "unsupported data-type ");
            print_generic_expr (vect_dump, TREE_TYPE (reduction_op), TDF_SLIM);
--- 465,471 ----
    vectype = get_vectype_for_scalar_type (TREE_TYPE (reduction_op));
    if (!vectype)
      {
!       if (vect_print_dump_info (REPORT_COST))
          {
            fprintf (vect_dump, "unsupported data-type ");
            print_generic_expr (vect_dump, TREE_TYPE (reduction_op), TDF_SLIM);
*************** vect_model_reduction_cost (stmt_vec_info
*** 520,526 ****
  
    STMT_VINFO_OUTSIDE_OF_LOOP_COST (stmt_info) = outer_cost;
  
!   if (vect_print_dump_info (REPORT_DETAILS))
      fprintf (vect_dump, "vect_model_reduction_cost: inside_cost = %d, "
               "outside_cost = %d .", STMT_VINFO_INSIDE_OF_LOOP_COST (stmt_info),
               STMT_VINFO_OUTSIDE_OF_LOOP_COST (stmt_info));
--- 520,526 ----
  
    STMT_VINFO_OUTSIDE_OF_LOOP_COST (stmt_info) = outer_cost;
  
!   if (vect_print_dump_info (REPORT_COST))
      fprintf (vect_dump, "vect_model_reduction_cost: inside_cost = %d, "
               "outside_cost = %d .", STMT_VINFO_INSIDE_OF_LOOP_COST (stmt_info),
               STMT_VINFO_OUTSIDE_OF_LOOP_COST (stmt_info));
*************** vect_model_induction_cost (stmt_vec_info
*** 541,547 ****
    /* prologue cost for vec_init and vec_step.  */
    STMT_VINFO_OUTSIDE_OF_LOOP_COST (stmt_info) = 2 * TARG_SCALAR_TO_VEC_COST;
    
!   if (vect_print_dump_info (REPORT_DETAILS))
      fprintf (vect_dump, "vect_model_induction_cost: inside_cost = %d, "
               "outside_cost = %d .", STMT_VINFO_INSIDE_OF_LOOP_COST (stmt_info),
               STMT_VINFO_OUTSIDE_OF_LOOP_COST (stmt_info));
--- 541,547 ----
    /* prologue cost for vec_init and vec_step.  */
    STMT_VINFO_OUTSIDE_OF_LOOP_COST (stmt_info) = 2 * TARG_SCALAR_TO_VEC_COST;
    
!   if (vect_print_dump_info (REPORT_COST))
      fprintf (vect_dump, "vect_model_induction_cost: inside_cost = %d, "
               "outside_cost = %d .", STMT_VINFO_INSIDE_OF_LOOP_COST (stmt_info),
               STMT_VINFO_OUTSIDE_OF_LOOP_COST (stmt_info));
*************** vect_model_simple_cost (stmt_vec_info st
*** 570,576 ****
  	outside_cost += TARG_SCALAR_TO_VEC_COST; 
      }
    
!   if (vect_print_dump_info (REPORT_DETAILS))
      fprintf (vect_dump, "vect_model_simple_cost: inside_cost = %d, "
               "outside_cost = %d .", inside_cost, outside_cost);
  
--- 570,576 ----
  	outside_cost += TARG_SCALAR_TO_VEC_COST; 
      }
    
!   if (vect_print_dump_info (REPORT_COST))
      fprintf (vect_dump, "vect_model_simple_cost: inside_cost = %d, "
               "outside_cost = %d .", inside_cost, outside_cost);
  
*************** vect_model_store_cost (stmt_vec_info stm
*** 628,634 ****
        inside_cost = ncopies * exact_log2(group_size) * group_size 
               * TARG_VEC_STMT_COST;
  
!       if (vect_print_dump_info (REPORT_DETAILS))
          fprintf (vect_dump, "vect_model_store_cost: strided group_size = %d .",
                   group_size);
  
--- 628,634 ----
        inside_cost = ncopies * exact_log2(group_size) * group_size 
               * TARG_VEC_STMT_COST;
  
!       if (vect_print_dump_info (REPORT_COST))
          fprintf (vect_dump, "vect_model_store_cost: strided group_size = %d .",
                   group_size);
  
*************** vect_model_store_cost (stmt_vec_info stm
*** 637,643 ****
    /* Costs of the stores.  */
    inside_cost += ncopies * TARG_VEC_STORE_COST;
  
!   if (vect_print_dump_info (REPORT_DETAILS))
      fprintf (vect_dump, "vect_model_store_cost: inside_cost = %d, "
               "outside_cost = %d .", inside_cost, outside_cost);
  
--- 637,643 ----
    /* Costs of the stores.  */
    inside_cost += ncopies * TARG_VEC_STORE_COST;
  
!   if (vect_print_dump_info (REPORT_COST))
      fprintf (vect_dump, "vect_model_store_cost: inside_cost = %d, "
               "outside_cost = %d .", inside_cost, outside_cost);
  
*************** vect_model_load_cost (stmt_vec_info stmt
*** 688,694 ****
        inside_cost = ncopies * exact_log2(group_size) * group_size
  	* TARG_VEC_STMT_COST;
  
!       if (vect_print_dump_info (REPORT_DETAILS))
          fprintf (vect_dump, "vect_model_load_cost: strided group_size = %d .",
                   group_size);
  
--- 688,694 ----
        inside_cost = ncopies * exact_log2(group_size) * group_size
  	* TARG_VEC_STMT_COST;
  
!       if (vect_print_dump_info (REPORT_COST))
          fprintf (vect_dump, "vect_model_load_cost: strided group_size = %d .",
                   group_size);
  
*************** vect_model_load_cost (stmt_vec_info stmt
*** 701,707 ****
        {
          inside_cost += ncopies * TARG_VEC_LOAD_COST;
  
!         if (vect_print_dump_info (REPORT_DETAILS))
            fprintf (vect_dump, "vect_model_load_cost: aligned.");
  
          break;
--- 701,707 ----
        {
          inside_cost += ncopies * TARG_VEC_LOAD_COST;
  
!         if (vect_print_dump_info (REPORT_COST))
            fprintf (vect_dump, "vect_model_load_cost: aligned.");
  
          break;
*************** vect_model_load_cost (stmt_vec_info stmt
*** 711,717 ****
          /* Here, we assign an additional cost for the unaligned load.  */
          inside_cost += ncopies * TARG_VEC_UNALIGNED_LOAD_COST;
  
!         if (vect_print_dump_info (REPORT_DETAILS))
            fprintf (vect_dump, "vect_model_load_cost: unaligned supported by "
                     "hardware.");
  
--- 711,717 ----
          /* Here, we assign an additional cost for the unaligned load.  */
          inside_cost += ncopies * TARG_VEC_UNALIGNED_LOAD_COST;
  
!         if (vect_print_dump_info (REPORT_COST))
            fprintf (vect_dump, "vect_model_load_cost: unaligned supported by "
                     "hardware.");
  
*************** vect_model_load_cost (stmt_vec_info stmt
*** 731,737 ****
        }
      case dr_explicit_realign_optimized:
        {
!         if (vect_print_dump_info (REPORT_DETAILS))
            fprintf (vect_dump, "vect_model_load_cost: unaligned software "
                     "pipelined.");
  
--- 731,737 ----
        }
      case dr_explicit_realign_optimized:
        {
!         if (vect_print_dump_info (REPORT_COST))
            fprintf (vect_dump, "vect_model_load_cost: unaligned software "
                     "pipelined.");
  
*************** vect_model_load_cost (stmt_vec_info stmt
*** 758,764 ****
        gcc_unreachable ();
      }
    
!   if (vect_print_dump_info (REPORT_DETAILS))
      fprintf (vect_dump, "vect_model_load_cost: inside_cost = %d, "
               "outside_cost = %d .", inside_cost, outside_cost);
  
--- 758,764 ----
        gcc_unreachable ();
      }
    
!   if (vect_print_dump_info (REPORT_COST))
      fprintf (vect_dump, "vect_model_load_cost: inside_cost = %d, "
               "outside_cost = %d .", inside_cost, outside_cost);
  
*************** conservative_cost_threshold (loop_vec_in
*** 6552,6562 ****
            || min_profitable_iters > min_scalar_loop_bound))
      th = (unsigned) min_profitable_iters;
  
!   if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))	      
!     fprintf (vect_dump, "not vectorized: vectorization may not be "
! 	     "profitable.");
!   
!   if (th && vect_print_dump_info (REPORT_DETAILS))
      fprintf (vect_dump, "Vectorization may not be profitable.");
  
    return th;
--- 6552,6558 ----
            || min_profitable_iters > min_scalar_loop_bound))
      th = (unsigned) min_profitable_iters;
  
!   if (th && vect_print_dump_info (REPORT_COST))
      fprintf (vect_dump, "Vectorization may not be profitable.");
  
    return th;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-12-17 20:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-17 20:55 [patch] fix vectorizer dump print Dorit Nuzman

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).