Vector API unboxing and masking support
Lupusoru, Razvan A
razvan.a.lupusoru at intel.com
Thu Sep 28 23:04:40 UTC 2017
Here are the updated hotspot and jdk patches with all of the comments addressed:
In addition to addressing the comments, I have also made the following changes from last patch:
- Stabilized VectorUnbox expansion
- Allowed generation of VectorUnbox not just for phis - but anytime an input has not been converted to vector value
- Added support for zero extension so that the GenericMask can also be unboxed into compiler's mask representation
- Added disabled implementation for VectorBox generation including allocation and setting of values in fields. Currently disabled because VectorBox can be removed but will leave behind allocations.
- Ensured that invariant nodes are hoistable.
- Enabled more float, double, and int vector variants.
Let me know if you have any comments. If it looks like by tomorrow there is no push back, I will go ahead and push this change so we have it in by Java One.
From: Paul Sandoz [mailto:paul.sandoz at oracle.com]
Sent: Sunday, September 24, 2017 3:43 PM
To: Viswanathan, Sandhya <sandhya.viswanathan at intel.com>
Cc: Lupusoru, Razvan A <razvan.a.lupusoru at intel.com>; panama-dev at openjdk.java.net
Subject: Re: Vector API unboxing and masking support
> On 24 Sep 2017, at 15:14, Viswanathan, Sandhya <sandhya.viswanathan at intel.com> wrote:
> Hi Razvan,
> The files FloatVector.java and DoubleVector.java are generated from the template X-Vector.java.template. Please change the template instead of changing these files directly.
Razvan, i can help if need be. If so we could probably speed this up if we chat directly on Monday if you are free?
Some other comments:
- for the true/false masks we could add constants to the concrete species, same as we do for zero(), and you only need to do this once in the template X-VectorBits.java.template
- I am not entirely confident about the correctness of the core reshape/cast implementations in relation to any AVX counter part. I dunno if you really want to use rebracket instead? then you don’t need the additional cast method.
> -----Original Message-----
> From: panama-dev [mailto:panama-dev-bounces at openjdk.java.net] On Behalf Of Lupusoru, Razvan A
> Sent: Sunday, September 24, 2017 9:43 AM
> To: panama-dev at openjdk.java.net
> Subject: Vector API unboxing and masking support
> Hi everyone,
> Please review the following patch which adds more enhancements to the Vector API:
> Changes in hotspot:
> * Adds support to generate vptest and a node that represents these semantics. This is used for mask checking methods "anyTrue" and "allTrue"
> * Added enum bounds for Vector API methods to improve robustness in checking whether a method is Vector API
> * The intrinsics generator can now see which call node it is replacing (if one exists). This was needed to add in future functionality to analyze graph for boxing generation.
> * Fixed a bug related to wrong class being set for Vector Box. Namely, the receiver type was always set as the class but in reality, the return type is the correct type.
> * Added some support around masks and some double methods.
> * Cleaned up intrinsics code and created common methods for getting vector operands and setting output.
> * Added some support for Vector unboxing:
> o In cases where VectorBox nodes feed into phis used by a vector unbox, a new vector phi is created that merge vector values
> o In all the rest of cases, a vector load is generated to get vector value.
> * Added a flag to be able to turn off unstable_if speculation named "DisableUnstableIfOpt". This is useful because there is no vector boxing support yet and the speculation makes it so that if there is branching inside vector loop, some values live to runtime which cannot be created.
> Changes in jdk:
> * Adds capability to generate true and false masks directly without going through constantMask call. This makes it easier to initialize masks.
> * Marks more methods as being hotspot intrinsic
> * Creates a copy of cast in FloatVector due to some limitations in the intrinsics matching technology being used. In future this can probably be removed but I needed it to show how to support on compiler side.
> Let me know if you have any comments or questions.
More information about the panama-dev