Vectorizer elides consecutive load permutation
Vectorizer now handles consecutive load permutations more efficiently, improving performance for certain memory access patterns.
The GCC vectorizer has been enhanced to elide unnecessary load permutations when dealing with strided grouped loads. Previously, a permutation selecting a consecutive run of lanes within a group was not always optimized, leading to less efficient scalar loads. This commit removes a restrictive requirement that the run length must divide the group size, allowing the vectorizer to treat such consecutive runs as a single group. This optimization significantly improves performance for patterns like half-pel motion estimation, reducing instruction count and improving vectorization efficiency on architectures like aarch64.
In Details
Modifies tree-vect-stmts.cc to improve vectorization of strided grouped loads with consecutive load permutations. The function has_consecutive_load_permutation no longer requires the permutation run length to divide the group_size. This change allows the vectorizer to recognize and optimize consecutive load patterns, such as those found in half-pel motion estimation, by using fewer wide loads instead of many scalar loads. The get_load_store_type function was adjusted to accommodate this change.
- Vectorizer
- A compiler component that automatically transforms scalar code into vector code, allowing a single instruction to operate on multiple data elements simultaneously.
- strided grouped load
- A memory access pattern where data elements are loaded from memory with a constant offset (stride) between consecutive elements within a group, and potentially across groups.
- permutation
- An operation that rearranges elements within a vector or a group of vector elements.
- VMAT_STRIDED_SLP
- Likely refers to a specific vectorization strategy for strided loads using scalar-left-processing (SLP) or a similar technique.
- scalar load
- A memory load operation that fetches a single data element at a time.
- half-pel motion estimation
- A technique used in video compression to estimate the motion between video frames at sub-pixel precision, often involving complex memory access patterns.
- aarch64
- The 64-bit ARM architecture, known for its high performance and energy efficiency.