public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Change behavior of -fsched-verbose option
@ 2015-10-22 15:52 Nikolai Bozhenov
  2015-10-22 15:59 ` Bernd Schmidt
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Nikolai Bozhenov @ 2015-10-22 15:52 UTC (permalink / raw)
  To: GCC Patches; +Cc: vmakarov, law

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

Hi!

Currently -fsched-verbose option redirects debugging dumps to stderr
if there is no dump_file for the current pass. It would be fine if
there were the only scheduling pass. But for example for AArch64
there are 3 scheduling passes in the default pipeline: sched1,
fusion and sched2. So, when passing options like
-fsched-verbose=7 -fdump-rtl-sched1 to GCC I get a neat dump for
sched1 in the file and a mess of fusion/sched2 logs in the console.

In fact, currently there's no way to tell GCC that I want extremely
verbose logs for sched1 and I want no logs for all other passes.
Especially to the console.

I suggest disabling such redirection in the scheduler and omitting
debugging output for passes without dump_file. I believe a better
way to redirect printing to the stderr is to use options like
-fdump-rtl-sched=stderr. The attached patch implements the
suggestion.

Anyway, the old behavior may be reproduced with options
-fsched-verbose=7 -fdump-rtl-sched1 -fdump-rtl-{sched_fusion,sched2}=stderr
if it is really necessary.

The patch has been bootstrapped and regtested on x86_64.

Thanks,
Nikolai

[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 3425 bytes --]

2015-10-22  Nikolai Bozhenov  <n.bozhenov@samsung.com>

	* haifa-sched.c (setup_sched_dump): Don't redirect output to stderr.
	* common.opt (-fsched-verbose): Set default value to 1.
	* invoke.texi (-fsched-verbose): Update the option's description.

diff --git a/gcc/common.opt b/gcc/common.opt
index 224d3ad..5c23d29 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -1973,7 +1973,7 @@ Common Report Var(flag_schedule_speculative_load_dangerous) Optimization
 Allow speculative motion of more loads
 
 fsched-verbose=
-Common RejectNegative Joined UInteger Var(sched_verbose_param)
+Common RejectNegative Joined UInteger Var(sched_verbose_param) Init(1)
 -fsched-verbose=<number>	Set the verbosity level of the scheduler
 
 fsched2-use-superblocks
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 027ce96..d3cb88c 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -7403,12 +7403,7 @@ The @var{number} should be different for every file you compile.
 @item -fsched-verbose=@var{n}
 @opindex fsched-verbose
 On targets that use instruction scheduling, this option controls the
-amount of debugging output the scheduler prints.  This information is
-written to standard error, unless @option{-fdump-rtl-sched1} or
-@option{-fdump-rtl-sched2} is specified, in which case it is output
-to the usual dump listing file, @file{.sched1} or @file{.sched2}
-respectively.  However for @var{n} greater than nine, the output is
-always printed to standard error.
+amount of debugging output the scheduler prints to the dump files.
 
 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index 46751fe..32506cb 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -206,17 +206,14 @@ static int modulo_last_stage;
 
 /* sched-verbose controls the amount of debugging output the
    scheduler prints.  It is controlled by -fsched-verbose=N:
-   N>0 and no -DSR : the output is directed to stderr.
-   N>=10 will direct the printouts to stderr (regardless of -dSR).
-   N=1: same as -dSR.
+   N=0: no debugging output.
+   N=1: default value.
    N=2: bb's probabilities, detailed ready list info, unit/insn info.
    N=3: rtl at abort point, control-flow, regions info.
    N=5: dependences info.  */
-
 int sched_verbose = 0;
 
-/* Debugging file.  All printouts are sent to dump, which is always set,
-   either to stderr, or to the dump listing file (-dRS).  */
+/* Debugging file.  All printouts are sent to dump. */
 FILE *sched_dump = 0;
 
 /* This is a placeholder for the scheduler parameters common
@@ -7222,17 +7219,14 @@ set_priorities (rtx_insn *head, rtx_insn *tail)
   return n_insn;
 }
 
-/* Set dump and sched_verbose for the desired debugging output.  If no
-   dump-file was specified, but -fsched-verbose=N (any N), print to stderr.
-   For -fsched-verbose=N, N>=10, print everything to stderr.  */
+/* Set sched_dump and sched_verbose for the desired debugging output. */
 void
 setup_sched_dump (void)
 {
   sched_verbose = sched_verbose_param;
-  if (sched_verbose_param == 0 && dump_file)
-    sched_verbose = 1;
-  sched_dump = ((sched_verbose_param >= 10 || !dump_file)
-		? stderr : dump_file);
+  sched_dump = dump_file;
+  if (!dump_file)
+    sched_verbose = 0;
 }
 
 /* Allocate data for register pressure sensitive scheduling.  */

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Change behavior of -fsched-verbose option
  2015-10-22 15:52 Change behavior of -fsched-verbose option Nikolai Bozhenov
@ 2015-10-22 15:59 ` Bernd Schmidt
  2015-10-22 16:12   ` Nikolai Bozhenov
  2015-11-05  8:11 ` [ping] " Nikolai Bozhenov
  2015-11-06 21:17 ` Jeff Law
  2 siblings, 1 reply; 7+ messages in thread
From: Bernd Schmidt @ 2015-10-22 15:59 UTC (permalink / raw)
  To: Nikolai Bozhenov, GCC Patches; +Cc: vmakarov, law

On 10/22/2015 05:38 PM, Nikolai Bozhenov wrote:

> Currently -fsched-verbose option redirects debugging dumps to stderr
> if there is no dump_file for the current pass. It would be fine if
> there were the only scheduling pass. But for example for AArch64
> there are 3 scheduling passes in the default pipeline: sched1,
> fusion and sched2. So, when passing options like
> -fsched-verbose=7 -fdump-rtl-sched1 to GCC I get a neat dump for
> sched1 in the file and a mess of fusion/sched2 logs in the console.

> 	* haifa-sched.c (setup_sched_dump): Don't redirect output to stderr.
> 	* common.opt (-fsched-verbose): Set default value to 1.
> 	* invoke.texi (-fsched-verbose): Update the option's description.

That looks sensible, I agree that dumping to stderr does not make much 
sense. When in the debugger you can still set sched_dump to stderr if 
you want.

> +  if (!dump_file)
> +    sched_verbose = 0;

Do you even need that? Otherwise, patch OK.


Bernd

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Change behavior of -fsched-verbose option
  2015-10-22 15:59 ` Bernd Schmidt
