After applying the hip12 scheduling model, 507.cactuBSSN_r shows a ~12%
performance regression. The reason is the same as the issue described in
PR/114729, but that patch cannot fix this problem.
I have enhanced this as follows: in model_excess_group_cost, originally
the pressure increase was returned only when the pressure exceeded the
peak pressure; now the delta is also returned when the pressure is below
the peak pressure, in order to reduce spills. The change is controlled by
the --param=cycle-accurate-model= option.
As discussed in PR/114729, the "model" heuristic currently used by default
on AArch64 is pretty old. However, the cortex-a57 scheduling model used
by many AArch64 cores is also fairly old, so perhaps the default behavior
of the scheduling algorithm is well matched to cortex-a57. Therefore,
I only enable cycle-accurate-model=0 by default for the more modern hip12
scheduling model.
On hip12, the actually executed instructions are as follows, (-O3 -mcpu=native)
Original: 1,207,015,685,661 instructions:u
Apply hip12 scheduling model: 1,522,907,774,690 instructions:u
Apply this patch: 1,278,756,677,944 instructions:u
gcc/ChangeLog:
* config/aarch64/aarch64.cc (aarch64_override_options_internal):
Set cycle-accurate-model to 0 for hip12.
* haifa-sched.cc (model_excess_group_cost): Return delta if
param_cycle_accurate_model is 0.
Signed-off-by: Zhiheng Xie <[email protected]>
---
gcc/config/aarch64/aarch64.cc | 5 +++++
gcc/haifa-sched.cc | 4 ++++
2 files changed, 9 insertions(+)
diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc
index 9290677655a..561516a3c79 100644
--- a/gcc/config/aarch64/aarch64.cc
+++ b/gcc/config/aarch64/aarch64.cc
@@ -20323,6 +20323,11 @@ aarch64_override_options_internal (struct gcc_options
*opts,
param_sched_pressure_algorithm,
SCHED_PRESSURE_MODEL);
+ if (tune->tune == &hip12_tunings)
+ SET_OPTION_IF_UNSET (opts, opts_set,
+ param_cycle_accurate_model,
+ 0);
+
/* Validate the guard size. */
int guard_size = param_stack_clash_protection_guard_size;
diff --git a/gcc/haifa-sched.cc b/gcc/haifa-sched.cc
index e0505e9db64..51b47764d25 100644
--- a/gcc/haifa-sched.cc
+++ b/gcc/haifa-sched.cc
@@ -2428,6 +2428,10 @@ model_excess_group_cost (struct model_pressure_group
*group,
if (pressure > group->limits[pci].pressure)
return model_spill_cost (cl, group->limits[pci].orig_pressure,
pressure);
+ /* If target prefers fewer spills, return the +ve delta indicating
+ pressure increase. */
+ else if (!param_cycle_accurate_model)
+ return delta;
}
return 0;
--
2.43.0