RFR: 8314612: TestUnorderedReduction.java fails with -XX:MaxVectorSize=32 and -XX:+AlignVector [v2]

Christian Hagedorn chagedorn at openjdk.org
Tue Sep 12 10:47:40 UTC 2023


On Tue, 12 Sep 2023 07:07:30 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> **Problem**
>> 
>> There is a case where `PhaseIdealLoop::move_unordered_reduction_out_of_loop` gets a chain of `UnorderedReduction` which have differing vector lengths. But this can lead to wrong results, as some elements now get dropped or "hallucinated".
>> 
>> Details:
>> `-XX:+AlingVector` creates alignment boundaries over which no pack can go. Effectively, it cuts the packs at the alignment boundaries. This can create unexpected series of packs with lengths `[4, 8, 4]`, rather than `[8, 8]`.
>> 
>> **Solution**
>> 
>> We need to check that all `UnorderedReduction` have the same `vect_type()`. That ensures all have the same length and element type.
>> 
>> **Testing**
>> 
>> I converted the old test into scenario `v016-U`, and added scenario `v032-A` (fails without the patch). Also, I added some vanilla scenarios, just to ensure the test cases can be run with other flag combinations. The IR tests are targeted at scenario `v016-U`.
>> 
>> Tests: tier1-6, stress-testing. **Running**
>
> Emanuel Peter has updated the pull request incrementally with one additional commit since the last revision:
> 
>   rename ids

Otherwise, looks good!

test/hotspot/jtreg/compiler/loopopts/superword/TestUnorderedReduction.java line 77:

> 75:             case "Vanilla-Aligned"           -> { framework.addFlags("-XX:+AlignVector"); }
> 76:             case "MaxVectorSize16-Unaligned" -> { framework.addFlags("-XX:-AlignVector", "-XX:MaxVectorSize=16"); }
> 77:             case "MaxVectorSize32-Aligned"   -> { framework.addFlags("-XX:+AlignVector", "-XX:MaxVectorSize=32"); }

Since `AlignVector` and `MaxVectorSize` are C2 flags, you should add a `@requires vm.compiler2.enabled` to all `@test` definitions.

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

Marked as reviewed by chagedorn (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/15654#pullrequestreview-1621949906
PR Review Comment: https://git.openjdk.org/jdk/pull/15654#discussion_r1322853080


More information about the hotspot-compiler-dev mailing list