diff mbox

Reduce -fopt-info verbosity

Message ID 20130531154615.9B43480800@tjsboxrox.mtv.corp.google.com
State New
Headers show

Commit Message

Teresa Johnson May 31, 2013, 3:46 p.m. UTC
This patch changes the -fopt-info default to optimized instead of all,
since the latter is extremely verbose. This reduced the -fopt-info output by
over 75% in at least one case, since the vectorizer has many messages under
MSG_NOTE (and that should grow as more passes are converted to the new dump
infrastructure).  The default now emits high-level optimization success info
(currently for unrolling, inlining and vectorization).

Also changed which vectorization summary messages are emitted under
-fopt-info(=optimized), to be more consistent with the format of the
optimization summary messages emitted by the unroller and inliner,
and fixed the loop vectorization summary message to use dump_printf_loc
instead of manually emitting the location info.

Bootstrapped and tested on x86-64-unknown-linux-gnu. Ok for trunk?

2013-05-31  Teresa Johnson  <tejohnson@google.com>

	* dumpfile.c (opt_info_switch_p): Change -fopt-info
        default to -fopt-info=optimized instead of all.
	* doc/invoke.texi: Ditto.
	* tree-vectorizer.c (vectorize_loops): Emit loop vectorization
        success under MSG_ALL, and use dump_printf_loc.
	(execute_vect_slp): Emit BB vectorization success under
        MSG_OPTIMIZED_LOCATIONS.
	* tree-vect-slp.c (vect_make_slp_decision): Ditto.
	(vect_slp_transform_bb): Change MSG_OPTIMIZED_LOCATIONS
        to MSG_NOTE.
	* tree-vect-loop.c (vect_transform_loop): Ditto.

Comments

Richard Biener June 3, 2013, 8:05 a.m. UTC | #1
On Fri, 31 May 2013, Teresa Johnson wrote:

> This patch changes the -fopt-info default to optimized instead of all,
> since the latter is extremely verbose. This reduced the -fopt-info output by
> over 75% in at least one case, since the vectorizer has many messages under
> MSG_NOTE (and that should grow as more passes are converted to the new dump
> infrastructure).  The default now emits high-level optimization success info
> (currently for unrolling, inlining and vectorization).
> 
> Also changed which vectorization summary messages are emitted under
> -fopt-info(=optimized), to be more consistent with the format of the
> optimization summary messages emitted by the unroller and inliner,
> and fixed the loop vectorization summary message to use dump_printf_loc
> instead of manually emitting the location info.
> 
> Bootstrapped and tested on x86-64-unknown-linux-gnu. Ok for trunk?
> 
> 2013-05-31  Teresa Johnson  <tejohnson@google.com>
> 
> 	* dumpfile.c (opt_info_switch_p): Change -fopt-info
>         default to -fopt-info=optimized instead of all.
> 	* doc/invoke.texi: Ditto.
> 	* tree-vectorizer.c (vectorize_loops): Emit loop vectorization
>         success under MSG_ALL, and use dump_printf_loc.
> 	(execute_vect_slp): Emit BB vectorization success under
>         MSG_OPTIMIZED_LOCATIONS.
> 	* tree-vect-slp.c (vect_make_slp_decision): Ditto.
> 	(vect_slp_transform_bb): Change MSG_OPTIMIZED_LOCATIONS
>         to MSG_NOTE.
> 	* tree-vect-loop.c (vect_transform_loop): Ditto.
> 
> Index: tree-vect-loop.c
> ===================================================================
> --- tree-vect-loop.c	(revision 199423)
> +++ tree-vect-loop.c	(working copy)
> @@ -5801,7 +5801,7 @@ vect_transform_loop (loop_vec_info loop_vinfo)
>  
>    if (dump_enabled_p ())
>      {
> -      dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
> +      dump_printf_loc (MSG_NOTE, vect_location,
>  		       "LOOP VECTORIZED\n");
>        if (loop->inner)
>  	dump_printf_loc (MSG_NOTE, vect_location,
> Index: dumpfile.c
> ===================================================================
> --- dumpfile.c	(revision 199423)
> +++ dumpfile.c	(working copy)
> @@ -866,7 +866,7 @@ opt_info_switch_p (const char *arg)
>  
>    file_seen = xstrdup (filename);
>    if (!flags)
> -    flags = MSG_ALL;
> +    flags = MSG_OPTIMIZED_LOCATIONS;
>    if (!optgroup_flags)
>      optgroup_flags = OPTGROUP_ALL;
>  
> Index: tree-vectorizer.c
> ===================================================================
> --- tree-vectorizer.c	(revision 199423)
> +++ tree-vectorizer.c	(working copy)
> @@ -118,8 +118,7 @@ vectorize_loops (void)
>  
>          if (LOCATION_LOCUS (vect_location) != UNKNOWN_LOC
>  	    && dump_enabled_p ())
> -          dump_printf (MSG_NOTE, "\n\nVectorizing loop at %s:%d\n",
> -                       LOC_FILE (vect_location), LOC_LINE (vect_location));
> +          dump_printf_loc (MSG_ALL, vect_location, "Vectorized loop\n");

MSG_ALL looks wrong if we are looking for unoptimized locations
only, no?  I think you want MSG_OPTIMIZED_LOCATIONS here.

>  	vect_transform_loop (loop_vinfo);
>  	num_vectorized_loops++;
>        }
> @@ -179,7 +178,7 @@ execute_vect_slp (void)
>          {
>            vect_slp_transform_bb (bb);
>            if (dump_enabled_p ())
> -            dump_printf_loc (MSG_NOTE, vect_location,
> +            dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
>  			     "basic block vectorized using SLP\n");

Please make the message consistent with the loop one.  The loop one
says "Vectorized loop" (I think the caps 'V' is not according to
our diagnostic policies, it should be lower-case), the basic-block
one "basic block vectorized using SLP" which shouldn't confuse the
user about "SLP" and say "vectorized basic-block" instead.

Yes, that may require you to fiddle with testcases that scan for
these ...

>          }
>      }
> Index: doc/invoke.texi
> ===================================================================
> --- doc/invoke.texi	(revision 199423)
> +++ doc/invoke.texi	(working copy)
> @@ -6172,7 +6172,7 @@ Controls optimization dumps from various optimizat
>  @samp{-@var{options}} form is used, @var{options} is a list of
>  @samp{-} separated options to select the dump details and
>  optimizations.  If @var{options} is not specified, it defaults to
> -@option{all} for details and @option{optall} for optimization
> +@option{optimized} for details and @option{optall} for optimization
>  groups. If the @var{filename} is not specified, it defaults to
>  @file{stderr}. Note that the output @var{filename} will be overwritten
>  in case of multiple translation units. If a combined output from
> Index: tree-vect-slp.c
> ===================================================================
> --- tree-vect-slp.c	(revision 199423)
> +++ tree-vect-slp.c	(working copy)
> @@ -1698,8 +1698,8 @@ vect_make_slp_decision (loop_vec_info loop_vinfo)
>    LOOP_VINFO_SLP_UNROLLING_FACTOR (loop_vinfo) = unrolling_factor;
>  
>    if (decided_to_slp && dump_enabled_p ())
> -    dump_printf_loc (MSG_NOTE, vect_location,
> -		     "Decided to SLP %d instances. Unrolling factor %d",
> +    dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
> +		     "Vectorized %d SLP instances with unroll factor %d",
>  		     decided_to_slp, unrolling_factor);

