public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Luis Machado <luis.machado@linaro.org>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: Jeff Law <law@redhat.com>, GCC Patches <gcc-patches@gcc.gnu.org>,
	James Greenhalgh <james.greenhalgh@arm.com>,
	Richard Earnshaw <Richard.Earnshaw@arm.com>
Subject: Re: [PATCH 1/2] Introduce prefetch-minimum stride option
Date: Mon, 07 May 2018 15:51:00 -0000	[thread overview]
Message-ID: <bedf385f-1df1-7eb3-2442-687b09ad7991@linaro.org> (raw)
In-Reply-To: <CAMe9rOou84WnBTk0RniHgJacishueWGQzr4fgrD76HgMQQHChA@mail.gmail.com>



On 05/07/2018 12:15 PM, H.J. Lu wrote:
> On Mon, May 7, 2018 at 7:09 AM, Luis Machado <luis.machado@linaro.org> wrote:
>>
>>
>> On 05/01/2018 03:30 PM, Jeff Law wrote:
>>>
>>> On 01/22/2018 06:46 AM, Luis Machado wrote:
>>>>
>>>> This patch adds a new option to control the minimum stride, for a memory
>>>> reference, after which the loop prefetch pass may issue software prefetch
>>>> hints for. There are two motivations:
>>>>
>>>> * Make the pass less aggressive, only issuing prefetch hints for bigger
>>>> strides
>>>> that are more likely to benefit from prefetching. I've noticed a case in
>>>> cpu2017
>>>> where we were issuing thousands of hints, for example.
>>>>
>>>> * For processors that have a hardware prefetcher, like Falkor, it allows
>>>> the
>>>> loop prefetch pass to defer prefetching of smaller (less than the
>>>> threshold)
>>>> strides to the hardware prefetcher instead. This prevents conflicts
>>>> between
>>>> the software prefetcher and the hardware prefetcher.
>>>>
>>>> I've noticed considerable reduction in the number of prefetch hints and
>>>> slightly positive performance numbers. This aligns GCC and LLVM in terms
>>>> of
>>>> prefetch behavior for Falkor.
>>>>
>>>> The default settings should guarantee no changes for existing targets.
>>>> Those
>>>> are free to tweak the settings as necessary.
>>>>
>>>> No regressions in the testsuite and bootstrapped ok on aarch64-linux.
>>>>
>>>> Ok?
>>>>
>>>> 2018-01-22  Luis Machado  <luis.machado@linaro.org>
>>>>
>>>>          Introduce option to limit software prefetching to known constant
>>>>          strides above a specific threshold with the goal of preventing
>>>>          conflicts with a hardware prefetcher.
>>>>
>>>>          gcc/
>>>>          * config/aarch64/aarch64-protos.h (cpu_prefetch_tune)
>>>>          <minimum_stride>: New const int field.
>>>>          * config/aarch64/aarch64.c (generic_prefetch_tune): Update to
>>>> include
>>>>          minimum_stride field.
>>>>          (exynosm1_prefetch_tune): Likewise.
>>>>          (thunderxt88_prefetch_tune): Likewise.
>>>>          (thunderx_prefetch_tune): Likewise.
>>>>          (thunderx2t99_prefetch_tune): Likewise.
>>>>          (qdf24xx_prefetch_tune): Likewise. Set minimum_stride to 2048.
>>>>          (aarch64_override_options_internal): Update to set
>>>>          PARAM_PREFETCH_MINIMUM_STRIDE.
>>>>          * doc/invoke.texi (prefetch-minimum-stride): Document new option.
>>>>          * params.def (PARAM_PREFETCH_MINIMUM_STRIDE): New.
>>>>          * params.h (PARAM_PREFETCH_MINIMUM_STRIDE): Define.
>>>>          * tree-ssa-loop-prefetch.c (should_issue_prefetch_p): Return
>>>> false if
>>>>          stride is constant and is below the minimum stride threshold.
>>>
>>> OK for the trunk.
>>> jeff
>>>
>>
>> Thanks. Committed as revision 259995 now.
> 
> This breaks bootstrap on x86:
> 
> ../../src-trunk/gcc/tree-ssa-loop-prefetch.c: In function ‘bool
> should_issue_prefetch_p(mem_ref*)’:
> ../../src-trunk/gcc/tree-ssa-loop-prefetch.c:1010:54: error:
> comparison of integer expressions of different signedness: ‘long long
> unsigned int’ and ‘int’ [-Werror=sign-compare]
>         && absu_hwi (int_cst_value (ref->group->step)) < PREFETCH_MINIMUM_STRIDE)
> ../../src-trunk/gcc/tree-ssa-loop-prefetch.c:1014:4: error: format
> ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘long
> long int’ [-Werror=format=]
>      "Step for reference %u:%u (%d) is less than the mininum "
>      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>      "required stride of %d\n",
>      ~~~~~~~~~~~~~~~~~~~~~~~~~
>      ref->group->uid, ref->uid, int_cst_value (ref->group->step),
>                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 

I've reverted this for now while i address the bootstrap problem.

  reply	other threads:[~2018-05-07 15:51 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-22 13:46 [PATCH 0/2] Add a couple new options to control loop prefetch pass Luis Machado
2018-01-22 14:01 ` [PATCH 1/2] Introduce prefetch-minimum stride option Luis Machado
2018-01-23  9:46   ` Kyrill Tkachov
2018-01-23 13:23     ` Luis Machado
2018-05-01 18:30   ` Jeff Law
2018-05-07 14:10     ` Luis Machado
2018-05-07 15:15       ` H.J. Lu
2018-05-07 15:51         ` Luis Machado [this message]
2018-05-14 21:21   ` Luis Machado
2018-05-15  9:59     ` Kyrill Tkachov
2018-05-15 11:21       ` Luis Machado
2018-05-16  9:22         ` Kyrill Tkachov
2018-05-16 11:53           ` Luis Machado
2018-05-22 18:56             ` Luis Machado
2018-05-22 21:21               ` Jeff Law
2018-05-23 20:27               ` H.J. Lu
2018-05-23 22:34                 ` Luis Machado
2018-05-23 22:41                   ` H.J. Lu
2018-05-23 22:42                     ` H.J. Lu
2018-05-23 22:45                       ` H.J. Lu
2018-05-23 23:29                         ` Luis Machado
2018-05-24  2:51                           ` Jeff Law
2018-05-24 12:21                             ` Luis Machado
2018-01-22 14:10 ` [PATCH 2/2] Introduce prefetch-dynamic-strides option Luis Machado
2018-01-23  9:53   ` Kyrill Tkachov
2018-01-23 13:32     ` Luis Machado
2018-05-01 18:31   ` Jeff Law
2018-05-07 14:13     ` Luis Machado

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=bedf385f-1df1-7eb3-2442-687b09ad7991@linaro.org \
    --to=luis.machado@linaro.org \
    --cc=Richard.Earnshaw@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hjl.tools@gmail.com \
    --cc=james.greenhalgh@arm.com \
    --cc=law@redhat.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).