RFR: 8294715: Add IR checks to the reduction vectorization tests [v3]
Fei Gao
fgao at openjdk.org
Thu Mar 2 06:56:18 UTC 2023
On Tue, 28 Feb 2023 08:03:20 GMT, Daniel Skantz <duke at openjdk.org> wrote:
>> We are lifting some loopopts/superword tests to use the IR framework, and add IR annotations to check that vector reductions take place on x86_64. This can be useful to prevent issues such as JDK-8300865.
>>
>> Approach: lift the more general tests in loopopts/superword, mainly using matching rules in cpu/x86/x86.ad, but leave tests mostly unchanged otherwise. Some reductions are considered non-profitable (superword.cpp), so we might need to raise sse/avx value pre-conditions from what would be a strict reading of x86.ad (as noted by @eme64).
>>
>> Testing: Local testing (x86_64) using UseSSE={2,3,4}, UseAVX={0,1,2,3}. Tested running all jtreg compiler tests. Tier1-tier5 runs to my knowledge never showed any compiler-related regression in other tests as a result from this work. GHA. Validation: all tests fail if we put unreasonable counts for the respective reduction node, such as counts = {IRNode.ADD_REDUCTION_VI, ">= 10000000"}).
>>
>> Thanks @robcasloz and @eme64 for advice.
>>
>> Notes: ProdRed_Double does not vectorize (JDK-8300865). SumRed_Long does not vectorize on 32-bit, according to my reading of source, test on GHA and cross-compiled JDK on 32-bit Linux, so removed these platforms from @requires. Lifted the AbsNeg tests too but added no checks, as these are currently not run on x86_64.
>
> Daniel Skantz has updated the pull request incrementally with one additional commit since the last revision:
>
> Address further review comments (edits)
Changes requested by fgao (Committer).
test/hotspot/jtreg/compiler/loopopts/superword/RedTest_long.java line 150:
> 148: @IR(applyIfOr = {"SuperWordReductions", "false", "LoopMaxUnroll", "< 8"},
> 149: failOn = {IRNode.ADD_REDUCTION_VL})
> 150: @IR(applyIfCPUFeature = {"avx2", "false"},
I'm afraid the restriction here is not safe because all non-avx2 machines would meet the condition, like aarch64 and riscv64. SVE supports `AndReductionV`, `OrReductionV `, `XorReductionV`, `AddReductionVL`, `AddReductionVD`, `SqrtVD`, and so on.
test/hotspot/jtreg/compiler/loopopts/superword/RedTest_long.java line 172:
> 170: @IR(applyIfOr = {"SuperWordReductions", "false", "LoopMaxUnroll", "< 8"},
> 171: failOn = {IRNode.OR_REDUCTION_V})
> 172: @IR(applyIfCPUFeature = {"avx2", "false"},
ditto
test/hotspot/jtreg/compiler/loopopts/superword/RedTest_long.java line 194:
> 192: @IR(applyIfOr = {"SuperWordReductions", "false", "LoopMaxUnroll", "< 8"},
> 193: failOn = {IRNode.AND_REDUCTION_V})
> 194: @IR(applyIfCPUFeature = {"avx2", "false"},
ditto
test/hotspot/jtreg/compiler/loopopts/superword/RedTest_long.java line 216:
> 214: @IR(applyIfOr = {"SuperWordReductions", "false", "LoopMaxUnroll", "< 8"},
> 215: failOn = {IRNode.XOR_REDUCTION_V})
> 216: @IR(applyIfCPUFeature = {"avx2", "false"},
ditto
test/hotspot/jtreg/compiler/loopopts/superword/SumRedSqrt_Double.java line 95:
> 93: @IR(applyIfOr = {"SuperWordReductions", "false", "LoopMaxUnroll", "< 8"},
> 94: failOn = {IRNode.ADD_REDUCTION_VD, IRNode.SQRT_V})
> 95: @IR(applyIfCPUFeature = {"avx", "false"},
ditto
test/hotspot/jtreg/compiler/loopopts/superword/SumRed_Long.java line 98:
> 96: @IR(applyIfOr = {"SuperWordReductions", "false", "LoopMaxUnroll", "< 8"},
> 97: failOn = {IRNode.ADD_REDUCTION_VL})
> 98: @IR(applyIfCPUFeature = {"avx2", "false"},
ditto
-------------
PR: https://git.openjdk.org/jdk/pull/12683
More information about the hotspot-compiler-dev
mailing list