Keep this MSG_NOTE please.

>    return (decided_to_slp > 0);
> @@ -3181,7 +3181,7 @@ vect_slp_transform_bb (basic_block bb)
>      }
>  
>    if (dump_enabled_p ())
> -    dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
> +    dump_printf_loc (MSG_NOTE, vect_location,
>  		     "BASIC BLOCK VECTORIZED\n");
>  
>    destroy_bb_vec_info (bb_vinfo);

The patch is ok with these changes if it tests ok.

Thanks,
Richard.
Teresa Johnson June 3, 2013, 6:41 p.m. UTC | #2
On Mon, Jun 3, 2013 at 1:05 AM, Richard Biener <rguenther@suse.de> wrote:
> On Fri, 31 May 2013, Teresa Johnson wrote:
>
>> This patch changes the -fopt-info default to optimized instead of all,
>> since the latter is extremely verbose. This reduced the -fopt-info output by
>> over 75% in at least one case, since the vectorizer has many messages under
>> MSG_NOTE (and that should grow as more passes are converted to the new dump
>> infrastructure).  The default now emits high-level optimization success info
>> (currently for unrolling, inlining and vectorization).
>>
>> Also changed which vectorization summary messages are emitted under
>> -fopt-info(=optimized), to be more consistent with the format of the
>> optimization summary messages emitted by the unroller and inliner,
>> and fixed the loop vectorization summary message to use dump_printf_loc
>> instead of manually emitting the location info.
>>
>> Bootstrapped and tested on x86-64-unknown-linux-gnu. Ok for trunk?
>>
>> 2013-05-31  Teresa Johnson  <tejohnson@google.com>
>>
>>       * dumpfile.c (opt_info_switch_p): Change -fopt-info
>>         default to -fopt-info=optimized instead of all.
>>       * doc/invoke.texi: Ditto.
>>       * tree-vectorizer.c (vectorize_loops): Emit loop vectorization
>>         success under MSG_ALL, and use dump_printf_loc.
>>       (execute_vect_slp): Emit BB vectorization success under
>>         MSG_OPTIMIZED_LOCATIONS.
>>       * tree-vect-slp.c (vect_make_slp_decision): Ditto.
>>       (vect_slp_transform_bb): Change MSG_OPTIMIZED_LOCATIONS
>>         to MSG_NOTE.
>>       * tree-vect-loop.c (vect_transform_loop): Ditto.
>>
>> Index: tree-vect-loop.c
>> ===================================================================
>> --- tree-vect-loop.c  (revision 199423)
>> +++ tree-vect-loop.c  (working copy)
>> @@ -5801,7 +5801,7 @@ vect_transform_loop (loop_vec_info loop_vinfo)
>>
>>    if (dump_enabled_p ())
>>      {
>> -      dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
>> +      dump_printf_loc (MSG_NOTE, vect_location,
>>                      "LOOP VECTORIZED\n");
>>        if (loop->inner)
>>       dump_printf_loc (MSG_NOTE, vect_location,
>> Index: dumpfile.c
>> ===================================================================
>> --- dumpfile.c        (revision 199423)
>> +++ dumpfile.c        (working copy)
>> @@ -866,7 +866,7 @@ opt_info_switch_p (const char *arg)
>>
>>    file_seen = xstrdup (filename);
>>    if (!flags)
>> -    flags = MSG_ALL;
>> +    flags = MSG_OPTIMIZED_LOCATIONS;
>>    if (!optgroup_flags)
>>      optgroup_flags = OPTGROUP_ALL;
>>
>> Index: tree-vectorizer.c
>> ===================================================================
>> --- tree-vectorizer.c (revision 199423)
>> +++ tree-vectorizer.c (working copy)
>> @@ -118,8 +118,7 @@ vectorize_loops (void)
>>
>>          if (LOCATION_LOCUS (vect_location) != UNKNOWN_LOC
>>           && dump_enabled_p ())
>> -          dump_printf (MSG_NOTE, "\n\nVectorizing loop at %s:%d\n",
>> -                       LOC_FILE (vect_location), LOC_LINE (vect_location));
>> +          dump_printf_loc (MSG_ALL, vect_location, "Vectorized loop\n");
>
> MSG_ALL looks wrong if we are looking for unoptimized locations
> only, no?  I think you want MSG_OPTIMIZED_LOCATIONS here.

Ok, fixed.

>
>>       vect_transform_loop (loop_vinfo);
>>       num_vectorized_loops++;
>>        }
>> @@ -179,7 +178,7 @@ execute_vect_slp (void)
>>          {
>>            vect_slp_transform_bb (bb);
>>            if (dump_enabled_p ())
>> -            dump_printf_loc (MSG_NOTE, vect_location,
>> +            dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
>>                            "basic block vectorized using SLP\n");
>
> Please make the message consistent with the loop one.  The loop one
> says "Vectorized loop" (I think the caps 'V' is not according to
> our diagnostic policies, it should be lower-case), the basic-block
> one "basic block vectorized using SLP" which shouldn't confuse the
> user about "SLP" and say "vectorized basic-block" instead.
>
> Yes, that may require you to fiddle with testcases that scan for
> these ...

As suggested, I changed the above to "Vectorized basic-block" (kept
both success notes with leading
capital to be consistent with the loop unroller
MSG_OPTIMIZED_LOCATIONS messages).

Updated test cases with the new message.

>
>>          }
>>      }
>> Index: doc/invoke.texi
>> ===================================================================
>> --- doc/invoke.texi   (revision 199423)
>> +++ doc/invoke.texi   (working copy)
>> @@ -6172,7 +6172,7 @@ Controls optimization dumps from various optimizat
>>  @samp{-@var{options}} form is used, @var{options} is a list of
>>  @samp{-} separated options to select the dump details and
>>  optimizations.  If @var{options} is not specified, it defaults to
>> -@option{all} for details and @option{optall} for optimization
>> +@option{optimized} for details and @option{optall} for optimization
>>  groups. If the @var{filename} is not specified, it defaults to
>>  @file{stderr}. Note that the output @var{filename} will be overwritten
>>  in case of multiple translation units. If a combined output from
>> Index: tree-vect-slp.c
>> ===================================================================
>> --- tree-vect-slp.c   (revision 199423)
>> +++ tree-vect-slp.c   (working copy)
>> @@ -1698,8 +1698,8 @@ vect_make_slp_decision (loop_vec_info loop_vinfo)
>>    LOOP_VINFO_SLP_UNROLLING_FACTOR (loop_vinfo) = unrolling_factor;
>>
>>    if (decided_to_slp && dump_enabled_p ())
>> -    dump_printf_loc (MSG_NOTE, vect_location,
>> -                  "Decided to SLP %d instances. Unrolling factor %d",
>> +    dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
>> +                  "Vectorized %d SLP instances with unroll factor %d",
>>                    decided_to_slp, unrolling_factor);
>
> Keep this MSG_NOTE please.

