RFR: 8298935: fix cyclic dependency bug in create_pack logic in SuperWord::find_adjacent_refs [v15]
Emanuel Peter
epeter at openjdk.org
Mon Mar 6 09:05:19 UTC 2023
On Mon, 6 Mar 2023 08:59:30 GMT, Emanuel Peter <epeter at openjdk.org> wrote:
>> With +AlignVector behavior with and without Vectorize,true pragma should match.
>>
>>
>> static void test1() {
>> for (int i = 4; i < 100; i++) {
>> fArr[i + 4] = fArr[i];
>> }
>> }
>>
>>
>>
>> CPROMPT>javad -XX:+TraceNewVectors -XX:+AlignVector -cp . bug
>> WARNING: Using incubator modules: jdk.incubator.vector
>> res = 0.0
>> CPROMPT>
>> CPROMPT>javad -XX:+TraceNewVectors -XX:+AlignVector -XX:CompileCommand=Vectorize,bug::test1,true -cp . bug
>> CompileCommand: Vectorize bug.test1 bool Vectorize = true
>> WARNING: Using incubator modules: jdk.incubator.vector
>> new Vector node: 990 LoadVector === 373 856 824 [[ 822 802 800 798 718 706 556 196 ]] @float[int:>=0]:NotNull:exact+any *, idx=6; mismatched #vectory[8]:{float} !orig=[823],[719],[557],[199],143 !jvms: bug::test1 @ bci:18 (line 7)
>> new Vector node: 991 StoreVector === 855 856 825 990 [[ 988 195 856 ]] @float[int:>=0]:NotNull:exact+any *, idx=6; mismatched Memory: @float[int:>=0]:NotNull:exact+any *, idx=6; !orig=[822],[718],[556],[196],164 !jvms: bug::test1 @ bci:19 (line 7)
>> res = 0.0
>
> @jatin-bhateja
>> Thanks, even though newly added test now passes at all AVX and SSE level can you kindly investigate why should following be vectorized with un-aligned accesses when it carries a cross iteration true dependency with distance 4.
>
> The cyclic dependency is at a distance of 3, not 4 in this example. Ints are 4 bytes. Thus, the `byte_offset` is 12 bytes. So if `MaxVectorSize <= 12`, we cannot ever have a cyclic dependency within a vector.
>
> See my explanations at the beginning of the test file, for example:
> https://github.com/openjdk/jdk/blob/fb7f6dd9fbc2a6086d2ad36e0681fbc9eff6c9a7/test/hotspot/jtreg/compiler/loopopts/superword/TestDependencyOffsets.java#L49-L57
You can see that the rules for distance 4 are adjusted, if you look at `testIntP4`:
https://github.com/openjdk/jdk/blob/fb7f6dd9fbc2a6086d2ad36e0681fbc9eff6c9a7/test/hotspot/jtreg/compiler/loopopts/superword/TestDependencyOffsets.java#L1202-L1230
-------------
PR: https://git.openjdk.org/jdk/pull/12350
More information about the hotspot-compiler-dev
mailing list