@ 2015-10-22 16:12   ` Nikolai Bozhenov
  0 siblings, 0 replies; 7+ messages in thread
From: Nikolai Bozhenov @ 2015-10-22 16:12 UTC (permalink / raw)
  To: Bernd Schmidt, GCC Patches; +Cc: vmakarov, law

On 10/22/2015 06:56 PM, Bernd Schmidt wrote:
> On 10/22/2015 05:38 PM, Nikolai Bozhenov wrote:
>
>> Currently -fsched-verbose option redirects debugging dumps to stderr
>> if there is no dump_file for the current pass. It would be fine if
>> there were the only scheduling pass. But for example for AArch64
>> there are 3 scheduling passes in the default pipeline: sched1,
>> fusion and sched2. So, when passing options like
>> -fsched-verbose=7 -fdump-rtl-sched1 to GCC I get a neat dump for
>> sched1 in the file and a mess of fusion/sched2 logs in the console.
>
>>     * haifa-sched.c (setup_sched_dump): Don't redirect output to stderr.
>>     * common.opt (-fsched-verbose): Set default value to 1.
>>     * invoke.texi (-fsched-verbose): Update the option's description.
>
> That looks sensible, I agree that dumping to stderr does not make much 
> sense. When in the debugger you can still set sched_dump to stderr if 
> you want.
>
>> +  if (!dump_file)
>> +    sched_verbose = 0;
>
> Do you even need that? Otherwise, patch OK.
>
>
> Bernd
>

Most loggers look like

     if (sched_verbose >= 4)
         fprintf (sched_dump, ";;\tAdvance the current state.\n");

So, we need to make sure that sched_verbose is set to zero if
there's no dump_file. Otherwise, we'll be writing to NULL file
pointer.

Thanks,
Nikolai

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ping] Change behavior of -fsched-verbose option
  2015-10-22 15:52 Change behavior of -fsched-verbose option Nikolai Bozhenov
  2015-10-22 15:59 ` Bernd Schmidt