Fixed.

>
>>    return (decided_to_slp > 0);
>> @@ -3181,7 +3181,7 @@ vect_slp_transform_bb (basic_block bb)
>>      }
>>
>>    if (dump_enabled_p ())
>> -    dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
>> +    dump_printf_loc (MSG_NOTE, vect_location,
>>                    "BASIC BLOCK VECTORIZED\n");
>>
>>    destroy_bb_vec_info (bb_vinfo);
>
> The patch is ok with these changes if it tests ok.

Thanks, patch fixed as described above, retested, and committed as r199620.

Teresa

>
> Thanks,
> Richard.



--
Teresa Johnson | Software Engineer | tejohnson@google.com | 408-460-2413
diff mbox

Patch

Index: tree-vect-loop.c
===================================================================
--- tree-vect-loop.c	(revision 199423)
+++ tree-vect-loop.c	(working copy)
@@ -5801,7 +5801,7 @@  vect_transform_loop (loop_vec_info loop_vinfo)
 
   if (dump_enabled_p ())
     {
-      dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
+      dump_printf_loc (MSG_NOTE, vect_location,
 		       "LOOP VECTORIZED\n");
       if (loop->inner)
 	dump_printf_loc (MSG_NOTE, vect_location,
Index: dumpfile.c
===================================================================
--- dumpfile.c	(revision 199423)
+++ dumpfile.c	(working copy)
@@ -866,7 +866,7 @@  opt_info_switch_p (const char *arg)
 
   file_seen = xstrdup (filename);
   if (!flags)
-    flags = MSG_ALL;
+    flags = MSG_OPTIMIZED_LOCATIONS;
   if (!optgroup_flags)
     optgroup_flags = OPTGROUP_ALL;
 
Index: tree-vectorizer.c
===================================================================
--- tree-vectorizer.c	(revision 199423)
+++ tree-vectorizer.c	(working copy)
@@ -118,8 +118,7 @@  vectorize_loops (void)
 
         if (LOCATION_LOCUS (vect_location) != UNKNOWN_LOC
 	    && dump_enabled_p ())
-          dump_printf (MSG_NOTE, "\n\nVectorizing loop at %s:%d\n",
-                       LOC_FILE (vect_location), LOC_LINE (vect_location));
+          dump_printf_loc (MSG_ALL, vect_location, "Vectorized loop\n");
 	vect_transform_loop (loop_vinfo);
 	num_vectorized_loops++;
       }
@@ -179,7 +178,7 @@  execute_vect_slp (void)
         {
           vect_slp_transform_bb (bb);
           if (dump_enabled_p ())
-            dump_printf_loc (MSG_NOTE, vect_location,
+            dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
 			     "basic block vectorized using SLP\n");
         }
     }
