Bug when using DIV

Viswanathan, Sandhya sandhya.viswanathan at intel.com
Mon Apr 20 20:34:18 UTC 2020


I am proposing remove the div support for integerals. 
The thought was to keep the specification as much as possible from changing so we get to incubate :).

In any case, I will go with your recommendation.

The API does have support for cast from integral to float and vice versa.

Best Regards,
Sandhya

-----Original Message-----
From: Paul Sandoz <paul.sandoz at oracle.com> 
Sent: Monday, April 20, 2020 1:24 PM
To: Viswanathan, Sandhya <sandhya.viswanathan at intel.com>
Cc: Remi Forax <forax at univ-mlv.fr>; panama-dev at openjdk.java.net' <panama-dev at openjdk.java.net>
Subject: Re: Bug when using DIV

Hi,

What are you proposing by "verify and update the implementation accordingly,”? Remove it, or keep it and expand the operation to support integrals?

I was too focused on x86.  I believe ARM SVE supports divide for 32 and 64 bits signed integers, where AFAICT integer values are promoted to real values, the division operation applied, and then the real result is rounded up or down (depending on the sign) to the nearest whole number.

However, I am not confident at this time we can specify this clearly right now in terms of scalar division.

Paul.

> On Apr 20, 2020, at 12:57 PM, Viswanathan, Sandhya <sandhya.viswanathan at intel.com> wrote:
> 
> Hi Paul,
> 
> Yes, the DIV operator is supported for floating point (float/double) only. 
> That's how we have documented it in the Java doc also.
> http://cr.openjdk.java.net/~psandoz/panama/vector-api-review/docs/api/jdk.incubator.vector/jdk/incubator/vector/VectorOperators.html#DIV
> 
> I think we should verify and update the implementation accordingly, if that is not already so.
> 
> Best Regards,
> Sandhya
> 
> 
> -----Original Message-----
> From: Paul Sandoz <paul.sandoz at oracle.com> 
> Sent: Monday, April 20, 2020 11:13 AM
> To: Remi Forax <forax at univ-mlv.fr>
> Cc: panama-dev at openjdk.java.net' <panama-dev at openjdk.java.net>; Viswanathan, Sandhya <sandhya.viswanathan at intel.com>
> Subject: Re: Bug when using DIV
> 
> Hi Remi,
> 
> I seem to recall that it was planed to remove the div methods on vectors with integral values.  Hence the exception, the DIV operation is specified to be floating point only:
> 
>  public static final Binary DIV = binary("DIV", "/", VectorSupport.VECTOR_OP_DIV, VO_ONLYFP);
> 
> There is no vector hardware instruction for div for integrals. 
> 
> But IIUC there is SVML support, so potentially it could be rolled into that (with support for the transcendental functions) if/when the SVML is brought it.
> 
> Sandhya, what are your thoughts on this?
> 
> Paul.
> 
>> On Apr 16, 2020, at 10:09 AM, Remi Forax <forax at univ-mlv.fr> wrote:
>> 
>> Hi all,
>> I've found a bug or at least a weird behaviour
>>   var species =  IntVector.SPECIES_PREFERRED;
>>   var array = IntStream.range(0, 64).toArray();
>>   var v1 = IntVector.fromArray(species, array, 0);
>>   var v2 = IntVector.fromArray(species, array, 0);
>>   v1.div(v2);
>> 
>> Exception in thread "main" java.lang.UnsupportedOperationException: DIV: inapplicable floating point operator
>>       at jdk.incubator.vector/jdk.incubator.vector.VectorOperators$OperatorImpl.illegalOperation(VectorOperators.java:908)
>>       at jdk.incubator.vector/jdk.incubator.vector.VectorOperators$OperatorImpl.illegalOperation(VectorOperators.java:894)
>>       at jdk.incubator.vector/jdk.incubator.vector.VectorOperators$OperatorImpl.opCode(VectorOperators.java:865)
>>       at jdk.incubator.vector/jdk.incubator.vector.VectorOperators.opCode(VectorOperators.java:434)
>>       at jdk.incubator.vector/jdk.incubator.vector.IntVector.opCode(IntVector.java:62)
>>       at jdk.incubator.vector/jdk.incubator.vector.IntVector.lanewiseTemplate(IntVector.java:651)
>>       at jdk.incubator.vector/jdk.incubator.vector.Int256Vector.lanewise(Int256Vector.java:277)
>>       at jdk.incubator.vector/jdk.incubator.vector.Int256Vector.lanewise(Int256Vector.java:41)
>>       at jdk.incubator.vector/jdk.incubator.vector.IntVector.div(IntVector.java:1336)
>>       at fr.umlv.jruntime/fr.umlv.jruntime.DivBug.main(DivBug.java:12)
>> 
>> regards,
>> Rémi
>> 
>> PS: i've first sent that email to "panama-dev" <panama-dev-bounces at openjdk.java.net> :(
> 



More information about the panama-dev mailing list