public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-2694] aarch64: Restrict issue heuristics to inner vector loop
@ 2021-08-03 12:01 Richard Sandiford
0 siblings, 0 replies; only message in thread
From: Richard Sandiford @ 2021-08-03 12:01 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:9690309baf8294b0512b55b133bc102dc0dac5b5
commit r12-2694-g9690309baf8294b0512b55b133bc102dc0dac5b5
Author: Richard Sandiford <richard.sandiford@arm.com>
Date: Tue Aug 3 13:00:48 2021 +0100
aarch64: Restrict issue heuristics to inner vector loop
The AArch64 vector costs try to take issue rates into account.
However, when vectorising an outer loop, we lumped the inner
and outer operations together, which is somewhat meaningless.
This patch restricts the heuristic to the inner loop.
gcc/
* config/aarch64/aarch64.c (aarch64_add_stmt_cost): Only
record issue information for operations that occur in the
innermost loop.
Diff:
---
gcc/config/aarch64/aarch64.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 19045ef6944..19625eb048d 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -15392,6 +15392,10 @@ aarch64_add_stmt_cost (class vec_info *vinfo, void *data, int count,
fractional_cost stmt_cost
= aarch64_builtin_vectorization_cost (kind, vectype, misalign);
+ bool in_inner_loop_p = (where == vect_body
+ && stmt_info
+ && stmt_in_inner_loop_p (vinfo, stmt_info));
+
/* Do one-time initialization based on the vinfo. */
loop_vec_info loop_vinfo = dyn_cast<loop_vec_info> (vinfo);
bb_vec_info bb_vinfo = dyn_cast<bb_vec_info> (vinfo);
@@ -15438,14 +15442,15 @@ aarch64_add_stmt_cost (class vec_info *vinfo, void *data, int count,
stmt_cost = aarch64_adjust_stmt_cost (kind, stmt_info, vectype,
stmt_cost);
- /* If we're recording a nonzero vector loop body cost, also estimate
- the operations that would need to be issued by all relevant
- implementations of the loop. */
+ /* If we're recording a nonzero vector loop body cost for the
+ innermost loop, also estimate the operations that would need
+ to be issued by all relevant implementations of the loop. */
auto *issue_info = aarch64_tune_params.vec_costs->issue_info;
if (loop_vinfo
&& issue_info
&& costs->vec_flags
&& where == vect_body
+ && (!LOOP_VINFO_LOOP (loop_vinfo)->inner || in_inner_loop_p)
&& vectype
&& stmt_cost != 0)
{
@@ -15489,8 +15494,7 @@ aarch64_add_stmt_cost (class vec_info *vinfo, void *data, int count,
/* Statements in an inner loop relative to the loop being
vectorized are weighted more heavily. The value here is
arbitrary and could potentially be improved with analysis. */
- if (where == vect_body && stmt_info
- && stmt_in_inner_loop_p (vinfo, stmt_info))
+ if (in_inner_loop_p)
{
gcc_assert (loop_vinfo);
count *= LOOP_VINFO_INNER_LOOP_COST_FACTOR (loop_vinfo); /* FIXME */
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-08-03 12:01 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-03 12:01 [gcc r12-2694] aarch64: Restrict issue heuristics to inner vector loop Richard Sandiford
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).