[vector api] RFR: Fix the issue about float/double reduce-max/min operations with NaN as an input
Vladimir Ivanov
vladimir.x.ivanov at oracle.com
Fri Jan 11 19:25:42 UTC 2019
On 10/01/2019 19:23, Yang Zhang (Arm Technology China) wrote:
> Hi Sandhya
>
> 1) Vector Api min()/max() have been updated. Are there any missed?
> 2) Math.min/max support float/double/int/long only, byte/short need casting. Current ((a<b) ? a : b) is ok for all integer types.
For consistency, I would prefer uniform usage of Math.min()/max() across
the javadoc/implementation and casts when needed.
Best regards,
Vladimir Ivanov
> -----Original Message-----
> From: Viswanathan, Sandhya <sandhya.viswanathan at intel.com>
> Sent: Friday, January 11, 2019 8:33 AM
> To: Yang Zhang (Arm Technology China) <Yang.Zhang at arm.com>; 'panama-dev at openjdk.java.net' <panama-dev at openjdk.java.net>; Vladimir Ivanov <vladimir.x.ivanov at oracle.com>
> Cc: nd <nd at arm.com>
> Subject: RE: [vector api] RFR: Fix the issue about float/double reduce-max/min operations with NaN as an input
>
> Hi Yang,
>
> Changing minAll and maxAll to use Math.min() and Math.max() looks good. I have a couple of more inputs below:
> 1) The Vector API min() and max() methods also need this change.
> 2) Math.min and Math.max should be used across data types for both integral and floating point.
> This is to be consistent all across.
>
> Best Regards,
> Sandhya
>
>
> -----Original Message-----
> From: Yang Zhang (Arm Technology China) [mailto:Yang.Zhang at arm.com]
> Sent: Wednesday, January 09, 2019 6:44 PM
> To: 'panama-dev at openjdk.java.net' <panama-dev at openjdk.java.net>; Viswanathan, Sandhya <sandhya.viswanathan at intel.com>; Vladimir Ivanov <vladimir.x.ivanov at oracle.com>
> Cc: nd <nd at arm.com>
> Subject: RE: [vector api] RFR: Fix the issue about float/double reduce-max/min operations with NaN as an input
>
> Hi Vladimir, Sandhya
>
> Ping again. Could you please help to review this patch?
>
> Regards,
> Yang
>
> -----Original Message-----
> From: Yang Zhang <yang.zhang at linaro.org>
> Sent: Thursday, January 10, 2019 10:32 AM
> To: Yang Zhang (Arm Technology China) <Yang.Zhang at arm.com>
> Subject: Fwd: [vector api] RFR: Fix the issue about float/double reduce-max/min operations with NaN as an input
>
> ---------- Forwarded message ---------
> From: Yang Zhang (Arm Technology China) <Yang.Zhang at arm.com>
> Date: Fri, 14 Dec 2018 at 16:31
> Subject: RE: [vector api] RFR: Fix the issue about float/double reduce-max/min operations with NaN as an input
> To: Viswanathan, Sandhya <sandhya.viswanathan at intel.com>, panama-dev at openjdk.java.net <panama-dev at openjdk.java.net>
> Cc: nd <nd at arm.com>
>
>
> Hi Sandhya
>
> Happy holidays. Let us keep on this work after holidays.
>
> Regards
> Yang
>
> -----Original Message-----
> From: Viswanathan, Sandhya <sandhya.viswanathan at intel.com>
> Sent: Friday, December 14, 2018 9:43 AM
> To: Yang Zhang (Arm Technology China) <Yang.Zhang at arm.com>; panama-dev at openjdk.java.net
> Cc: nd <nd at arm.com>
> Subject: RE: [vector api] RFR: Fix the issue about float/double reduce-max/min operations with NaN as an input
>
> Hi Yang,
>
> The current x86 intrinsics are based on the current definition as in Javadoc for Vector API float(double) min:
>
> public abstract FloatVector<S> min(float s) Returns the minimum of this vector and the broadcast of an input scalar.
> This is a vector binary operation where the operation (a, b) -> a < b ? a : b is applied to lane elements.
> Parameters:
> s - the input scalar
> Returns:
> the minimum of this vector and the broadcast of an input scalar
>
> We are looking into making it closer to Math.min at least in the NaN related behavior. Let us wait till January middle or so to converge on this, it being too close to Christmas now and many are on vacation.
> Hope that is ok.
>
> Happy holidays. It is wonderful to see you and others from Arm technology onboard and contributing to Panama Vector API. Let us keep this collaboration going.
>
> Best Regards,
> Sandhya
>
>
> -----Original Message-----
> From: panama-dev [mailto:panama-dev-bounces at openjdk.java.net] On Behalf Of Yang Zhang (Arm Technology China)
> Sent: Wednesday, December 12, 2018 12:37 AM
> To: panama-dev at openjdk.java.net
> Cc: nd <nd at arm.com>
> Subject: [vector api] RFR: Fix the issue about float/double reduce-max/min operations with NaN as an input
>
> Hi
>
> When I implement reduce-max/min, I found there is an issue about float/double reduce-max/min operations with NaN as an input.
> In java doc, if either value is NaN, then the result of max/min(a, b) is NaN. But the result of "((a > b) ? a : b)" is affected by sequence of (a, b). If a is NaN, the result is b. If b is NaN, the result is b (NaN).
>
> I have a patch which could fix this issue. Could you please help to review it?
> http://cr.openjdk.java.net/~yzhang/vectorapi.nan/webrev.00/
>
> Ps. With this patch, there are 5 failures on x86 platform.
> jdk/incubator/vector/Float256VectorTests.java
> jdk/incubator/vector/Float64VectorTests.java
> jdk/incubator/vector/FloatMaxVectorTests.java
> jdk/incubator/vector/Double128VectorTests.java
> jdk/incubator/vector/DoubleMaxVectorTests.java
>
> Webrev:
>
> Regards,
> Yang
>
More information about the panama-dev
mailing list