@ 2015-11-05  8:11 ` Nikolai Bozhenov
  2015-11-05  9:26   ` Bernd Schmidt
  2015-11-06 21:17 ` Jeff Law
  2 siblings, 1 reply; 7+ messages in thread
From: Nikolai Bozhenov @ 2015-11-05  8:11 UTC (permalink / raw)
  To: GCC Patches; +Cc: vmakarov, law, bschmidt, meissner

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

Please commit if it is OK for trunk.

Thanks,
Nikolai

On 10/22/2015 06:38 PM, Nikolai Bozhenov wrote:
> Hi!
>
> Currently -fsched-verbose option redirects debugging dumps to stderr
> if there is no dump_file for the current pass. It would be fine if
> there were the only scheduling pass. But for example for AArch64
> there are 3 scheduling passes in the default pipeline: sched1,
> fusion and sched2. So, when passing options like
> -fsched-verbose=7 -fdump-rtl-sched1 to GCC I get a neat dump for
> sched1 in the file and a mess of fusion/sched2 logs in the console.
>
> In fact, currently there's no way to tell GCC that I want extremely
> verbose logs for sched1 and I want no logs for all other passes.
> Especially to the console.
>
> I suggest disabling such redirection in the scheduler and omitting
> debugging output for passes without dump_file. I believe a better
> way to redirect printing to the stderr is to use options like
> -fdump-rtl-sched=stderr. The attached patch implements the
> suggestion.
>
> Anyway, the old behavior may be reproduced with options
> -fsched-verbose=7 -fdump-rtl-sched1 
> -fdump-rtl-{sched_fusion,sched2}=stderr
> if it is really necessary.
>
> The patch has been bootstrapped and regtested on x86_64.
>
> Thanks,
> Nikolai


[-- Attachment #2: sched_verbose.patch --]
[-- Type: text/x-diff, Size: 4791 bytes --]

2015-10-22  Nikolai Bozhenov  <n.bozhenov@samsung.com>

	* haifa-sched.c (setup_sched_dump): Don't redirect output to stderr.
	* common.opt (-fsched-verbose): Set default value to 1.
	* invoke.texi (-fsched-verbose): Update the option's description.

diff --git a/gcc/common.opt b/gcc/common.opt
index 961a1b6..757ce85 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -1967,17 +1967,17 @@ fsched-spec-load
 Common Report Var(flag_schedule_speculative_load) Optimization
 Allow speculative motion of some loads.
 
 fsched-spec-load-dangerous
 Common Report Var(flag_schedule_speculative_load_dangerous) Optimization
 Allow speculative motion of more loads.
 
 fsched-verbose=
-Common RejectNegative Joined UInteger Var(sched_verbose_param)
+Common RejectNegative Joined UInteger Var(sched_verbose_param) Init(1)
 -fsched-verbose=<number>	Set the verbosity level of the scheduler.
 
 fsched2-use-superblocks
 Common Report Var(flag_sched2_use_superblocks) Optimization
 If scheduling post reload, do superblock scheduling.
 
 fsched2-use-traces
 Common Ignore
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 4fc7d88..11b8697 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -7415,22 +7415,17 @@ place unique stamps in coverage data files and the object files that
 produce them.  You can use the @option{-frandom-seed} option to produce
 reproducibly identical object files.
 
 The @var{number} should be different for every file you compile.
 
 @item -fsched-verbose=@var{n}
 @opindex fsched-verbose
 On targets that use instruction scheduling, this option controls the
-amount of debugging output the scheduler prints.  This information is
-written to standard error, unless @option{-fdump-rtl-sched1} or
-@option{-fdump-rtl-sched2} is specified, in which case it is output
-to the usual dump listing file, @file{.sched1} or @file{.sched2}
-respectively.  However for @var{n} greater than nine, the output is
-always printed to standard error.
+amount of debugging output the scheduler prints to the dump files.
 
 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
 For @var{n} greater than one, it also output basic block probabilities,
 detailed ready list information and unit/insn info.  For @var{n} greater
 than two, it includes RTL at abort point, control-flow and regions info.
 And for @var{n} over four, @option{-fsched-verbose} also includes
 dependence info.
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index caadc11..835648b 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -198,27 +198,24 @@ static int modulo_iter0_max_uid;
 static int modulo_backtracks_left;
 
 /* The stage in which the last insn from the original loop was
    scheduled.  */
 static int modulo_last_stage;
 
 /* sched-verbose controls the amount of debugging output the
    scheduler prints.  It is controlled by -fsched-verbose=N:
-   N>0 and no -DSR : the output is directed to stderr.
-   N>=10 will direct the printouts to stderr (regardless of -dSR).
-   N=1: same as -dSR.
+   N=0: no debugging output.
+   N=1: default value.
    N=2: bb's probabilities, detailed ready list info, unit/insn info.
    N=3: rtl at abort point, control-flow, regions info.
    N=5: dependences info.  */
-
 int sched_verbose = 0;
 
-/* Debugging file.  All printouts are sent to dump, which is always set,
-   either to stderr, or to the dump listing file (-dRS).  */
+/* Debugging file.  All printouts are sent to dump. */
 FILE *sched_dump = 0;
 
 /* This is a placeholder for the scheduler parameters common
    to all schedulers.  */
 struct common_sched_info_def *common_sched_info;
 
 #define INSN_TICK(INSN)	(HID (INSN)->tick)
 #define INSN_EXACT_TICK(INSN) (HID (INSN)->exact_tick)
@@ -7214,27 +7211,24 @@ set_priorities (rtx_insn *head, rtx_insn *tail)
 				      INSN_PRIORITY (insn));
     }
 
   current_sched_info->sched_max_insns_priority = sched_max_insns_priority;
 
   return n_insn;
 }
 
-/* Set dump and sched_verbose for the desired debugging output.  If no
-   dump-file was specified, but -fsched-verbose=N (any N), print to stderr.
-   For -fsched-verbose=N, N>=10, print everything to stderr.  */
+/* Set sched_dump and sched_verbose for the desired debugging output. */
 void
 setup_sched_dump (void)
 {
   sched_verbose = sched_verbose_param;
-  if (sched_verbose_param == 0 && dump_file)
-    sched_verbose = 1;
-  sched_dump = ((sched_verbose_param >= 10 || !dump_file)
-		? stderr : dump_file);
+  sched_dump = dump_file;
+  if (!dump_file)
+    sched_verbose = 0;
 }
 
 /* Allocate data for register pressure sensitive scheduling.  */
 static void
 alloc_global_sched_pressure_data (void)
 {
   if (sched_pressure != SCHED_PRESSURE_NONE)
     {

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ping] Change behavior of -fsched-verbose option
  2015-11-05  8:11 ` [ping] " Nikolai Bozhenov
