public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Philipp Tomsich <philipp.tomsich@vrull.eu>
To: Jeff Law <jeffreyalaw@gmail.com>
Cc: "Richard Biener" <rguenther@suse.de>,
	"Manolis Tsamis" <manolis.tsamis@vrull.eu>,
	gcc-patches@gcc.gnu.org,
	"Christoph Müllner" <christoph.muellner@vrull.eu>,
	"Jiangning Liu" <jiangning.liu@amperecomputing.com>,
	"Jakub Jelinek" <jakub@redhat.com>,
	"Andrew Pinski" <quic_apinski@quicinc.com>
Subject: Re: [PATCH v2] Target-independent store forwarding avoidance.
Date: Tue, 11 Jun 2024 15:52:39 +0200	[thread overview]
Message-ID: <CAAeLtUDn0igbNBe_d=EpcyU0x-J81DhhFLdm2yAnHObgWiufuQ@mail.gmail.com> (raw)
In-Reply-To: <63edf666-1d21-449b-8c28-4a6924fcf1c7@gmail.com>

On Tue, 11 Jun 2024 at 15:37, Jeff Law <jeffreyalaw@gmail.com> wrote:
>
>
>
> On 6/11/24 1:22 AM, Richard Biener wrote:
>
> >> Absolutely.   But forwarding from a smaller store to a wider load is painful
> >> from a hardware standpoint and if we can avoid it from a codegen standpoint,
> >> we should.
> >
> > Note there's also the possibility to increase the distance between the
> > store and the load - in fact the time a store takes to a) retire and
> > b) get from the store buffers to where the load-store unit would pick it
> > up (L1-D) is another target specific tuning knob.  That said, if that
> > distance isn't too large (on x86 there might be only an upper bound
> > given by the OOO window size and the L1D store latency(?), possibly
> > also additionally by the store buffer size) attacking the issue in
> > sched1 or sched2 might be another possibility.  So I think pass placement
> > is another thing to look at - I'd definitely place it after sched1
> > but I guess without looking at the pass again it's way before that?
> True, but I doubt there are enough instructions we could sink the load
> past to make a measurable difference.  This is especially true on the
> class of uarchs where this is going to be most important.
>
> In the case where the store/load can't be interchanged and thus this new
> pass rejects any transformation, we could try to do something in the
> scheduler to defer the load as long as possible.  Essentially it's a
> true dependency through a memory location using must-aliasing properties
> and in that case we'd want to crank up the "latency" of the store so
> that the load gets pushed away.
>
> I think one of the difficulties here is we often model stores as not
> having any latency (which is probably OK in most cases).  Input data
> dependencies and structural hazards dominate dominate considerations for
> stores.

I don't think that TARGET_SCHED_ADJUST_COST would even be called for a
data-dependence through a memory location.

Note that, strictly speaking, the store does not have an extended
latency; it will be the load that will have an increased latency
(almost as if we knew that the load will miss to one of the outer
points-of-coherence).  The difference being that the load would not
hang around in a scheduling queue until being dispatched, but its
execution would start immediately and take more cycles (and
potentially block an execution pipeline for longer).

Philipp.

  reply	other threads:[~2024-06-11 13:52 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-06 10:10 Manolis Tsamis
2024-06-07 22:31 ` Jeff Law
2024-06-09 14:29   ` Jeff Law
2024-06-10  8:03     ` Manolis Tsamis
2024-06-13 11:40     ` Manolis Tsamis
2024-06-13 13:59       ` Jeff Law
2024-06-10  6:26   ` Richard Biener
2024-06-10  7:55   ` Manolis Tsamis
2024-06-10 18:03     ` Jeff Law
2024-06-10 18:27       ` Philipp Tomsich
2024-06-10 18:37         ` Jeff Law
2024-06-12 13:02         ` Manolis Tsamis
2024-06-11  7:22       ` Richard Biener
2024-06-11 13:37         ` Jeff Law
2024-06-11 13:52           ` Philipp Tomsich [this message]
2024-06-11 14:18             ` Jeff Law
2024-06-12  6:47               ` Richard Biener
2024-06-12 14:18                 ` Jeff Law

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='CAAeLtUDn0igbNBe_d=EpcyU0x-J81DhhFLdm2yAnHObgWiufuQ@mail.gmail.com' \
    --to=philipp.tomsich@vrull.eu \
    --cc=christoph.muellner@vrull.eu \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=jeffreyalaw@gmail.com \
    --cc=jiangning.liu@amperecomputing.com \
    --cc=manolis.tsamis@vrull.eu \
    --cc=quic_apinski@quicinc.com \
    --cc=rguenther@suse.de \
    /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).