[vector] Partial intrinsification support for with and get

Paul Sandoz paul.sandoz at oracle.com
Mon May 21 21:59:56 UTC 2018



> On May 21, 2018, at 1:38 PM, Lupusoru, Razvan A <razvan.a.lupusoru at intel.com> wrote:
> 
> Thanks for your feedback. Yes, I have update dit to no longer access vec directly and use getElements since it is the documented approach.
>  
> I have also made another change related to index - now IllegalArgumentException is thrown if index is invalid. I updated documentation to reflect this as well.
> http://cr.openjdk.java.net/~rlupusoru/panama/webrev_getwith_02/index.html
>  

1853      * @param i the lane index. Must be zero or positive value smaller than 
1854      * length of vector.
1855      * @return the lane element at lane index {@code i}
1856      * @throws IllegalArgumentException if {@code i} is not a valid index.
1857      */

I suggest to drop the second sentence on @param and focus on the constraints for the exception doc. That’s generally what we tend to do in the JDK e.g. see List.get

May i suggest:

  @throws IllegalArgumentException if the index is is out of range ({@code < 0 || >= length()})


1864      * This is a cross-lane operation and behaves it returns the result of
1865      * blending this vector with an input vector that is the result of
1866      * broadcasting {@code e} and a mask that has only one lane set at lane
1867      * index {@code i}.

I noticed I introduce a typo would you mind fixing it?

  s/behaves it/behaves as if it
 
Thanks,
Paul.


> The tests are not part of this patch but instead will be part of subsequent patch from Shravya.
>  
> Thanks,
> Razvan
>  
> From: Paul Sandoz [mailto:paul.sandoz at oracle.com] 
> Sent: Friday, May 18, 2018 3:19 PM
> To: Lupusoru, Razvan A <razvan.a.lupusoru at intel.com>
> Cc: panama-dev at openjdk.java.net
> Subject: Re: [vector] Partial intrinsification support for with and get
>  
>  
> 
> 
> On May 18, 2018, at 1:38 PM, Lupusoru, Razvan A <razvan.a.lupusoru at intel.com> wrote:
>  
> Hello,
> 
> I'd like to contribute the infrastructure to be able to intrinsify 'with' (insert) and 'get' (extract). The actual implementation with x86 instructions is coming in a follow up patch from my teammates.
> http://cr.openjdk.java.net/~rlupusoru/panama/webrev_getwith_01/index.html
> 
> One change I will need to make is make the base class methods as abstract to match Paul's recent changes. I will make sure to do that before merging. In meantime, please take a look to see if you identify any other issues.
> 
>  
> Ok.
> 1114     public $vectortype$ with(int i, $type$ e) {
> 1115         return VectorIntrinsics.insert(
> 1116                                 $vectortype$.class, $type$.class, LENGTH,
> 1117                                 this, i, (long)e,
> 1118                                 (v, ix, bits) -> {
> 1119                                     $type$[] res = v.vec.clone();
> 1120                                     res[ix] = ($type$)bits;
> 1121                                     return new $vectortype$(res);
> 1122                                 });
> Should you do v.getElements().clone() ? perhaps it does not matter in this case...
>  
> Paul.



More information about the panama-dev mailing list