public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Kewen.Lin" <linkw@linux.ibm.com>
To: Alexander Monakov <amonakov@ispras.ru>,
	Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
	Richard Guenther <richard.guenther@gmail.com>,
	Richard Sandiford <richard.sandiford@arm.com>,
	Jeff Law <jlaw@ventanamicro.com>,
	Vladimir Makarov <vmakarov@redhat.com>,
	zhroma@ispras.ru, Andrey Belevantsev <abel@ispras.ru>,
	Segher Boessenkool <segher@kernel.crashing.org>,
	Peter Bergner <bergner@linux.ibm.com>,
	Michael Meissner <meissner@linux.ibm.com>
Subject: Re: PING^1 [PATCH v3] sched: Change no_real_insns_p to no_real_nondebug_insns_p [PR108273]
Date: Fri, 10 Nov 2023 09:57:13 +0800	[thread overview]
Message-ID: <4675c26c-f230-b6d6-27c5-bc9f74736e38@linux.ibm.com> (raw)
In-Reply-To: <b0cf2867-ef64-9d61-bae0-b573689fe62d@ispras.ru>

Hi Maxim and Alexander,

Thanks a lot for the review comments!

on 2023/11/10 01:40, Alexander Monakov wrote:
> 
> On Thu, 9 Nov 2023, Maxim Kuvyrkov wrote:
> 
>> Hi Kewen,
>>
>> Below are my comments.  I don't want to override Alexander's review, and if
>> the patch looks good to him, it's fine to ignore my concerns.
>>
>> My main concern is that this adds a new entity -- forceful skipping of
>> DEBUG_INSN-only basic blocks -- to the scheduler for a somewhat minor change
>> in behavior.  Unlike NOTEs and LABELs, DEBUG_INSNs are INSNS, and there is
>> already quite a bit of logic in the scheduler to skip them _as part of normal
>> operation_.

Yeah, I noticed that the scheduler takes care of DEBUG_INSNs as normal operations.
When I started to work on this issue, initially I wanted to try something similar
to your idea #2, but when checking the APIs, I realized why not just skip the basic
block with NOTEs and LABELs, DEBUG_INSNs as well.  IMHO there is no value to try to
schedule this kind of BB (to be scheduled range), skipping it can save some resource
allocation (like block dependencies) and make it more efficient (not enter function
schedule_block etc.), from this perspective it seems an enhancement.  Does it sound
reasonable to you?

> 
> I agree with the concern. I hoped that solving the problem by skipping the BB
> like the (bit-rotted) debug code needs to would be a minor surgery. As things
> look now, it may be better to remove the non-working sched_block debug counter
> entirely and implement a good solution for the problem at hand.

OK, if debug counter sched_block is useless and can be removed, then the proposed
new skipping becomes the only actual need for the artificial resolve_forw_deps.

> 
>>
>> Would you please consider 2 ideas below.
>>
>> #1:
>> After a brief look, I'm guessing this part is causing the problem:
>> haifa-sched.cc <http://haifa-sched.cc/>:schedule_block():
>> === [1]
>>   /* Loop until all the insns in BB are scheduled.  */
>>   while ((*current_sched_info->schedule_more_p) ())
>>     {
>>       perform_replacements_new_cycle ();
>>       do
>> 	{
>> 	  start_clock_var = clock_var;
>>
>> 	  clock_var++;
>>
>> 	  advance_one_cycle ();
> 
> As I understand, we have spurious calls to advance_one_cycle on basic block
> boundaries, which don't model the hardware (the CPU doesn't see BB boundaries)
> and cause divergence when passing through a debug-only BB which would not be
> present at all without -g.
> 
> Since EBBs and regions may not have jump targets in the middle, advancing
> a cycle on BB boundaries does not seem well motivated. Can we remove it?
> 
> Can we teach haifa-sched to emit RTX NOTEs with hashes of DFA states on BB
> boundaries with -fcompare-debug is enabled? It should make the problem
> readily detectable by -fcompare-debug even when scheduling did not diverge.

Good idea!  It would be easy to detect the inconsistent issue with such note.

BR,
Kewen

  reply	other threads:[~2023-11-10  1:57 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-25  2:45 Kewen.Lin
2023-11-08  2:49 ` PING^1 " Kewen.Lin
2023-11-08  9:45   ` Richard Sandiford
2023-11-09  9:10   ` Maxim Kuvyrkov
2023-11-09 17:40     ` Alexander Monakov
2023-11-10  1:57       ` Kewen.Lin [this message]
2023-11-10  3:49         ` Jeff Law
2023-11-10 11:25           ` Alexander Monakov
2023-11-10 13:32             ` Richard Biener
2023-11-10 14:18               ` Alexander Monakov
2023-11-10 14:20                 ` Richard Biener
2023-11-10 14:41                   ` Alexander Monakov
2023-11-15  9:12                     ` Kewen.Lin
2023-11-15  9:43                       ` Alexander Monakov
2023-11-17  9:03                         ` Kewen.Lin
2023-11-17 10:13                           ` Richard Biener
2023-11-17 12:55                           ` Alexander Monakov
2023-11-22  9:30                             ` Kewen.Lin
2023-11-22 10:25                               ` Richard Biener
2023-11-23  2:36                                 ` Kewen.Lin
2023-11-23  8:20                                   ` Richard Biener
2023-11-23  9:09                                     ` Kewen.Lin
2023-12-12  7:02                               ` [PATCH draft v2] sched: Don't skip empty block in scheduling [PR108273] Kewen.Lin
2023-11-10  3:49       ` PING^1 [PATCH v3] sched: Change no_real_insns_p to no_real_nondebug_insns_p [PR108273] Jeff Law
2023-11-15  9:01       ` [PATCH] sched: Remove debug counter sched_block Kewen.Lin
2023-12-12  6:17         ` PING^1 " Kewen.Lin
2023-12-20 20:43           ` Jeff Law
2023-12-21  5:46             ` Kewen.Lin

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=4675c26c-f230-b6d6-27c5-bc9f74736e38@linux.ibm.com \
    --to=linkw@linux.ibm.com \
    --cc=abel@ispras.ru \
    --cc=amonakov@ispras.ru \
    --cc=bergner@linux.ibm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jlaw@ventanamicro.com \
    --cc=maxim.kuvyrkov@linaro.org \
    --cc=meissner@linux.ibm.com \
    --cc=richard.guenther@gmail.com \
    --cc=richard.sandiford@arm.com \
    --cc=segher@kernel.crashing.org \
    --cc=vmakarov@redhat.com \
    --cc=zhroma@ispras.ru \
    /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).