> On Nov 10, 2026, at 19:20, xiezhiheng <[email protected]> wrote: > >> -----Original Message----- >> From: Maxim Kuvyrkov <[email protected]> >> Sent: Monday, November 9, 2026 2:17 PM >> To: xiezhiheng <[email protected]> >> Cc: [email protected]; [email protected]; [email protected]; >> Kyrylo Tkachov <[email protected]>; Tamar >> Christina <[email protected]> >> Subject: Re: [PING] [PATCH 2/2] sched: Return delta when the pressure is >> below the peak pressure >> >> Hi Zhiheng, >> Hi Tamar, >> Hi All, >> >> FWIW, I'm working on http://gcc.gnu.org/PR114729 with the goals to improve >> sched1 for modern high-IPC AArch64 cores, while fixing >> issues around unreasonable compile-time behavior in certain cases. >> >> Current register-pressure heuristics work well for cores with issue rate of >> 1-3 instructions per cycle -- cores circa Cortex-A57. But >> sched1 breaks down in all kinds of ways for cores with issue rates 6+. > > This sounds great. May I ask whether you plan to have this fixed before the > GCC 17 release? > > I'm submitting a patch for the hip12 scheduling model and ran into this > issue. It would be great > if you could get this fixed in GCC 17. > > If it will take a while longer, could the reviewer please review my fix first?
I seriously doubt that my work will make it into GCC 17; I'm targeting GCC 18. I don't have any issues with committing your fix meanwhile. Thanks, -- Maxim Kuvyrkov Garden City Compilers >> >>> On Nov 9, 2026, at 14:24, xiezhiheng <[email protected]> wrote: >>> >>> Ping. >>> >>>> -----Original Message----- >>>> From: xiezhiheng >>>> Sent: Monday, November 2, 2026 7:24 PM >>>> To: 'Tamar Christina' <[email protected]>; [email protected]; >>>> [email protected]; '[email protected]' >>>> <[email protected]> >>>> Cc: Kyrylo Tkachov <[email protected]> >>>> Subject: RE: [PATCH 2/2] sched: Return delta when the pressure is below >>>> the peak pressure >>>> >>>>>> diff --git a/gcc/config/aarch64/aarch64-tuning-flags.def >>>>>> b/gcc/config/aarch64/aarch64-tuning-flags.def >>>>>> index 64a773be34c..f756cae4edd 100644 >>>>>> --- a/gcc/config/aarch64/aarch64-tuning-flags.def >>>>>> +++ b/gcc/config/aarch64/aarch64-tuning-flags.def >>>>>> @@ -84,4 +84,7 @@ AARCH64_EXTRA_TUNING_OPTION >>>>>> ("narrow_gp_writes", NARROW_GP_WRITES) >>>>>> /* Enable when the target prefers SVE merging movimm over zeroing. */ >>>>>> AARCH64_EXTRA_TUNING_OPTION ("avoid_zeroing_movimm", >>>>>> AVOID_MOVIMM_Z) >>>>>> >>>>>> +/* Set param_cycle_accurate_model to 0 for the target. */ >>>>>> +AARCH64_EXTRA_TUNING_OPTION ("disable-cycle-accurate-model", >>>>>> DISABLE_CYCLE_ACCURATE_MODEL) >>>>>> + >>>>> >>>>> Minor nit, can you make this DISABLE_CYCLE_ACCURATE_SCHED_MODEL? >>>>> So it's not confused with the latency modelling in the vectorizer. >>>>> >>>>> Patch is OK with that change. But I can't approve the middle-end bit. >>>>> >>>>> Once middle-end maintainer does I can apply the updated patch for you. >>>>> >>>>> Thanks, >>>>> Tamar >>>>> >>>> >>>> Thanks, this is the v3 patch. I've also sent it to the scheduler >>>> maintainers. >>>> Hi Jeff and Vladimir, could you please review the patch? >>>> >>>> Thanks, >>>> Zhiheng >>>> >>>> >>>> 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 add an additional DISABLE_CYCLE_ACCURATE_SCHED_MODEL tune parameter to >>>> control the behavior. >>>> >>>> On hip12, the actually executed instructions on 507.cactuBSSN_r are >>>> as follows, (w/ option -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-tuning-flags.def (AARCH64_EXTRA_TUNING_OPTION): >>>> Add DISABLE_CYCLE_ACCURATE_SCHED_MODEL tune parameter. >>>> * config/aarch64/aarch64.cc (aarch64_override_options_internal): >>>> Set param_cycle_accurate_model to 0. >>>> * config/aarch64/tuning_models/hip12.h: Set tune parameter >>>> DISABLE_CYCLE_ACCURATE_SCHED_MODEL. >>>> * 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-tuning-flags.def | 3 +++ >>>> gcc/config/aarch64/aarch64.cc | 6 ++++++ >>>> gcc/config/aarch64/tuning_models/hip12.h | 3 ++- >>>> gcc/haifa-sched.cc | 4 ++++ >>>> 4 files changed, 15 insertions(+), 1 deletion(-) >>>> >>>> diff --git a/gcc/config/aarch64/aarch64-tuning-flags.def >>>> b/gcc/config/aarch64/aarch64-tuning-flags.def >>>> index 64a773be34c..dd52b1e8db6 100644 >>>> --- a/gcc/config/aarch64/aarch64-tuning-flags.def >>>> +++ b/gcc/config/aarch64/aarch64-tuning-flags.def >>>> @@ -84,4 +84,7 @@ AARCH64_EXTRA_TUNING_OPTION ("narrow_gp_writes", >>>> NARROW_GP_WRITES) >>>> /* Enable when the target prefers SVE merging movimm over zeroing. */ >>>> AARCH64_EXTRA_TUNING_OPTION ("avoid_zeroing_movimm", AVOID_MOVIMM_Z) >>>> >>>> +/* Set param_cycle_accurate_model to 0 for the target. */ >>>> +AARCH64_EXTRA_TUNING_OPTION ("disable_cycle_accurate_sched_model", >>>> DISABLE_CYCLE_ACCURATE_SCHED_MODEL) >>>> + >>>> #undef AARCH64_EXTRA_TUNING_OPTION >>>> diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc >>>> index 9290677655a..6556691c5e9 100644 >>>> --- a/gcc/config/aarch64/aarch64.cc >>>> +++ b/gcc/config/aarch64/aarch64.cc >>>> @@ -20323,6 +20323,12 @@ aarch64_override_options_internal (struct >>>> gcc_options *opts, >>>> param_sched_pressure_algorithm, >>>> SCHED_PRESSURE_MODEL); >>>> >>>> + if (aarch64_tune_params.extra_tuning_flags >>>> + & AARCH64_EXTRA_TUNE_DISABLE_CYCLE_ACCURATE_SCHED_MODEL) >>>> + 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/config/aarch64/tuning_models/hip12.h >>>> b/gcc/config/aarch64/tuning_models/hip12.h >>>> index cfb204b2e53..e464f6a7c20 100644 >>>> --- a/gcc/config/aarch64/tuning_models/hip12.h >>>> +++ b/gcc/config/aarch64/tuning_models/hip12.h >>>> @@ -217,7 +217,8 @@ static const struct tune_params hip12_tunings = >>>> 0, /* max_case_values. */ >>>> tune_params::AUTOPREFETCHER_WEAK, /* autoprefetcher_model. */ >>>> (AARCH64_EXTRA_TUNE_BASE >>>> - | AARCH64_EXTRA_TUNE_MATCHED_VECTOR_THROUGHPUT), /* tune_flags. */ >>>> + | AARCH64_EXTRA_TUNE_MATCHED_VECTOR_THROUGHPUT >>>> + | AARCH64_EXTRA_TUNE_DISABLE_CYCLE_ACCURATE_SCHED_MODEL), /* >>>> tune_flags. */ >>>> &generic_armv8_a_prefetch_tune, >>>> AARCH64_LDP_STP_POLICY_ALWAYS, /* ldp_policy_model. */ >>>> AARCH64_LDP_STP_POLICY_ALWAYS, /* stp_policy_model. */ >>>> 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
