Add/SubSaturate for FP

Paul Sandoz paul.sandoz at oracle.com
Mon Feb 26 18:37:46 UTC 2018



> On Feb 26, 2018, at 10:19 AM, Halimi, Jean-Philippe <jean-philippe.halimi at intel.com> wrote:
> 
> Hi all,
>  
> I’ve spend some time today analyzing the code. It looks like addSaturate and subSaturate are by design defined in the Vector superclass. Thus, the FP sub-classes inherit from the definitions as stated in the X-Vector.java.template file.
>   <>
> Should we move the definition of these methods to non-FP classes,

Yes, remove the methods from Vector and declare them for non-FP sub-types in X-Vector.java.template, using the appropriate clamp value.

Thanks,
Paul.


> or is there a way to mark some code as unreachable? This would increase the robustness of the code as there is currently code in FP classes that is non-usable.
>  
> Thanks,
>  
> Jp
>  
>  <>From: Halimi, Jean-Philippe 
> Sent: Wednesday, February 21, 2018 12:08 PM
> To: Paul Sandoz <paul.sandoz at oracle.com <mailto:paul.sandoz at oracle.com>>; panama-dev at openjdk.java.net <mailto:panama-dev at openjdk.java.net>
> Cc: Vladimir Ivanov <vladimir.x.ivanov at oracle.com <mailto:vladimir.x.ivanov at oracle.com>>; Lupusoru, Razvan A <razvan.a.lupusoru at intel.com <mailto:razvan.a.lupusoru at intel.com>>; Rukmannagari, Shravya <shravya.rukmannagari at intel.com <mailto:shravya.rukmannagari at intel.com>>; Deshpande, Vivek R <vivek.r.deshpande at intel.com <mailto:vivek.r.deshpande at intel.com>>; Viswanathan, Sandhya <sandhya.viswanathan at intel.com <mailto:sandhya.viswanathan at intel.com>>; Kandu, Rahul <rahul.kandu at intel.com <mailto:rahul.kandu at intel.com>>
> Subject: RE: Add/SubSaturate for FP
>  
> Adding Panama-dev to the conversation.
>  
> Jp
>  
> From: Paul Sandoz [mailto:paul.sandoz at oracle.com <mailto:paul.sandoz at oracle.com>] 
> Sent: Wednesday, February 21, 2018 11:53 AM
> To: Halimi, Jean-Philippe <jean-philippe.halimi at intel.com <mailto:jean-philippe.halimi at intel.com>>
> Cc: Vladimir Ivanov <vladimir.x.ivanov at oracle.com <mailto:vladimir.x.ivanov at oracle.com>>; Lupusoru, Razvan A <razvan.a.lupusoru at intel.com <mailto:razvan.a.lupusoru at intel.com>>; Rukmannagari, Shravya <shravya.rukmannagari at intel.com <mailto:shravya.rukmannagari at intel.com>>; Deshpande, Vivek R <vivek.r.deshpande at intel.com <mailto:vivek.r.deshpande at intel.com>>; Viswanathan, Sandhya <sandhya.viswanathan at intel.com <mailto:sandhya.viswanathan at intel.com>>; Kandu, Rahul <rahul.kandu at intel.com <mailto:rahul.kandu at intel.com>>
> Subject: Re: Add/SubSaturate for FP
>  
> Hi Jp,
>  
> I think you are correct, they don’t make sense for FP types.
>  
> Also, i think the clamped value is incorrect for various types. What should the clamped value be for saturated add of two byte values? Byte.MAX_VALUE?
>  
> Shall we continue the conversation on the panama list?
>  
>>  
> Separately if we support saturation we should add scalar methods to the boxed classes.
>  
> Paul.
>  
>  
> 
> On Feb 21, 2018, at 10:59 AM, Halimi, Jean-Philippe <jean-philippe.halimi at intel.com <mailto:jean-philippe.halimi at intel.com>> wrote:
>  
> Dear both,
>  
> While I was adding test coverage for the VectorAPI testing framework, I realized that addSaturate for Float was saturating on Integer, while subSaturate was saturating on Float.
> I am unsure whether Add and Sub saturate operations make sense for floating point vectors. I have made a patch which removes the two methods for FP vectors.
>  
> What are your thoughts?
>  
> Thanks,
>  
> Jp
> <add_saturate.patch>



More information about the panama-dev mailing list