RFR: 8257531: Super word not applied to a loop of simple Buffer operations [v2]

Vladimir Kozlov kvn at openjdk.java.net
Fri Dec 4 07:42:21 UTC 2020


> In Buffer case there is additional (loop invariant) load from java/nio/IntBuffer.offset field.
> SuperWord did not handle loop's invariants in complex address expressions (only when vectorization is forced):
> 
> `AddP(addr, AddP(addr, addr, LShiftL(ConvI2L(CastII(AddI(AddI(iv_phi, invariant_LoadI), incr))), shift)), 16)`
> 
> Invariant reference is used to make sure all memory accesses in vectors use the same one. And only when alignment code is generated in pre-loop it is used for code generatin. But that code did not take into account that invariant have to be scaled if needed as in this example (invariant_LoadI << shift).
> 
> I propose to record scaling (left shift) for invariant when it is present and use it to compare invariants and in pre-loop alignment code generation. I also slightly modified tracing output code for invariants.
> 
> This allow vectorize Java code which uses Buffer.
> 
> I added new test based on @PaulSandoz example. It tests presence of new vectors and correctness of vectorized code.
> I included case (ByteBuffer.allocateDirect()) which is not vectorized because it uses Unsafe access - SuperWord complains about CastX2P(AddL) nodes which it sees instead of AddP.  We may consider vectorizing such code too later.
> 
> Testing: tier1-4, precheckin-comp (-Xcomp), renaissance test

Vladimir Kozlov has updated the pull request incrementally with one additional commit since the last revision:

  Requires test run only on x86, x64 and aarch64

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/1618/files
  - new: https://git.openjdk.java.net/jdk/pull/1618/files/0f894f6c..9b9219da

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=1618&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=1618&range=00-01

  Stats: 1 line in 1 file changed: 1 ins; 0 del; 0 mod
  Patch: https://git.openjdk.java.net/jdk/pull/1618.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/1618/head:pull/1618

PR: https://git.openjdk.java.net/jdk/pull/1618


More information about the hotspot-compiler-dev mailing list