Non-power-of-2 SLP vectorization regressions (and improvements) on RISC-V
LNT picked up a handful of regressions after the non-power-of-two SLP vectorization change #196825 : http://lnt.llvm.org/db_default/v4/nts/22
Just flagging this here as there's likely some cost modelling issues to be worked through, see
- SingleSource/Benchmarks/BenchmarkGame/n-body
- MultiSource/Benchmarks/McCat/08-main/main
- MultiSource/Benchmarks/TSVC/LinearDependence-flt/LinearDependence-flt
There are also some nice improvements too though, SingleSource/Benchmarks/Shootout-C++/Shootout-C++-matrix is 12% faster
@llvm/issue-subscribers-backend-risc-v
Author: Luke Lau (lukel97)
Just flagging this here as there's likely some cost modelling issues to be worked through, see
- SingleSource/Benchmarks/BenchmarkGame/n-body
- MultiSource/Benchmarks/McCat/08-main/main
- MultiSource/Benchmarks/TSVC/LinearDependence-flt/LinearDependence-flt
There are also some nice improvements too though, SingleSource/Benchmarks/Shootout-C++/Shootout-C++-matrix is 12% faster
Would be good to see some analysis/reproducers to understand the gaps
Would be good to see some analysis/reproducers to understand the gaps
You can use the profile view to see the difference in assembly: http://lnt.llvm.org/db_default/v4/nts/profile/1339/22/19
Could you provide some more details, I do not see the difference in assembly and cannot do the analysis
I think I have a very tentative analysis? I believe the non-pow-of-2 commit is causing the basic block (the one responsible for 100% of issued instructions) in n-body to change vector length multiple times like so
vsetivli zero, 0x3, e64, m2, ta, ma
...
vsetivli zero, 0x2, e64, m1, ta, ma
...
vsetivli zero, 0x3, e64, m2, ta, ma
...
vsetivli zero, 0x2, e64, m1, ta, ma
...
vsetivli zero, 0x3, e64, m2, ta, ma
...
vsetivli zero, 0x2, e64, m1, ta, ma
...
And this repeats a bit more.
I think this basic block was initially two basic blocks, with each block having a different vector length, but got merged into one after link-time optimization, and perhaps unrolled.
The previous build is just using one vector length throughout the whole block.