RFR: 8298632: [TESTBUG] Add IR checks in jtreg vectorization tests
Vladimir Kozlov
kvn at openjdk.org
Fri Dec 16 19:55:52 UTC 2022
On Thu, 15 Dec 2022 20:23:16 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:
>> In JDK-8183390, we introduced a new auto-vectorization testing framework in hotspot jtreg tests. The new framework provides us a much simpler way to add new test cases of auto-vectorizable loops. But the previous patch just added a check of the correctness of the result after vectorization. There is no check about whether the code is vectorized or not.
>>
>> This patch adds IR checks to verify C2's vectorization ability on test cases inside this framework. With this patch, each test method annotated with `@Test` is verified in two ways. First, it's invoked twice and the return results from the interpreter and C2 compiled code are compared. Second, the count of expected vector IR is checked by the IR framework if the test method has IR rule annotation.
>>
>> Ideally, we should check IR rules on all platforms. But in practice, the vectorization ability can be quite different on different platforms, or different generations of CPUs of one platform. So in this patch, we only add vectorizable checks for AArch64. Checks for other platforms (such as x86) can still be added later with more CPU feature conditions. We also add some negative rules (or in-vectorizable rules) with `@IR(failOn=...` on cases that should not be vectorized on any platform.
>>
>> A few more test cases are added within this patch as well.
>>
>> We tested the new IR rules on below kinds of CPUs.
>> - AArch64 w/ 512-bit SVE
>> - AArch64 w/ 128-bit SVE
>> - AArch64 w/o SVE (NEON only)
>> - x86
>
> Don't forget to change `applyIfCPUFeature` to `applyIfCPUFeatureOr`
>
> And to run these tests with different AVX configuration we need to remove `vm.flagless` from `@requires`. `-XX:UseAVX=n` flag is supported by IR testing now.
> BTW, previously I would like to add IR checks for x86 as well. But I don't have various generations of x86 machines to test so I don't have enough confidence to add them. Thanks @vnkozlov for your test effort on avx2. I would appreciate if someone from Intel (maybe @jbhateja) may help verify the x86 rules.
You can do testing by using `-XX:UseSSE=n -XX:UseAVX=n` flags on modern (avx512) machine.
To bypass `vm.flagless` you can `export TEST_VM_FLAGLESS=true`. That is what I did for testing.
Thank you for explaining `vm.flagless` issue. In our testing environment we do run these and other Vector API and vectorization tests with different `-XX:UseSSE=n -XX:UseAVX=n` flags settings. That is why I asked about `vm.flagless`.
Anyway, with added `avx` to IR testing filter we will run them on x86 and it is enough for now.
-------------
PR: https://git.openjdk.org/jdk/pull/11687
More information about the hotspot-compiler-dev
mailing list