Index: doc/invoke.texi
===================================================================
--- doc/invoke.texi	(revision 199423)
+++ doc/invoke.texi	(working copy)
@@ -6172,7 +6172,7 @@  Controls optimization dumps from various optimizat
 @samp{-@var{options}} form is used, @var{options} is a list of
 @samp{-} separated options to select the dump details and
 optimizations.  If @var{options} is not specified, it defaults to
-@option{all} for details and @option{optall} for optimization
+@option{optimized} for details and @option{optall} for optimization
 groups. If the @var{filename} is not specified, it defaults to
 @file{stderr}. Note that the output @var{filename} will be overwritten
 in case of multiple translation units. If a combined output from
Index: tree-vect-slp.c
===================================================================
--- tree-vect-slp.c	(revision 199423)
+++ tree-vect-slp.c	(working copy)
@@ -1698,8 +1698,8 @@  vect_make_slp_decision (loop_vec_info loop_vinfo)
   LOOP_VINFO_SLP_UNROLLING_FACTOR (loop_vinfo) = unrolling_factor;
 
   if (decided_to_slp && dump_enabled_p ())
-    dump_printf_loc (MSG_NOTE, vect_location,
-		     "Decided to SLP %d instances. Unrolling factor %d",
+    dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
+		     "Vectorized %d SLP instances with unroll factor %d",
 		     decided_to_slp, unrolling_factor);
 
   return (decided_to_slp > 0);
@@ -3181,7 +3181,7 @@  vect_slp_transform_bb (basic_block bb)
     }
 
   if (dump_enabled_p ())
-    dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
+    dump_printf_loc (MSG_NOTE, vect_location,
 		     "BASIC BLOCK VECTORIZED\n");
 
   destroy_bb_vec_info (bb_vinfo);