[lworld+vector] RFR: 8319972: [lworld+vector] Enable intrinsification of Unsafe.finishPrivateBuffer. [v3]

Jatin Bhateja jbhateja at openjdk.org
Tue Nov 21 16:45:54 UTC 2023


> Re-enabling intrinsification of Unsafe.finishPrivateBuffer to fix performance degradation seen in Vector API JMH micro benchmarks. It's intrinsifation was disabled to fix incorrectness caused due to missing inductive InlineType Phi node in loops with Unsafe.put* operations. Since Unsafe.put* APIs returns a void hence JVM state is not altered and ciTypeFlow dataflow analysis does not encounter a inductive definition in the loop, due to this C2 parser misses creating an inductive phi node on
> encountering [loop header block](https://github.com/openjdk/valhalla/blob/lworld%2Bvector/src/hotspot/share/opto/parse1.cpp#L696). 
> 
> In order to maintain IR compliance with ciTypeFlow analysis C2 should prevent scalarizing value object b/w make and finish private buffer calls.
> 
> New behavior of unsafe inline expanders
> 1) makePrivate: Receive InlineTypeNode input and return initialized buffer in larval state.
> 2) finishPrivateBuffer: Receive value object buffer input and return rematerialize InlineTypeNode in non-larval state.
> 
> This may result into creation of unbalanced phi node at control flow merges where one of the phi input may InlineTypeNode and other is a buffer of compatible value type, but the IR still remains valid.
> 
> In addition compiler is now preventing elimination of allocation in larval state.
> 
> Validation Status:-
>   - All the VectorAPI and Valhalla JTREG tests are now passing at various AVX level with / wo -XX:+DoptimizeALot.
> 
> Kindly review and share your feedback.
> 
> Best Regards,
> Jatin

Jatin Bhateja has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision:

 - Some more fixes and cleanups
 - Merge branch 'lworld+vector' of http://github.com/openjdk/valhalla into JDK-8319972
 - Review comments resolutions
 - Regression fixes
 - 8319972: [lworld+vector] Enable intrinsification of Unsafe.finishPrivateBuffer.

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

Changes:
  - all: https://git.openjdk.org/valhalla/pull/952/files
  - new: https://git.openjdk.org/valhalla/pull/952/files/23acb6bd..2c5e7e87

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=valhalla&pr=952&range=02
 - incr: https://webrevs.openjdk.org/?repo=valhalla&pr=952&range=01-02

  Stats: 869 lines in 43 files changed: 38 ins; 28 del; 803 mod
  Patch: https://git.openjdk.org/valhalla/pull/952.diff
  Fetch: git fetch https://git.openjdk.org/valhalla.git pull/952/head:pull/952

PR: https://git.openjdk.org/valhalla/pull/952



More information about the valhalla-dev mailing list