Tuning LLVM's SLP Vectorizer Cost Model for RISC-V
TL;DR. A recent LLVM patch introduced performance regressions on a RISC-V benchmark due to an inaccurate cost model for ordered vector reductions. - The regression caused profitable vectorized code to be misidentified, leading to slower scalar execution on the RISC-V target. - A fix adjusts the cost model by accounting for the initial vector build cost, restoring expected performance. - This work highlights critical compiler optimizations impacting efficiency on critical AI-related hardware.
- LLVM's SLP vectorizer introduced a performance regression on a RISC-V benchmark.
- The issue stemmed from an inaccurate cost model for ordered vector reductions.
- The cost model failed to account for initial vector build costs.
- A patch corrected the cost model, restoring performance.
Sources
- Tuning LLVM's SLP Vectorizer Cost Model — blog.kaving.me