RFR: 8324751: C2 SuperWord: Aliasing Analysis runtime check [v18]

Emanuel Peter epeter at openjdk.org
Wed Aug 20 12:31:11 UTC 2025


> TODO work that arose during review process / recent merges with master:
> 
> - Vladimir asked for benchmark where predicate is disabled, only multiversioning. Show that peek performance is identical but compilation time a bit higher. Investigation ongoing.
> - Test failure with multiversioning: `/home/empeter/Documents/oracle/jtreg/bin/jtreg -va -s -jdk:/home/empeter/Documents/oracle/jdk-fork6/build/linux-x64-debug/jdk -javaoptions:"-Djdk.test.lib.random.seed=-9045761078153722515" -J-Djavatest.maxOutputSize=10000000 /home/empeter/Documents/oracle/jdk-fork6/open/test/hotspot/jtreg/compiler/loopopts/superword/TestAliasingFuzzer.java`
> - See if we can harden some of the IR rules in `TestAliasingFuzzer.java` after JDK-8356176.
> 
> ---------------
> 
> This is a big patch, but about 3.5k lines are tests. And a large part of the VM changes is comments / proofs.
> 
> I am adding a dynamic (runtime) aliasing check to the auto-vectorizer (SuperWord). We use the infrastructure from https://github.com/openjdk/jdk/pull/22016:
> - Use the auto-vectorization `predicate` when available: we speculate that there is no aliasing, else we trap and re-compile without the predicate.
> - If the predicate is not available, we use `multiversioning`, i.e. we have a `fast_loop` where there is no aliasing, and hence vectorization. And a `slow_loop` if the check fails, with no vectorization.
> 
> --------------------------
> 
> **Where to start reviewing**
> 
> - `src/hotspot/share/opto/mempointer.hpp`:
>   - Read the class comment for `MemPointerRawSummand`.
>   - Familiarize yourself with the `MemPointer Linearity Corrolary`. We need it for the proofs of the aliasing runtime checks.
> 
> - `src/hotspot/share/opto/vectorization.cpp`:
>   - Read the explanations and proofs above `VPointer::can_make_speculative_aliasing_check_with`. It explains how the aliasing runtime check works.
> 
> - `src/hotspot/share/opto/vtransform.hpp`:
>   - Understand the difference between weak and strong edges.
> 
> If you need to see some examples, then look at the tests:
> - `test/hotspot/jtreg/compiler/loopopts/superword/TestAliasing.java`: simple array cases. IR rules that check for vectors and in somecases if we used multiversioning.
> - `test/micro/org/openjdk/bench/vm/compiler/VectorAliasing.java`: the miro-benchmarks I show below. Simple array cases.
> - `test/hotspot/jtreg/compiler/loopopts/superword/TestMemorySegmentAliasing.java`: a bit advanced, but similar cases.
> - `test/hotspot/jtreg/compiler/loopopts/superword/TestAliasingFuzzer.java`: very large and...

Emanuel Peter has updated the pull request incrementally with one additional commit since the last revision:

  disable flag if not possible

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/24278/files
  - new: https://git.openjdk.org/jdk/pull/24278/files/f84ec341..8480d814

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=24278&range=17
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=24278&range=16-17

  Stats: 5 lines in 1 file changed: 5 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/24278.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/24278/head:pull/24278

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


More information about the hotspot-compiler-dev mailing list