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

Emanuel Peter epeter at openjdk.org
Mon Sep 11 11:34:56 UTC 2023


**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**

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

Commit messages:
 - 8314612: TestUnorderedReduction.java fails with -XX:MaxVectorSize=32 and -XX:+AlignVector

Changes: https://git.openjdk.org/jdk/pull/15654/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=15654&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8314612
  Stats: 52 lines in 2 files changed: 46 ins; 0 del; 6 mod
  Patch: https://git.openjdk.org/jdk/pull/15654.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/15654/head:pull/15654

PR: https://git.openjdk.org/jdk/pull/15654


More information about the hotspot-compiler-dev mailing list