public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] rs6000: Make density_test only for vector version
@ 2021-05-07  2:28 Kewen.Lin
  2021-05-07  9:43 ` Richard Biener
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Kewen.Lin @ 2021-05-07  2:28 UTC (permalink / raw)
  To: GCC Patches; +Cc: Bill Schmidt, Segher Boessenkool, David Edelsohn

[-- Attachment #1: Type: text/plain, Size: 864 bytes --]

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?

BR,
Kewen
------
gcc/ChangeLog:

	* config/rs6000/rs6000.c (rs6000_density_test): Early return if
	calculating single scalar iteration cost.

[-- Attachment #2: 0001-rs6000-Make-density_test-only-for-vector-version.patch --]
[-- Type: text/plain, Size: 640 bytes --]

 gcc/config/rs6000/rs6000.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 48b8efd732b..ffdf10098a9 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -5252,6 +5252,10 @@ rs6000_density_test (rs6000_cost_data *data)
   int vec_cost = data->cost[vect_body], not_vec_cost = 0;
   int i, density_pct;
 
+  /* Only care about cost of vector version, so exclude scalar version here.  */
+  if (LOOP_VINFO_TARGET_COST_DATA (loop_vinfo) != (void *) data)
+    return;
+
   for (i = 0; i < nbbs; i++)
     {
       basic_block bb = bbs[i];
-- 
2.17.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2021-05-17  9:24 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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).