public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Evandro Menezes <e.menezes@samsung.com>
To: James Greenhalgh <james.greenhalgh@arm.com>
Cc: 'gcc-patches' <gcc-patches@gcc.gnu.org>,
	'Marcus Shawcroft' <Marcus.Shawcroft@arm.com>,
	'Kyrill Tkachov' <kyrylo.tkachov@arm.com>,
	Andrew Pinski <pinskia@gmail.com>
Subject: Re: [PATCH 1/4][AArch64] Add scheduling and cost models for Exynos M1
Date: Thu, 05 Nov 2015 17:31:00 -0000	[thread overview]
Message-ID: <563B9275.5080207@samsung.com> (raw)
In-Reply-To: <20151105092243.GA31968@arm.com>

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

James,

Since other members of the "tune_params" structure were signed integers, 
even though negative numbers would make no sense for most either, I 
followed the same pattern.

Regardless, here's a patch with unsigned integers as you requested:

    [AArch64] Add extra tuning parameters for target processors

    2015-11-05  Evandro Menezes  <e.menezes@samsung.com>

    gcc/

        * config/aarch64/aarch64-protos.h (tune_params): Add new members
        "max_case_values" and "cache_line_size".
        * config/aarch64/aarch64.c (aarch64_case_values_threshold): New
        function.
        (aarch64_override_options_internal): Tune heuristics based on new
        members in "tune_params".
        (TARGET_CASE_VALUES_THRESHOLD): Define macro.

Please, commit if it's alright.

Thank you,

-- 
Evandro Menezes

On 11/05/2015 03:22 AM, James Greenhalgh wrote:
> On Wed, Nov 04, 2015 at 05:21:03PM -0600, Evandro Menezes wrote:
>> Please, ignore the previous patch.  This is the intended patch.
>>
>> Sorry.
>>
>> -- 
>> Evandro Menezes
>>
>> On 11/04/2015 05:18 PM, Evandro Menezes wrote:
>>> This patch adds extra tuning information about AArch64 targets:
>>>
>>> * Maximum number of case values before resorting to a jump table
>>>    The default values assumed independently of the specific backends
>>>    may be rather low for modern processors, which sport quite efficient
>>>    direct branch prediction, whereas indirect branch prediction is
>>>    still typically not so efficient.  This value may be specifically
>>>    set for a processor or left at zero to use the default values.
>>> * L1 cache line size
>>>    The auto-prefetcher uses this information when emitting software
>>>    prefetch insns.
>>>
>>> Please, commit if it's alright.
>>>
>>> Thank you,
>>>
> Thanks for the patch,
>
>> diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h
>> index 81792bc..ecf4685 100644
>> --- a/gcc/config/aarch64/aarch64-protos.h
>> +++ b/gcc/config/aarch64/aarch64-protos.h
>> @@ -195,6 +195,9 @@ struct tune_params
>>     int vec_reassoc_width;
>>     int min_div_recip_mul_sf;
>>     int min_div_recip_mul_df;
>> +  int max_case_values; /* Case values threshold; or 0 for the default.  */
> If we're using an int, how about -1 as the sentinel value? (Maybe someone
> really likes jump tables!). Otherwise, make this an unsigned int?
>
>> +
>> +  int cache_line_size; /* Cache line size; or 0 for the default.  */
> unsigned int?
>
> The patch is otherwise OK, though it needs a ChangeLog.
>
> Thanks,
> James
>
>


[-- Attachment #2: target.patch --]
[-- Type: text/x-patch, Size: 4631 bytes --]

diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h
index 81792bc..ecf4685 100644
--- a/gcc/config/aarch64/aarch64-protos.h
+++ b/gcc/config/aarch64/aarch64-protos.h
@@ -195,6 +195,9 @@ struct tune_params
   int vec_reassoc_width;
   int min_div_recip_mul_sf;
   int min_div_recip_mul_df;
+  unsigned int max_case_values; /* Case values threshold; or 0 for the default.  */
+
+  unsigned int cache_line_size; /* Cache line size; or 0 for the default.  */
 
 /* An enum specifying how to take into account CPU autoprefetch capabilities
    during instruction scheduling:
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 5c8604f..e7f1c07 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -355,6 +355,8 @@ static const struct tune_params generic_tunings =
   1,	/* vec_reassoc_width.  */
   2,	/* min_div_recip_mul_sf.  */
   2,	/* min_div_recip_mul_df.  */
+  0,	/* max_case_values.  */
+  0,	/* cache_line_size.  */
   tune_params::AUTOPREFETCHER_OFF,	/* autoprefetcher_model.  */
   (AARCH64_EXTRA_TUNE_NONE)	/* tune_flags.  */
 };
