4 ms·
Vectorization, dependencies and outer loop vectorization
- neonate 5y agohttp://web.archive.org/web/20220313202744/https://johnysswlab.com/vectorization-dependencies-and-outer-loop-vectorization-if-you-cant-beat-them-join-them/ http://web.archive.org/web/20220313202744/https://johnysswla...
- W0lf 5y agoFor my consulting projects, I've found that Halide[1] is a worthy game changer when it comes to performance consultations, due to their architectural decision of separating between code and their scheduling (or algorithms and execution). Whereas previously I had to run careful benchmarks and profiling for a given target hardware, I can play with different scheduling approaches or even run their DL based autoscheduler to get me quickly in to the 90th percentile of where I want to be. [1]: https://halide-lang.org/ https://halide-lang.org/
- fithisux 5y agoVery good article, at least for me.
- diamondlovesyou 5y agoThis article focuses on loop vectorization, but another important area in this realm is vectorizing "straight-line code", sometimes called SLP vectorization. This sort of code often lives in loops too, and so usually also depends on much of the memory dependence analysis used for vectorizing successive iterations, but only uses it for finding memory accesses which are sequential within a single iteration. This is important for vectorizing loop reductions (ie summing each channel in every pixel in an image), or eg a 3d cross-product. The techniques are built around matching expression trees or DAGs together, but gets complicated because brute forcing the search isn't practical in even medium sized functions, among other reasons. Source: I work for AMD on MSVC, currently focused on renovating it's SLP pass. I'm about to merge patch into MSVC which boosts 538.imagick_r on Zen3 by 25%, which I'm pretty proud of.
- The_rationalist 5y agoDo you know what would be the most promising next gen autovectorization optimizations? Maybe polyhedral ? https://polly.llvm.org/ https://polly.llvm.org/ https://en.wikipedia.org/wiki/Loop_optimization#The_polyhedral_or_constraint-based_framework https://en.wikipedia.org/wiki/Loop_optimization#The_polyhedr...
- gnufx 5y agoBeware that the Polly matmul example apparently pattern-matches and expands the loop structure to the Goto-like form rather than deriving it a priori. (So I was told when raising those results -- I haven't checked the code.) GCC also has the Pluto-style optimization (-floop-nest-optimize) but I've never had it working successfully.