[jdk21u-dev] RFR: 8328938: C2 SuperWord: disable vectorization for large stride and scale [v2]
Aleksey Shipilev
shade at openjdk.org
Wed Apr 17 09:52:00 UTC 2024
On Wed, 17 Apr 2024 09:39:20 GMT, Emanuel Peter <epeter at openjdk.org> wrote:
>> Aleksey Shipilev has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Check if stride is actually con before touching iv_stride
>
> src/hotspot/share/opto/superword.cpp line 4213:
>
>> 4211: // do not have to deal with overflows.
>> 4212: jlong long_scale = _scale;
>> 4213: jlong long_stride = slp->lp()->stride_is_con() ? slp->iv_stride() : 0;
>
> Hmm. But what happens if the stride is now zero? Does that at least get caught later?
> Or should we just return here, and make sure the SWPointer is not valid, so nothing bad can happen down the road?
AFAICS, if we set stride = 0 here, the check would just pass without anything else happening. This turns this change into effectively no-op for non-constant strides.
I am thinking that is a cleaner/safer choice for 21u: we only protect from bad _constant_ strides, letting the behavior with non-constant strides the same. I don't think we should bail on non-constant strides here, since that might introduce performance regressions. This is also more in line with mainline: we don't bail on non-constant strides in mainline -- somehow managing to (almost) never be exposed to them. If/when we discover another bug in mainline that exposes to non-constant strides, we would need to fix it in downstream code.
-------------
PR Review Comment: https://git.openjdk.org/jdk21u-dev/pull/495#discussion_r1568553305
More information about the jdk-updates-dev
mailing list