@@ -378,6 +380,8 @@ static const struct tune_params cortexa53_tunings =
   1,	/* vec_reassoc_width.  */
   2,	/* min_div_recip_mul_sf.  */
   2,	/* min_div_recip_mul_df.  */
+  0,	/* max_case_values.  */
+  0,	/* cache_line_size.  */
   tune_params::AUTOPREFETCHER_WEAK,	/* autoprefetcher_model.  */
   (AARCH64_EXTRA_TUNE_NONE)	/* tune_flags.  */
 };
@@ -401,6 +405,8 @@ static const struct tune_params cortexa57_tunings =
   1,	/* vec_reassoc_width.  */
   2,	/* min_div_recip_mul_sf.  */
   2,	/* min_div_recip_mul_df.  */
+  0,	/* max_case_values.  */
+  0,	/* cache_line_size.  */
   tune_params::AUTOPREFETCHER_WEAK,	/* autoprefetcher_model.  */
   (AARCH64_EXTRA_TUNE_RENAME_FMA_REGS)	/* tune_flags.  */
 };
@@ -424,6 +430,8 @@ static const struct tune_params cortexa72_tunings =
   1,	/* vec_reassoc_width.  */
   2,	/* min_div_recip_mul_sf.  */
   2,	/* min_div_recip_mul_df.  */
+  0,	/* max_case_values.  */
+  0,	/* cache_line_size.  */
   tune_params::AUTOPREFETCHER_OFF,	/* autoprefetcher_model.  */
   (AARCH64_EXTRA_TUNE_NONE)	/* tune_flags.  */
 };
@@ -446,6 +454,8 @@ static const struct tune_params thunderx_tunings =
   1,	/* vec_reassoc_width.  */
   2,	/* min_div_recip_mul_sf.  */
   2,	/* min_div_recip_mul_df.  */
+  0,	/* max_case_values.  */
+  0,	/* cache_line_size.  */
   tune_params::AUTOPREFETCHER_OFF,	/* autoprefetcher_model.  */
   (AARCH64_EXTRA_TUNE_NONE)	/* tune_flags.  */
 };
@@ -468,6 +478,8 @@ static const struct tune_params xgene1_tunings =
   1,	/* vec_reassoc_width.  */
   2,	/* min_div_recip_mul_sf.  */
   2,	/* min_div_recip_mul_df.  */
+  0,	/* max_case_values.  */
+  0,	/* cache_line_size.  */
   tune_params::AUTOPREFETCHER_OFF,	/* autoprefetcher_model.  */
   (AARCH64_EXTRA_TUNE_NONE)	/* tune_flags.  */
 };
@@ -3242,6 +3254,20 @@ aarch64_cannot_force_const_mem (machine_mode mode ATTRIBUTE_UNUSED, rtx x)
   return aarch64_tls_referenced_p (x);
 }
 
+/* Implement TARGET_CASE_VALUES_THRESHOLD.  */
+
+static unsigned int
+aarch64_case_values_threshold (void)
+{
+  /* Use the specified limit for the number of cases before using jump
+     tables at higher optimization levels.  */
+  if (optimize > 2
+      && selected_cpu->tune->max_case_values != 0)
+    return selected_cpu->tune->max_case_values;
+  else
+    return default_case_values_threshold ();
+}
+
 /* Return true if register REGNO is a valid index register.
    STRICT_P is true if REG_OK_STRICT is in effect.  */
 
@@ -7672,6 +7698,13 @@ aarch64_override_options_internal (struct gcc_options *opts)
 			 opts->x_param_values,
 			 global_options_set.x_param_values);
 
+  /* Set the L1 cache line size.  */
+  if (selected_cpu->tune->cache_line_size != 0)
+    maybe_set_param_value (PARAM_L1_CACHE_LINE_SIZE,
+			   selected_cpu->tune->cache_line_size,
+			   opts->x_param_values,
+			   global_options_set.x_param_values);
+
   aarch64_override_options_after_change_1 (opts);
 }
 
@@ -13385,6 +13418,7 @@ aarch64_promoted_type (const_tree t)
     return float_type_node;
   return NULL_TREE;
 }
