RFR: 8300258: C2: vectorization fails on simple ByteBuffer loop

Emanuel Peter epeter at openjdk.org
Thu Feb 9 17:09:55 UTC 2023


On Thu, 9 Feb 2023 16:08:19 GMT, Roland Westrelin <roland at openjdk.org> wrote:

>> test/hotspot/jtreg/compiler/c2/irTests/TestVectorizationMismatchedAccess.java line 39:
>> 
>>> 37:  */
>>> 38: 
>>> 39: public class TestVectorizationMismatchedAccess {
>> 
>> Could you have a much simpler example, just with two int-arrays, where one allows vectorization and one does not. We still want there to be some vectorization. Maybe like this, maybe you have to play around with it a bit:
>> 
>> // make sure arr1 and arr2 are in different slices
>> for (int i ...) {
>>   arr1[i] = arr1[i-2] + 5; // do not vectorize, cyclic dependency
>>   arr2[i] = arr2[i] + 5; // should vectorize
>> }
>
> I agree that we should have such a test if we don't have one already but does it belong to that bug? That bug changes the behavior with mismatched accesses so it feels strange to add an unrelated test.` testByteByte1() `is a mismatched access test that vectorizes and that's unaffected by my change. I could add another one that doesn't vectorize because of a dependency with a similar mismatched access. What do you think?

Well, my idea was this:
You added a new feature, where we now have a more fine-grained logic. Before, we distinguished by "velt type". Now we distinguish by "memory slice".
Before, this change, my `arr1` and `arr2` would have had the same "velt type", and if one is rejected from vectorization, so is the other. Now they are handled separately, right?

-------------

PR: https://git.openjdk.org/jdk/pull/12440


More information about the hotspot-compiler-dev mailing list