RFR: 8310190: C2 SuperWord: AlignVector is broken, generates misaligned packs

Emanuel Peter epeter at openjdk.org
Mon Oct 9 11:45:05 UTC 2023


On Mon, 9 Oct 2023 11:13:11 GMT, Richard Reingruber <rrich at openjdk.org> wrote:

>>> @tstuefe @reinrich Would you mind testing this for PPC?
>>> 
>>> And if you have a chance, the run this test repeatedly: `test/hotspot/jtreg/compiler/loopopts/superword/TestAlignVectorFuzzer.java`
>> 
>> I've added this PR to our nightly testing.
>
>> @tstuefe @reinrich Would you mind testing this for PPC?
>> 
>> And if you have a chance, the run this test repeatedly: `test/hotspot/jtreg/compiler/loopopts/superword/TestAlignVectorFuzzer.java`
> 
> Testing on PPC is done. No issues found.

Thanks @reinrich @fg1417 @zifeihan for the testing!
Thanks @vnkozlov for the initial review. I will address them later.

Sadly, I just got a performance regression on `SPECjmh-JVM2008-LU.small-G1` and `SPECjmh-JVM2008-LU.small-ParGC`. It turns out that variable `init` values have to be accepted with `AlignVector`, at least in some cases. I reduced it down to this:


./java -XX:CompileCommand=compileonly,Test::test0 -XX:+TraceNewVectors -XX:+TraceSuperWord -XX:+TraceLoopOpts -XX:+AlignVector -XX:+Verbose -XX:CompileCommand=VectorizeDebug,Test::test*,128 Test.java



public class Test {
    static int RANGE = 1024*64;
​
    public static void main(String[] strArr) {
        double a[] = new double[RANGE];
        for (int i = 0; i < RANGE; i++) {
            test0(a, i);
        }
    }
​
    static void test0(double[] a, int start) {
        for (int i = start; i < RANGE; i++) {
            a[i]++;
        }
    }
}


Such an inner loop is part of the LU-decomposition for matrices. This lead to `30-50%` performance loss with my patch, as the loop is not vectorized anymore.

I'll try to find a more general solution that allows for variable `init` and maybe even `invar`.

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

PR Comment: https://git.openjdk.org/jdk/pull/14785#issuecomment-1752850690


More information about the hotspot-compiler-dev mailing list