RFR: 8310190: C2 SuperWord: AlignVector is broken, generates misaligned packs [v21]
Emanuel Peter
epeter at openjdk.org
Wed Dec 6 09:52:46 UTC 2023
On Wed, 6 Dec 2023 03:38:51 GMT, Fei Gao <fgao at openjdk.org> wrote:
>> Emanuel Peter has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Suggestions by Christian for naming
>
> src/hotspot/share/opto/superword.cpp line 3916:
>
>> 3914:
>> 3915: // We chose an aw that is the maximal possible vector width for the type of
>> 3916: // align_to_ref.
>
> I have a question here: Could we always get benefit from aligning address to maximal possible vector width for small-size types, as vector width becomes large? E.g., for `byte` type on `512-bit` platform, will the pre-loop limit become very large and cost much more to execute the whole loop?
I agree, this is a concern. But this was already like that before my fix:
`int vw = vector_width_in_bytes(p.mem());`
If we want to relax this, I suggest we do that in an a future RFE.
Some thoughts:
- I did not want to change this now, since it may affect performance, and this is a bug fix here.
- We may relax the `aw` to be the maximal maximal vector size used in the vectorization. Or we can make it even smaller, i.e. `MIN2(max_vw, ObjectAlignmentInBytes);', which would then be analogue to `AlignmentSolution SuperWord::pack_alignment_solution`.
- We may even want to completely remove pre-loop adjustment if alignment is neither a strict requirement, and actually on average a performance cost that outweighs the performance gains of alignment. It is for example questionable to align one of the mem_refs if there are multiple, and hence we cannot guarantee alignment of all anyway.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14785#discussion_r1417017418
More information about the hotspot-compiler-dev
mailing list