[vector] Vector.cast

Paul Sandoz paul.sandoz at oracle.com
Wed May 30 19:28:31 UTC 2018


Hi Razvan,

Thanks. A strong motivation for the change is being driven by the API design, based on feedback dealing with masks applying them on integral and floating point vectors with the same number of lanes. I think we can get to a consistent and intuitive approach to “cast” on Vector, Mask and Shuffle. 

I now think the reshape/resize/rebracket methods don’t make sense on Mask/Shuffle, those should be associated only with Vector and we provide methods to transform between Shuffle/Mask and Vector.

Further, by simplifying Vector.cast we avoid issues of endianness that we might need to reconsider for reshape etc.

Paul.

> On May 30, 2018, at 11:45 AM, Lupusoru, Razvan A <razvan.a.lupusoru at intel.com> wrote:
> 
> I started composing the reply to this several times but never got to click send. I admit I am not quite sure how I feel about this.
> 
> On one side, there are benefits to doing this since it makes behavior easier to understand since size would stay the same. On the other side, we have it working and fully tested with current approach so at least we have some confidence that implementation is fine. So I am a bit torn from my side - but it feels like the right thing would be to keep lane same and thus force resize to be explicit (and thus make it less of an error for developer bugs).
> 
> So I think you should probably go ahead with this change.
> 
> Thanks,
> Razvan
> 
> -----Original Message-----
> From: Paul Sandoz [mailto:paul.sandoz at oracle.com] 
> Sent: Wednesday, May 30, 2018 11:41 AM
> To: John Rose <john.r.rose at oracle.com>; Lupusoru, Razvan A <razvan.a.lupusoru at intel.com>
> Cc: panama-dev at openjdk.java.net
> Subject: Re: [vector] Vector.cast
> 
> Ok.
> 
> Razvan, any views on this before i start reducing down the scope of the cast implementations? (I realize you put a lot of effort into supporting the current functionality).
> 
> Thanks,
> Paul.
> 
>> On May 25, 2018, at 8:13 PM, John Rose <john.r.rose at oracle.com> wrote:
>> 
>> Yes, that makes sense. A length changes should be a separate operation, which will generate very different code. 
>> 
>>> On May 25, 2018, at 3:08 PM, Paul Sandoz <paul.sandoz at oracle.com> wrote:
>>> 
>>> Hi,
>>> 
>>> Would it make sense to simplify Vector.cast to species of the same length? if length differs an exception is thrown.
>>> 
>>> That’s one less thing to think about and same concept can then be applied to Shuffle and Mask, which is effectively a nop if no boxing occurs because the underlying lane elements don't change.
>>> 
>>> We can lean on the reshape/rebracket/resize for other length transforming operations, in addition to mask/shuffle conversion to/from vector.
>>> 
>>> Paul.
>> 
> 



More information about the panama-dev mailing list