RFR: 8298935: fix independence bug in create_pack logic in SuperWord::find_adjacent_refs [v26]
Vladimir Kozlov
kvn at openjdk.org
Wed Mar 15 04:54:33 UTC 2023
On Mon, 13 Mar 2023 10:13:40 GMT, Emanuel Peter <epeter at openjdk.org> wrote:
>> Emanuel Peter has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 40 commits:
>>
>> - Merge master after NULL -> nullptr conversion
>> - Fixed wording from last commit
>> - A little renaming and improved comments
>> - resolve merge conflict after Roland's fix
>> - TestDependencyOffsets.java: add vanilla run
>> - TestDependencyOffsets.java: parallelize it + various AVX settings
>> - TestOptionVectorizeIR.java: removed PopulateIndex IR rule - fails on x86 32bit - see Matcher::match_rule_supported
>> - Merge branch 'master' into JDK-8298935
>> - Reworked TestDependencyOffsets.java
>> - remove negative IR rules for TestOptionVectorizeIR.java
>> - ... and 30 more: https://git.openjdk.org/jdk/compare/5726d31e...731cc7b5
>
> https://github.com/openjdk/jdk/pull/12350#issuecomment-1461681129
>
>> So is there a **4th Bug** lurking here?
>
> @vnkozlov I now found an example that reveals this **Bug 4**. I want to fix it in a separate Bug [JDK-8304042](https://bugs.openjdk.org/browse/JDK-8304042).
>
> This is the method:
>
> static void test(int[] dataI1, int[] dataI2, float[] dataF1, float[] dataF2) {
> for (int i = 0; i < RANGE/2; i+=2) {
> dataF1[i+0] = dataI1[i+0] + 0.33f; // 1
> dataI2[i+1] = (int)(11.0f * dataF2[i+1]); // 2
>
> dataI2[i+0] = (int)(11.0f * dataF2[i+0]); // 3
> dataF1[i+1] = dataI1[i+1] + 0.33f; // 4
> }
> }
>
>
> Note: `dataI1 == dataI2` and `dataF1 == dataF2`. I only had to use two references so that C2 does not know this, and does not optimize away load after store.
>
> Lines 1 and 4 are `isomorphic` and `independent`. The same holds for line 2 and 3. We creates the packs `[1,4]` and `[2,3]`, and vectorize (with and without my patch). However, we have the following dependencies: `1->3` and `2->4`. This creates a cyclic dependency between the two packs.
>
> As explained in the previous https://github.com/openjdk/jdk/pull/12350#issuecomment-1461681129, we have to verify that there are no cyclic dependencies between the packs, just before we schedule. The SuperWord paper states this in "3.7 Scheduling".
@eme64, I ran with `-XX:-TieredCompilation -Xbatch -XX:CICompilerCount=1 -XX:+TraceNewVectors` on AVX512 linux machine our vectors jtregs tests (including `jdk/incubator/vector) and everything is fine except one test:
compiler/loopopts/superword/TestPickLastMemoryState.java`
With these changes we almost don't generate vectors (may be 2 per `@run`). Without changes we got about 160 (50 per `@run`) new vectors. It has several `@run` commands for different vector sizes.
-------------
PR: https://git.openjdk.org/jdk/pull/12350
More information about the hotspot-compiler-dev
mailing list