+
 #undef TARGET_ADDRESS_COST
 #define TARGET_ADDRESS_COST aarch64_address_cost
 
@@ -13432,6 +13466,9 @@ aarch64_promoted_type (const_tree t)
 #undef TARGET_CANNOT_FORCE_CONST_MEM
 #define TARGET_CANNOT_FORCE_CONST_MEM aarch64_cannot_force_const_mem
 
+#undef TARGET_CASE_VALUES_THRESHOLD
+#define TARGET_CASE_VALUES_THRESHOLD aarch64_case_values_threshold
+
 #undef TARGET_CONDITIONAL_REGISTER_USAGE
 #define TARGET_CONDITIONAL_REGISTER_USAGE aarch64_conditional_register_usage
 


  reply	other threads:[~2015-11-05 17:31 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-27 23:38 [AArch64] " Evandro Menezes
2015-10-28 10:40 ` James Greenhalgh
2015-10-28 10:45   ` Andrew Pinski
2015-10-28 21:58     ` Evandro Menezes
2015-10-29 23:02   ` Evandro Menezes
2015-10-28 11:01 ` Kyrill Tkachov
2015-10-29 19:38   ` Evandro Menezes
2015-11-04 23:10 ` [PATCH 0/4][AArch64] " Evandro Menezes
2015-11-04 23:18   ` [PATCH 1/4][AArch64] " Evandro Menezes
2015-11-04 23:21     ` Evandro Menezes
2015-11-05  9:22       ` James Greenhalgh
2015-11-05 17:31         ` Evandro Menezes [this message]
2015-11-12 14:47           ` James Greenhalgh
2015-11-05 20:51   ` [PATCH 2/4][AArch64] Increase the loop peeling limit Evandro Menezes
2015-11-19 22:04     ` Evandro Menezes
2015-11-20 11:53       ` James Greenhalgh
2015-12-03 21:07         ` Evandro Menezes
2015-12-14 11:26           ` James Greenhalgh
2015-12-15 23:34             ` Evandro Menezes
2015-12-16 11:24               ` Richard Earnshaw (lists)
2015-12-16 12:42                 ` Richard Biener
2015-12-16 20:11                 ` Evandro Menezes
2016-01-08 22:55                   ` Evandro Menezes
2016-02-03 19:46                     ` Evandro Menezes
2016-03-16 19:48                       ` Evandro Menezes
2015-11-05 23:30   ` [PATCH 3/4][AArch64] Add scheduling model for Exynos M1 Evandro Menezes
2015-11-05 23:30   ` Evandro Menezes
2015-11-09 23:06     ` Evandro Menezes
2015-11-10 17:50       ` [PATCH 3a/4][AArch64] Add attribute for compatibility with ARM pipeline models Evandro Menezes
2015-11-10 18:01         ` Ramana Radhakrishnan
2015-11-10 18:03           ` Ramana Radhakrishnan
2015-11-12 14:55         ` James Greenhalgh
2015-11-12 15:39           ` Evandro Menezes
2015-11-12 17:32             ` Evandro Menezes
2015-11-19 22:05               ` Evandro Menezes
2015-11-20 12:27               ` James Greenhalgh
2015-11-20 14:34                 ` Kyrill Tkachov
2015-11-20 15:56                   ` Evandro Menezes
2015-11-20 15:55                 ` Evandro Menezes
2015-11-20 16:16                   ` James Greenhalgh
2015-11-10 17:54       ` [PATCH 3b/4][AArch64] Add scheduling model for Exynos M1 Evandro Menezes
2015-11-19 22:06         ` Evandro Menezes
2015-11-20 17:17         ` James Greenhalgh
2015-11-20 22:07           ` Evandro Menezes
2015-12-03 20:58           ` Evandro Menezes
2015-12-04  9:25             ` Kyrill Tkachov
2015-12-07 19:55               ` Evandro Menezes
2015-11-06  0:09   ` [PATCH 4/4][AArch64] Add cost " Evandro Menezes
2015-11-19 22:06     ` Evandro Menezes
2015-11-20 17:19       ` James Greenhalgh
2015-11-24  9:56     ` Kyrill Tkachov
2015-12-03 20:49     ` Evandro Menezes

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=563B9275.5080207@samsung.com \
    --to=e.menezes@samsung.com \
    --cc=Marcus.Shawcroft@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=james.greenhalgh@arm.com \
    --cc=kyrylo.tkachov@arm.com \
    --cc=pinskia@gmail.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).