From: "Kewen.Lin" <linkw@linux.ibm.com>
To: richard.sandiford@arm.com
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
Richard Biener <richard.guenther@gmail.com>,
David Edelsohn <dje.gcc@gmail.com>,
Segher Boessenkool <segher@kernel.crashing.org>,
Bill Schmidt <wschmidt@linux.ibm.com>
Subject: Re: [PATCH 1/2] vect: Add costing_for_scalar parameter to init_cost hook
Date: Tue, 11 May 2021 15:18:33 +0800 [thread overview]
Message-ID: <200e02fe-07c8-2963-f423-0d2f37481cd9@linux.ibm.com> (raw)
In-Reply-To: <mptfsyu65qd.fsf@arm.com>
Hi Richard,
on 2021/5/10 下午10:08, Richard Sandiford wrote:
> "Kewen.Lin via Gcc-patches" <gcc-patches@gcc.gnu.org> writes:
>> on 2021/5/7 下午5:43, Richard Biener wrote:
>>> On Fri, May 7, 2021 at 5:30 AM Kewen.Lin via Gcc-patches
>>> <gcc-patches@gcc.gnu.org> wrote:
>>>>
>>>> Hi,
>>>>
>>>> When I was investigating density_test heuristics, I noticed that
>>>> the current rs6000_density_test could be used for single scalar
>>>> iteration cost calculation, through the call trace:
>>>> vect_compute_single_scalar_iteration_cost
>>>> -> rs6000_finish_cost
>>>> -> rs6000_density_test
>>>>
>>>> It looks unexpected as its desriptive function comments and Bill
>>>> helped to confirm this needs to be fixed (thanks!).
>>>>
>>>> So this patch is to check the passed data, if it's the same as
>>>> the one in loop_vinfo, it indicates it's working on vector version
>>>> cost calculation, otherwise just early return.
>>>>
>>>> Bootstrapped/regtested on powerpc64le-linux-gnu P9.
>>>>
>>>> Nothing remarkable was observed with SPEC2017 Power9 full run.
>>>>
>>>> Is it ok for trunk?
>>>
>>> + /* Only care about cost of vector version, so exclude scalar
>>> version here. */
>>> + if (LOOP_VINFO_TARGET_COST_DATA (loop_vinfo) != (void *) data)
>>> + return;
>>>
>>> Hmm, looks like a quite "random" test to me. What about adding a
>>> parameter to finish_cost () (or init_cost?) indicating the cost kind?
>>>
>>
>> I originally wanted to change the hook interface, but noticed that
>> the finish_cost in function vect_estimate_min_profitable_iters is
>> the only invocation with LOOP_VINFO_TARGET_COST_DATA (loop_vinfo),
>> it looks enough to differentiate the scalar version costing or
>> vector version costing for loop. Do you mean this observation/
>> assumption easy to be broken sometime later?
>>
>> The attached patch to add one new parameter to indicate the
>> costing kind explicitly as you suggested.
>>
>> Does it look better?
>>
>> gcc/ChangeLog:
>>
>> * doc/tm.texi: Regenerated.
>> * target.def (init_cost): Add new parameter costing_for_scalar.
>> * targhooks.c (default_init_cost): Adjust for new parameter.
>> * targhooks.h (default_init_cost): Likewise.
>> * tree-vect-loop.c (_loop_vec_info::_loop_vec_info): Likewise.
>> (vect_compute_single_scalar_iteration_cost): Likewise.
>> (vect_analyze_loop_2): Likewise.
>> * tree-vect-slp.c (_bb_vec_info::_bb_vec_info): Likewise.
>> (vect_bb_vectorization_profitable_p): Likewise.
>> * tree-vectorizer.h (init_cost): Likewise.
>> * config/aarch64/aarch64.c (aarch64_init_cost): Likewise.
>> * config/i386/i386.c (ix86_init_cost): Likewise.
>> * config/rs6000/rs6000.c (rs6000_init_cost): Likewise.
>
> Just wanted to say thanks for doing this. I hit the same problem
> when doing the Neoverse V1 tuning near the end of stage 4. Due to
> the extreme lateness of the changes, I couldn't reasonably ask for
> target-independent help at that time, but this patch will make
> things simpler for AArch64. :-)
>
Glad to see that rs6000 port isn't the only port requesting this. :-)
Thanks for the information!
BR,
Kewen
next prev parent reply other threads:[~2021-05-11 7:18 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-07 2:28 [PATCH] rs6000: Make density_test only for vector version Kewen.Lin
2021-05-07 9:43 ` Richard Biener
2021-05-08 8:05 ` [PATCH 1/2] vect: Add costing_for_scalar parameter to init_cost hook Kewen.Lin
2021-05-10 13:55 ` Richard Biener
2021-05-11 7:10 ` Kewen.Lin
2021-05-11 7:54 ` Richard Biener
2021-05-11 10:50 ` Kewen.Lin
2021-05-11 11:59 ` Richard Biener
2021-05-13 7:04 ` Kewen.Lin
2021-05-17 8:55 ` Richard Biener
2021-05-17 9:24 ` Kewen.Lin
2021-05-10 14:08 ` Richard Sandiford
2021-05-11 7:18 ` Kewen.Lin [this message]
2021-05-07 11:43 ` [PATCH] rs6000: Make density_test only for vector version will schmidt
2021-05-08 8:47 ` Kewen.Lin
2021-05-08 8:12 ` [PATCH 2/2 v2] rs6000: Guard " Kewen.Lin
2021-05-10 20:12 ` Segher Boessenkool
2021-05-11 7:20 ` 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=200e02fe-07c8-2963-f423-0d2f37481cd9@linux.ibm.com \
--to=linkw@linux.ibm.com \
--cc=dje.gcc@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=richard.guenther@gmail.com \
--cc=richard.sandiford@arm.com \
--cc=segher@kernel.crashing.org \
--cc=wschmidt@linux.ibm.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).