[llvm] [RegAlloc][RISCV] Increase the spill weight by target factor (PR #113675)
Pengcheng Wang via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 28 01:16:49 PDT 2024
wangpc-pp wrote:
> Thanks for looking at this, I also tried this a few months ago, and saw the same test diff where we're able to remove a lot of LMUL 8 spills.
>
> However whilst it helps the in-tree tests a lot when I tried it out on SPEC CPU 2017 I got a 50% increase in spills generated overall, have you been able to check if you run into this too?
Here is the result of statistics (`-march=rv64gcv`):
```
# utils/compare.py -m regalloc.NumSpills baseline.json experimental.json
Tests: 10
Metric: regalloc.NumSpills
Program regalloc.NumSpills
baseline experimental diff
500.perlbench_r/500.perlbench_r.test 4255.00 4255.00 0.0%
505.mcf_r/505.mcf_r.test 128.00 128.00 0.0%
520.omnetpp_r/520.omnetpp_r.test 971.00 971.00 0.0%
523.xalancbmk_r/523.xalancbmk_r.test 1578.00 1578.00 0.0%
525.x264_r/525.x264_r.test 2027.00 2027.00 0.0%
531.deepsjeng_r/531.deepsjeng_r.test 355.00 355.00 0.0%
541.leela_r/541.leela_r.test 361.00 361.00 0.0%
557.xz_r/557.xz_r.test 296.00 296.00 0.0%
502.gcc_r/502.gcc_r.test 13739.00 13735.00 -0.0%
999.specrand_ir/999.specrand_ir.test 0.00 0.00
Geomean difference -0.0%
regalloc.NumSpills
run baseline experimental diff
count 10.000000 10.000000 9.000000
mean 2371.000000 2370.600000 -0.000032
std 4197.231045 4196.027306 0.000097
min 0.000000 0.000000 -0.000291
25% 310.750000 310.750000 0.000000
50% 666.000000 666.000000 0.000000
75% 1914.750000 1914.750000 0.000000
max 13739.000000 13735.000000 0.000000
# utils/compare.py -m regalloc.NumReloads baseline.json experimental.json
Tests: 10
Metric: regalloc.NumReloads
Program regalloc.NumReloads
baseline experimental diff
500.perlbench_r/500.perlbench_r.test 9790.00 9790.00 0.0%
505.mcf_r/505.mcf_r.test 438.00 438.00 0.0%
520.omnetpp_r/520.omnetpp_r.test 1474.00 1474.00 0.0%
523.xalancbmk_r/523.xalancbmk_r.test 2511.00 2511.00 0.0%
525.x264_r/525.x264_r.test 4694.00 4694.00 0.0%
531.deepsjeng_r/531.deepsjeng_r.test 674.00 674.00 0.0%
541.leela_r/541.leela_r.test 509.00 509.00 0.0%
557.xz_r/557.xz_r.test 631.00 631.00 0.0%
502.gcc_r/502.gcc_r.test 31924.00 31920.00 -0.0%
999.specrand_ir/999.specrand_ir.test 0.00 0.00
Geomean difference -0.0%
regalloc.NumReloads
run baseline experimental diff
count 10.000000 10.000000 9.000000
mean 5264.500000 5264.100000 -0.000014
std 9829.948957 9828.743601 0.000042
min 0.000000 0.000000 -0.000125
25% 539.500000 539.500000 0.000000
50% 1074.000000 1074.000000 0.000000
75% 4148.250000 4148.250000 0.000000
max 31924.000000 31920.000000 0.000000
```
I don't see the increase of spills, but the decrease is also imperceptible.
> My approach also didn't use the reg class weight but instead I scaled the weight by the physical register size in bytes. From what I remember investigating the register class weight was related to register pressure calculation, which seemed orthogonal to spilling
Scaling the weight by bytes may be over estimated. I wanted to scale the weight by the number of physical registers, which is accidentally the register class weight.
https://github.com/llvm/llvm-project/pull/113675
More information about the llvm-commits
mailing list