]> git.ipfire.org Git - thirdparty/gcc.git/commit
[RISC-V] Clamp long reservations to 7c
authorJeff Law <jeffrey.law@oss.qualcomm.com>
Fri, 9 Jan 2026 04:14:18 +0000 (21:14 -0700)
committerJeff Law <jeffrey.law@oss.qualcomm.com>
Fri, 9 Jan 2026 04:15:22 +0000 (21:15 -0700)
commit8265192910c8b05162ae7672d8fac85c1639c0c5
treeff912c447d1ecf0460e028292bcf506a2b4bcb37
parent83b3c80fac333c429d0d8a9f58d3d494c2ba305f
[RISC-V] Clamp long reservations to 7c

So I've been noticing the cycle time for a native build/test on the
Pioneer and BPI rising over the last many months.  I've suspected a pain
point is likely genautomata due to long reservations in the DFAs.
Trying to describe a 30+ cycle bubble in the pipeline just isn't useful
and causes the DFA to blow up.

This is time to build insn-automata.cc using an optimized genautomata
using my skylake server cross compiling to riscv64. The baseline is what
we have today.  Then I clamped the reservations (but not the latency) to
7c.  7c is arbitrary, but known not to blow up the DFA.  I fixed the BPI
first, then the Andes 23 and so-on.

Baseline     52s
BPI          52s
Andes-23     45s
Andes-25     16s
Andes-45     16s
Generic      15s
Mips-8700    15s
Sifive-7     13s
Final        13s

That's a significant improvement, though I probably wouldn't go forward
with just that improvement.  It's less than a minute and skylake systems
aren't exactly new anymore...

Let's try that with an unoptimized genautomata.  I often build that way
when debugging.

Baseline    343s
Final        79s

So that's saving ~4m on my skylake server for a common build. Given I
use ccache, that 4m is often a significant amount of the build time.  So
this feels like a better motivating example.

But I'm really after bringing down bootstrap cycle times on the BPI and
Pioneer.  So let's see what the BPI does.  For an optimized genautomata
we get (not testing all the intermediate steps):

Baseline     310s
Final:       110s

Not bad.  And if we look at unoptimized genautomata:

Baseline:   2196s
Final:       553s

Now we can see why bootstrap times have crept up meaningfully. That's
~27 minutes out of a 9hr bootstrap time on the BPI (pure bootstrap, no
testing).  The effect is more pronounced on the Pioneer where the
improvement is 30+ minutes on a 4hr bootstrap time (each core is slower,
but there's 8x as many cores).

Tested on riscv{32,64}-elf and bootstrapped on the Pioneer (regression
testing in progress).  I'll wait for pre-commit CI to do its thing.

gcc/
* config/riscv/andes-23-series.md: Clamp reservations to 7c.
* config/riscv/andes-25-series.md: Likewise.
* config/riscv/andes-45-series.md: Likewise.
* config/riscv/generic.md: Likewise.
* config/riscv/mips-p8700.md: Likewise.
* config/riscv/sifive-7.md: Likewise.
* config/riscv/spacemit-x60.md: Likewise.
gcc/config/riscv/andes-23-series.md
gcc/config/riscv/andes-25-series.md
gcc/config/riscv/andes-45-series.md
gcc/config/riscv/generic.md
gcc/config/riscv/mips-p8700.md
gcc/config/riscv/sifive-7.md
gcc/config/riscv/spacemit-x60.md