VectorAPI reduction operation support for testing infrastructure

Halimi, Jean-Philippe jean-philippe.halimi at intel.com
Thu Mar 29 21:36:34 UTC 2018


Razvan just made me realize that we can actually enable the reduction tests even without the intrinsics. I will uncomment them.

Jp

-----Original Message-----
From: panama-dev [mailto:panama-dev-bounces at openjdk.java.net] On Behalf Of Halimi, Jean-Philippe
Sent: Thursday, March 29, 2018 2:21 PM
To: Paul Sandoz <paul.sandoz at oracle.com>
Cc: panama-dev at openjdk.java.net
Subject: RE: VectorAPI reduction operation support for testing infrastructure

Thanks for the review :-) Sorry for the delayed answer. Let me answer in the email.

-----Original Message-----
From: Paul Sandoz [mailto:paul.sandoz at oracle.com] 
Sent: Tuesday, March 27, 2018 6:05 PM
To: Halimi, Jean-Philippe <jean-philippe.halimi at intel.com>
Cc: panama-dev at openjdk.java.net
Subject: Re: VectorAPI reduction operation support for testing infrastructure



> On Mar 27, 2018, at 4:45 PM, Halimi, Jean-Philippe <jean-philippe.halimi at intel.com> wrote:
> 
> Hi all,
> 
> I would like to share a patch adding support for reduction operations testing in VectorAPI.
> 
> Could you please review the patch here:
> http://cr.openjdk.java.net/~jphalimi/webrev_reduction_testing_v1.1/
> 

 122 # Reductions.
 123 #gen_reduction_op "andAll" "\&" $template_file "BITWISE" "-1"
 124 #gen_reduction_op "orAll" "|" $template_file "BITWISE" "0"
 125 #gen_reduction_op "xorAll" "^" $template_file "BITWISE" "0"
 126 #gen_reduction_op "subAll" "-" $template_file "" "0"

The actual reduction generation is commented out, is that intentional?
Include addAll, minAll, maxAll, mullAll. For FP we need to be careful about rounding errors.

>> It is intentional. Currently, there is no support for orAll, xorAll and subAll. My hope was to uncomment these tests as we get the other patches merged.

For the reductive tests i would generate the simplest scalar binary function without a loop (like in the Java implementations) and push the looping logic into the assertReductionArraysEquals, which would accept the binary function e.g.  this is what the Java implementations do:

int rOp(int v, FBinOp f) {
    int[] vec = getElements();
    for (int i = 0; i < length(); i++) {
        v = f.apply(i, v, vec[i]);
    }
    return v;
}

public int addAll() {
    return rOp((int) 0, (i, a, b) -> (int) (a + b)); }

>> I understand that you want to factorize the reductions in one simple method. However it looks a bit complicated to do this way since you can't reach the vector from rOp. Or perhaps I missed something here?

Paul.


More information about the panama-dev mailing list