From 47811d7dbe38c4e47c83426aa29ae41d7db055c1 Mon Sep 17 00:00:00 2001 From: Luis Machado Date: Mon, 7 May 2018 15:47:14 +0000 Subject: [PATCH] re PR bootstrap/85681 (r259995 breaks bootstrap on x86_64-*-freebsd) 2018-05-07 Luis Machado PR bootstrap/85681 Revert: 2018-05-07 Luis Machado * config/aarch64/aarch64-protos.h (cpu_prefetch_tune) : New const bool field. * config/aarch64/aarch64.c (generic_prefetch_tune): Update to include prefetch_dynamic_strides. (exynosm1_prefetch_tune): Likewise. (thunderxt88_prefetch_tune): Likewise. (thunderx_prefetch_tune): Likewise. (thunderx2t99_prefetch_tune): Likewise. (qdf24xx_prefetch_tune): Likewise. Set prefetch_dynamic_strides to false. (aarch64_override_options_internal): Update to set PARAM_PREFETCH_DYNAMIC_STRIDES. * doc/invoke.texi (prefetch-dynamic-strides): Document new option. * params.def (PARAM_PREFETCH_DYNAMIC_STRIDES): New. * params.h (PARAM_PREFETCH_DYNAMIC_STRIDES): Define. * tree-ssa-loop-prefetch.c (should_issue_prefetch_p): Account for prefetch-dynamic-strides setting. 2018-05-07 Luis Machado * config/aarch64/aarch64-protos.h (cpu_prefetch_tune) : 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. From-SVN: r260000 --- gcc/ChangeLog | 42 +++++++++++++++++++++++++++++ gcc/config/aarch64/aarch64-protos.h | 6 ----- gcc/config/aarch64/aarch64.c | 24 +---------------- gcc/doc/invoke.texi | 25 ----------------- gcc/params.def | 18 ------------- gcc/params.h | 4 --- gcc/tree-ssa-loop-prefetch.c | 26 ------------------ 7 files changed, 43 insertions(+), 102 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6a5a871901c..cb5582b86ad 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,45 @@ +2018-05-07 Luis Machado + + PR bootstrap/85681 + Revert: + 2018-05-07 Luis Machado + + * config/aarch64/aarch64-protos.h (cpu_prefetch_tune) + : New const bool field. + * config/aarch64/aarch64.c (generic_prefetch_tune): Update to include + prefetch_dynamic_strides. + (exynosm1_prefetch_tune): Likewise. + (thunderxt88_prefetch_tune): Likewise. + (thunderx_prefetch_tune): Likewise. + (thunderx2t99_prefetch_tune): Likewise. + (qdf24xx_prefetch_tune): Likewise. Set prefetch_dynamic_strides to false. + (aarch64_override_options_internal): Update to set + PARAM_PREFETCH_DYNAMIC_STRIDES. + * doc/invoke.texi (prefetch-dynamic-strides): Document new option. + * params.def (PARAM_PREFETCH_DYNAMIC_STRIDES): New. + * params.h (PARAM_PREFETCH_DYNAMIC_STRIDES): Define. + * tree-ssa-loop-prefetch.c (should_issue_prefetch_p): Account for + prefetch-dynamic-strides setting. + + 2018-05-07 Luis Machado + + * config/aarch64/aarch64-protos.h (cpu_prefetch_tune) + : 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. + 2018-05-07 Luis Machado * config/aarch64/aarch64.c (qdf24xx_prefetch_tune) : Set diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h index 157308ddb79..cda2895d28e 100644 --- a/gcc/config/aarch64/aarch64-protos.h +++ b/gcc/config/aarch64/aarch64-protos.h @@ -230,12 +230,6 @@ struct cpu_prefetch_tune const int l1_cache_size; const int l1_cache_line_size; const int l2_cache_size; - /* Whether software prefetch hints should be issued for non-constant - strides. */ - const bool prefetch_dynamic_strides; - /* The minimum constant stride beyond which we should use prefetch - hints for. */ - const int minimum_stride; const int default_opt_level; }; diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index b50e6c45b2a..6847b9a683c 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -547,8 +547,6 @@ static const cpu_prefetch_tune generic_prefetch_tune = -1, /* l1_cache_size */ -1, /* l1_cache_line_size */ -1, /* l2_cache_size */ - true, /* prefetch_dynamic_strides */ - -1, /* minimum_stride */ -1 /* default_opt_level */ }; @@ -558,8 +556,6 @@ static const cpu_prefetch_tune exynosm1_prefetch_tune = -1, /* l1_cache_size */ 64, /* l1_cache_line_size */ -1, /* l2_cache_size */ - true, /* prefetch_dynamic_strides */ - -1, /* minimum_stride */ -1 /* default_opt_level */ }; @@ -569,9 +565,7 @@ static const cpu_prefetch_tune qdf24xx_prefetch_tune = 32, /* l1_cache_size */ 64, /* l1_cache_line_size */ 512, /* l2_cache_size */ - false, /* prefetch_dynamic_strides */ - 2048, /* minimum_stride */ - 3 /* default_opt_level */ + -1 /* default_opt_level */ }; static const cpu_prefetch_tune thunderxt88_prefetch_tune = @@ -580,8 +574,6 @@ static const cpu_prefetch_tune thunderxt88_prefetch_tune = 32, /* l1_cache_size */ 128, /* l1_cache_line_size */ 16*1024, /* l2_cache_size */ - true, /* prefetch_dynamic_strides */ - -1, /* minimum_stride */ 3 /* default_opt_level */ }; @@ -591,8 +583,6 @@ static const cpu_prefetch_tune thunderx_prefetch_tune = 32, /* l1_cache_size */ 128, /* l1_cache_line_size */ -1, /* l2_cache_size */ - true, /* prefetch_dynamic_strides */ - -1, /* minimum_stride */ -1 /* default_opt_level */ }; @@ -602,8 +592,6 @@ static const cpu_prefetch_tune thunderx2t99_prefetch_tune = 32, /* l1_cache_size */ 64, /* l1_cache_line_size */ 256, /* l2_cache_size */ - true, /* prefetch_dynamic_strides */ - -1, /* minimum_stride */ -1 /* default_opt_level */ }; @@ -10608,16 +10596,6 @@ aarch64_override_options_internal (struct gcc_options *opts) aarch64_tune_params.prefetch->l2_cache_size, opts->x_param_values, global_options_set.x_param_values); - if (!aarch64_tune_params.prefetch->prefetch_dynamic_strides) - maybe_set_param_value (PARAM_PREFETCH_DYNAMIC_STRIDES, - 0, - opts->x_param_values, - global_options_set.x_param_values); - if (aarch64_tune_params.prefetch->minimum_stride >= 0) - maybe_set_param_value (PARAM_PREFETCH_MINIMUM_STRIDE, - aarch64_tune_params.prefetch->minimum_stride, - opts->x_param_values, - global_options_set.x_param_values); /* Use the alternative scheduling-pressure algorithm by default. */ maybe_set_param_value (PARAM_SCHED_PRESSURE_ALGORITHM, SCHED_PRESSURE_MODEL, diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 7e57e9650f6..255149fcfb8 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -10733,31 +10733,6 @@ The size of L1 cache, in kilobytes. @item l2-cache-size The size of L2 cache, in kilobytes. -@item prefetch-dynamic-strides -Whether the loop array prefetch pass should issue software prefetch hints -for strides that are non-constant. In some cases this may be -beneficial, though the fact the stride is non-constant may make it -hard to predict when there is clear benefit to issuing these hints. - -Set to 1, the default, if the prefetch hints should be issued for non-constant -strides. Set to 0 if prefetch hints should be issued only for strides that -are known to be constant and below @option{prefetch-minimum-stride}. - -@item prefetch-minimum-stride -Minimum constant stride, in bytes, to start using prefetch hints for. If -the stride is less than this threshold, prefetch hints will not be issued. - -This setting is useful for processors that have hardware prefetchers, in -which case there may be conflicts between the hardware prefetchers and -the software prefetchers. If the hardware prefetchers have a maximum -stride they can handle, it should be used here to improve the use of -software prefetchers. - -A value of -1, the default, means we don't have a threshold and therefore -prefetch hints can be issued for any constant stride. - -This setting is only useful for strides that are known and constant. - @item loop-interchange-max-num-stmts The maximum number of stmts in a loop to be interchanged. diff --git a/gcc/params.def b/gcc/params.def index 7408843c8cc..dad47ec2b00 100644 --- a/gcc/params.def +++ b/gcc/params.def @@ -790,24 +790,6 @@ DEFPARAM (PARAM_L2_CACHE_SIZE, "The size of L2 cache.", 512, 0, 0) -/* Whether software prefetch hints should be issued for non-constant - strides. */ - -DEFPARAM (PARAM_PREFETCH_DYNAMIC_STRIDES, - "prefetch-dynamic-strides", - "Whether software prefetch hints should be issued for non-constant " - "strides.", - 1, 0, 1) - -/* The minimum constant stride beyond which we should use prefetch hints - for. */ - -DEFPARAM (PARAM_PREFETCH_MINIMUM_STRIDE, - "prefetch-minimum-stride", - "The minimum constant stride beyond which we should use prefetch " - "hints for.", - -1, 0, 0) - /* Maximum number of statements in loop nest for loop interchange. */ DEFPARAM (PARAM_LOOP_INTERCHANGE_MAX_NUM_STMTS, diff --git a/gcc/params.h b/gcc/params.h index 8aa960a904e..98249d2a1f6 100644 --- a/gcc/params.h +++ b/gcc/params.h @@ -196,10 +196,6 @@ extern void init_param_values (int *params); PARAM_VALUE (PARAM_L1_CACHE_LINE_SIZE) #define L2_CACHE_SIZE \ PARAM_VALUE (PARAM_L2_CACHE_SIZE) -#define PREFETCH_DYNAMIC_STRIDES \ - PARAM_VALUE (PARAM_PREFETCH_DYNAMIC_STRIDES) -#define PREFETCH_MINIMUM_STRIDE \ - PARAM_VALUE (PARAM_PREFETCH_MINIMUM_STRIDE) #define USE_CANONICAL_TYPES \ PARAM_VALUE (PARAM_USE_CANONICAL_TYPES) #define IRA_MAX_LOOPS_NUM \ diff --git a/gcc/tree-ssa-loop-prefetch.c b/gcc/tree-ssa-loop-prefetch.c index af89d7070e3..2f10db18590 100644 --- a/gcc/tree-ssa-loop-prefetch.c +++ b/gcc/tree-ssa-loop-prefetch.c @@ -992,32 +992,6 @@ prune_by_reuse (struct mem_ref_group *groups) static bool should_issue_prefetch_p (struct mem_ref *ref) { - /* Do we want to issue prefetches for non-constant strides? */ - if (!cst_and_fits_in_hwi (ref->group->step) && PREFETCH_DYNAMIC_STRIDES == 0) - { - if (dump_file && (dump_flags & TDF_DETAILS)) - fprintf (dump_file, - "Skipping non-constant step for reference %u:%u\n", - ref->group->uid, ref->uid); - return false; - } - - /* Some processors may have a hardware prefetcher that may conflict with - prefetch hints for a range of strides. Make sure we don't issue - prefetches for such cases if the stride is within this particular - range. */ - if (cst_and_fits_in_hwi (ref->group->step) - && absu_hwi (int_cst_value (ref->group->step)) < PREFETCH_MINIMUM_STRIDE) - { - if (dump_file && (dump_flags & TDF_DETAILS)) - fprintf (dump_file, - "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), - PREFETCH_MINIMUM_STRIDE); - return false; - } - /* For now do not issue prefetches for only first few of the iterations. */ if (ref->prefetch_before != PREFETCH_ALL) -- 2.30.2