@ 2015-11-05  9:26   ` Bernd Schmidt
  2015-11-05 10:20     ` Nikolai Bozhenov
  0 siblings, 1 reply; 7+ messages in thread
From: Bernd Schmidt @ 2015-11-05  9:26 UTC (permalink / raw)
  To: Nikolai Bozhenov, GCC Patches; +Cc: vmakarov, law, meissner

On 11/05/2015 09:11 AM, Nikolai Bozhenov wrote:
> Please commit if it is OK for trunk.

Hmm, do you have a copyright assignment on file?


Bernd

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ping] Change behavior of -fsched-verbose option
  2015-11-05  9:26   ` Bernd Schmidt
@ 2015-11-05 10:20     ` Nikolai Bozhenov
  0 siblings, 0 replies; 7+ messages in thread
From: Nikolai Bozhenov @ 2015-11-05 10:20 UTC (permalink / raw)
  To: Bernd Schmidt, GCC Patches; +Cc: vmakarov, law, meissner

On 11/05/2015 12:26 PM, Bernd Schmidt wrote:
> On 11/05/2015 09:11 AM, Nikolai Bozhenov wrote:
>> Please commit if it is OK for trunk.
>
> Hmm, do you have a copyright assignment on file?
>

Yes I do have a copyright assignment for all past and future changes
to GCC (RT:828836).

