> -----Original Message-----
> From: Pengfei Li <[email protected]>
> Sent: 22 June 2026 11:06
> To: [email protected]
> Cc: Alex Coplan <[email protected]>; [email protected];
> [email protected]; [email protected]; [email protected];
> Richard Earnshaw <[email protected]>; Tamar Christina
> <[email protected]>; Pengfei Li <[email protected]>
> Subject: [PATCH] AArch64: Make dispatch scheduling reachable on multi-issue
> cores
> 
> Commit r16-4079-gc8bd7b2d550 added dispatch scheduling for AArch64.
> However, in choose_ready(), the dispatch scheduling path was only
> reachable when dfa_lookahead <= 0, or when the first ready insn was a
> SCHED_GROUP_P insn. Commit r16-6155-g40d0f79577e then made
> SCHED_GROUP_P
> insns bypass dispatch scheduling to prevent fusion pairs from being
> split. As a result, the DFA lookahead path is preferred and dispatch
> scheduling is effectively disabled for AArch64 multi-issue cores.
> 
> dfa_lookahead comes from the hook first_cycle_multipass_dfa_lookahead.
> In current AArch64 implementation, it returns a positive issue rate
> value for multi-issue cores unless sched_fusion is true. This patch adds
> an IS_DISPATCH_ON check to that hook implementation so that the dispatch
> scheduling path is reachable on dispatch-enabled AArch64 cores.
> 
> Bootstrapped and tested on aarch64-linux-gnu.
> 
> gcc/ChangeLog:
> 
>       * config/aarch64/aarch64.cc
>       (aarch64_sched_first_cycle_multipass_dfa_lookahead): Return 0
>       when dispatch scheduling is enabled.
> 
> gcc/testsuite/ChangeLog:
> 
>       * gcc.target/aarch64/dispatch_sched_1.c: New test.

That's an unfortunate bug, so it means it was turned off anyway for GCC 16.

OK for master and thanks for adding the testcase!

Thanks,
Tamar

> ---
>  gcc/config/aarch64/aarch64.cc                       |  8 ++++++--
>  gcc/testsuite/gcc.target/aarch64/dispatch_sched_1.c | 13 +++++++++++++
>  2 files changed, 19 insertions(+), 2 deletions(-)
>  create mode 100644 gcc/testsuite/gcc.target/aarch64/dispatch_sched_1.c
> 
> diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc
> index 9dd19d81d7b..7d0ecaa1340 100644
> --- a/gcc/config/aarch64/aarch64.cc
> +++ b/gcc/config/aarch64/aarch64.cc
> @@ -17191,9 +17191,13 @@ aarch64_sched_variable_issue (FILE *, int,
> rtx_insn *insn, int more)
>  static int
>  aarch64_sched_first_cycle_multipass_dfa_lookahead (void)
>  {
> -  int issue_rate = aarch64_sched_issue_rate ();
> +  /* Do not use DFA lookahead during sched_fusion or when dispatch
> +     scheduling is enabled.  */
> +  if (sched_fusion || aarch64_sched_dispatch (NULL, IS_DISPATCH_ON))
> +    return 0;
> 
> -  return issue_rate > 1 && !sched_fusion ? issue_rate : 0;
> +  int issue_rate = aarch64_sched_issue_rate ();
> +  return issue_rate > 1 ? issue_rate : 0;
>  }
> 
> 
> diff --git a/gcc/testsuite/gcc.target/aarch64/dispatch_sched_1.c
> b/gcc/testsuite/gcc.target/aarch64/dispatch_sched_1.c
> new file mode 100644
> index 00000000000..c2cb74e750d
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/aarch64/dispatch_sched_1.c
> @@ -0,0 +1,13 @@
> +/* Check DFA lookahead is not reached when dispatch scheduling is enabled.
> */
> +/* { dg-do compile } */
> +/* { dg-options "-O3 -mcpu=neoverse-v2 -fdump-rtl-sched2-details -fsched-
> verbose=2" } */
> +
> +void
> +foo (int *restrict a, int *restrict b, int *restrict c, int n)
> +{
> +#pragma GCC unroll 64
> +  for (int i = 0; i < n; i++)
> +    c[i] += a[i] * b[i];
> +}
> +
> +/* { dg-final { scan-rtl-dump-not "max_issue among" "sched2" } } */
> --
> 2.43.0

Reply via email to