[lworld+vector] RFR: 8319972: [lworld+vector] Enable intrinsification of Unsafe.finishPrivateBuffer.
Xiaohong Gong
xgong at openjdk.org
Wed Nov 15 06:14:46 UTC 2023
On Tue, 14 Nov 2023 15:00:37 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:
> 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 JTREG tests are now passing at various AVX level with / wo -XX:+DoptimizeALot.
>
> Kindly review and share your feedback.
>
> Best Regards,
> Jatin
I see the new IR framework check failures in test `compiler/valhalla/inlinetypes/TestIntrinsics.java` with this PR on NEON.
See the log below:
One or more @IR rules failed:
Failed IR Rules (1) of Methods (1)
----------------------------------
1) Method "public void compiler.valhalla.inlinetypes.TestIntrinsics.test22(compiler.valhalla.inlinetypes.MyValue1)" - [Failed IR rules: 1]:
* @IR rule 1: "@compiler.lib.ir_framework.IR(phase={DEFAULT}, applyIfCPUFeatureAnd={}, applyIf={}, applyIfCPUFeatureOr={}, applyIfCPUFeature={}, counts={}, failOn={"_#CALL_UNSAFE#I_", "_#ALLOC#I_"}, applyIfAnd={}, applyIfOr={}, applyIfNot={})"
> Phase "PrintOptoAssembly":
- failOn: Graph contains forbidden nodes:
* Constraint 2: "(.*precise compiler/valhalla/inlinetypes/MyValue.*\R(.*(?i:mov|xorl|nop|spill).*\R)*.*_new_instance_Java)"
- Matched forbidden node:
* 618 + mov R1, precise compiler/valhalla/inlinetypes/MyValue1: 0x0000ffff3c5ce718 (compiler/valhalla/inlinetypes/MyInterface):Constant:exact * # ptr
624 mov R2, #1 # int
628 call,static 0x0000ffff8bddf240 // ==> wrapper for: _new_instance_Java
>>> Check stdout for compilation output of the failed methods
-------------
PR Comment: https://git.openjdk.org/valhalla/pull/952#issuecomment-1811866137
More information about the valhalla-dev
mailing list