Thanks,
Nikolai

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Change behavior of -fsched-verbose option
  2015-10-22 15:52 Change behavior of -fsched-verbose option Nikolai Bozhenov
  2015-10-22 15:59 ` Bernd Schmidt
  2015-11-05  8:11 ` [ping] " Nikolai Bozhenov
@ 2015-11-06 21:17 ` Jeff Law
  2 siblings, 0 replies; 7+ messages in thread
From: Jeff Law @ 2015-11-06 21:17 UTC (permalink / raw)
  To: Nikolai Bozhenov, GCC Patches; +Cc: vmakarov

On 10/22/2015 09:38 AM, Nikolai Bozhenov wrote:
> Hi!
>
> Currently -fsched-verbose option redirects debugging dumps to stderr
> if there is no dump_file for the current pass. It would be fine if
> there were the only scheduling pass. But for example for AArch64
> there are 3 scheduling passes in the default pipeline: sched1,
> fusion and sched2. So, when passing options like
> -fsched-verbose=7 -fdump-rtl-sched1 to GCC I get a neat dump for
> sched1 in the file and a mess of fusion/sched2 logs in the console.
>
> In fact, currently there's no way to tell GCC that I want extremely
> verbose logs for sched1 and I want no logs for all other passes.
> Especially to the console.
>
> I suggest disabling such redirection in the scheduler and omitting
> debugging output for passes without dump_file. I believe a better
> way to redirect printing to the stderr is to use options like
> -fdump-rtl-sched=stderr. The attached patch implements the
> suggestion.
>
> Anyway, the old behavior may be reproduced with options
> -fsched-verbose=7 -fdump-rtl-sched1 -fdump-rtl-{sched_fusion,sched2}=stderr
> if it is really necessary.
>
> The patch has been bootstrapped and regtested on x86_64.
>
> Thanks,
> Nikolai
>
> patch.diff
>
>
> 2015-10-22  Nikolai Bozhenov<n.bozhenov@samsung.com>
>
> 	* haifa-sched.c (setup_sched_dump): Don't redirect output to stderr.
> 	* common.opt (-fsched-verbose): Set default value to 1.
> 	* invoke.texi (-fsched-verbose): Update the option's description.
OK for the trunk.

jeff

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-11-06 21:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-22 15:52 Change behavior of -fsched-verbose option Nikolai Bozhenov
2015-10-22 15:59 ` Bernd Schmidt
2015-10-22 16:12   ` Nikolai Bozhenov
2015-11-05  8:11 ` [ping] " Nikolai Bozhenov
2015-11-05  9:26   ` Bernd Schmidt
2015-11-05 10:20     ` Nikolai Bozhenov
2015-11-06 21:17 ` Jeff Law

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