On Mon, 18 Nov 2024 14:43:48 GMT, Quan Anh Mai <qa...@openjdk.org> wrote:
>> @merykitty >>> Please correct me if I'm wrong but the issue is you need the base to be >>> aligned at 32 bytes on AVX2 machines for any alignment for vector >>> instruction to be meaningful, so I don't see the value of vector alignment >>> at all. >> >> First: without `AlignVector`, the vector instructions can have completely >> free alignment. On x64 and aarch64 generally I think most machines do not >> need alignment at all. And as far as I know there is also no performance >> penalty on modern CPUs for misalignment. I could be wrong here. On older >> CPUs alignment was important for performance though. > > @eme64 You will need the alignment for the whole vector (which means 32 bytes > for a `ymm` load), not alignment only on its elements. Vector element is the > artefact of ALU units, not the load/store units that actually care about > alignment. @merykitty I don't think I understand. When and for what do I need the full 32-byte alignment? @merykitty In `AlignmentSolver::solve` / `src/hotspot/share/opto/vectorization.cpp` you can see how I compute if vectors can be aligned. ------------- PR Comment: https://git.openjdk.org/jdk/pull/20677#issuecomment-2483261148 PR Comment: https://git.openjdk.org/jdk/pull/20677#issuecomment-2483266962