public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <jeffreyalaw@gmail.com>
To: Vineet Gupta <vineetg@rivosinc.com>,
	Robin Dapp <rdapp.gcc@gmail.com>,
	gcc-patches <gcc-patches@gcc.gnu.org>,
	palmer <palmer@dabbelt.com>, Kito Cheng <kito.cheng@gmail.com>,
	"juzhe.zhong@rivai.ai" <juzhe.zhong@rivai.ai>
Subject: Re: [PATCH] RISC-V: Enable pressure-aware scheduling by default.
Date: Fri, 18 Aug 2023 21:23:53 -0600	[thread overview]
Message-ID: <fe507660-80dd-f56b-8875-da892cf54e73@gmail.com> (raw)
In-Reply-To: <e279b3ad-ccc4-6be9-f4a4-5f5baea03892@rivosinc.com>



On 8/18/23 17:24, Vineet Gupta wrote:
> 
> 
> On 8/18/23 16:08, Jeff Law wrote:
>>> There is some slight regression in code quality for a number of
>>> vector tests where we spill more due to different instructions order.
>>> The ones I looked at were a mix of bad luck and/or brittle tests.
>>> Comparing the size of the generated assembly or the number of vsetvls
>>> for SPECint also didn't show any immediate benefit but that's obviously
>>> not a very fine-grained analysis.
>> Yea.  In fact I wouldn't really expect significant changes other than 
>> those key loops in x264.
> 
> Care to elaborate a bit more please. I've seen severe reg pressure / 
> spills in a bunch of others: cactu, lbm, exchange2. Is there something 
> specific to x264 spills ?
The only thing that's particularly interesting about the x264 spills is 
they're caused by scheduling.

In simplest terms GCC's scheduler tries to minimize the latency of the 
critical path in a block.  For x264 we've got a loop that we unrolled 8 
times with 8 byte sized loads per loop iteration.  So 64 byte loads, all 
higher from a critical path latency standpoint than anything else.

Naturally there's no way we can hold 64 values live as we only have 32 
registers and thus we blow out the register file.

By turning on pressure sensitive scheduling, as register pressure 
approaches the threshold, the scheduler will select a lower priority 
instruction (say computing the difference of two previously loaded 
values) that reduces register pressure.  So it's not critical path 
optimal, but it keep us from blowing out the register file and 
ultimately we get better performance as a result.

jeff


      reply	other threads:[~2023-08-19  3:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-18 13:57 Robin Dapp
2023-08-18 23:08 ` Jeff Law
2023-08-18 23:24   ` Vineet Gupta
2023-08-19  3:23     ` Jeff Law [this message]

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=fe507660-80dd-f56b-8875-da892cf54e73@gmail.com \
    --to=jeffreyalaw@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=juzhe.zhong@rivai.ai \
    --cc=kito.cheng@gmail.com \
    --cc=palmer@dabbelt.com \
    --cc=rdapp.gcc@gmail.com \
    --cc=vineetg@rivosinc.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).