[Vector] RFR: reshape, resize, rebracket, cast

Kharbas, Kishor kishor.kharbas at intel.com
Thu Jan 17 19:36:33 UTC 2019


Hi,

I have new webrev which modifies the tests to use the new methods - http://cr.openjdk.java.net/~kkharbas/vector-api/webrev-reshape_etc.01
Incremental webrev - http://cr.openjdk.java.net/~kkharbas/vector-api/webrev-reshape_etc.01_to_base

To summarize the api changes made are:

Old methods:
    class Species<E> {

        /* E x S  ->  E' x S' */
        Vector<E> reshape(Vector<F> v)

        /* E x S  ->  E' x S */
        Vector<E> rebracket(Vector<F> v)

        /* E x S  ->  E x S' */
        Vector<E> resize(Vector<E> v)

        /* E x S  ->  E' x S' */
        Vector<E> cast(Vector<F> v)
    }

New methods:
    class Vector<E> {

        /* E x S  ->  E' x S' */
        /* was reshape() and rebracket() before */
        Vector<F> reinterpret(Species<F> s)

        /* E x S  ->  E x S' */
        /* was resize() before */
        Vector<E> reshape(Species<E> s)
    
        /* E x S  ->  E' x S' */
        Vector<F> cast(Species<F> s)
    }

Thanks,
Kishor

> -----Original Message-----
> From: Viswanathan, Sandhya
> Sent: Wednesday, January 16, 2019 12:33 PM
> To: Kharbas, Kishor <kishor.kharbas at intel.com>; panama-
> dev at openjdk.java.net; Brian Goetz <brian.goetz at oracle.com>; John Rose
> <john.r.rose at oracle.com>; Vladimir Ivanov
> <vladimir.x.ivanov at oracle.com>
> Cc: joe.darcy at oracle.com
> Subject: RE: [Vector] RFR: reshape, resize, rebracket, cast
> 
> 
> Adding Brian, John, Joe and Vladimir to the thread. Please do give your
> feedback on the patch from Kishor
> (http://cr.openjdk.java.net/~kkharbas/vector-api/webrev-reshape_etc)
> implementing the reinterpret API as suggested by Brian and Vladimir in
> thread https://mail.openjdk.java.net/pipermail/panama-dev/2018-
> December/003365.html.
> 
> Best Regards,
> Sandhya
> 
> 
> -----Original Message-----
> From: panama-dev [mailto:panama-dev-bounces at openjdk.java.net] On
> Behalf Of Kharbas, Kishor
> Sent: Wednesday, January 16, 2019 12:20 AM
> To: panama-dev at openjdk.java.net
> Subject: [Vector] RFR: reshape, resize, rebracket, cast
> 
> Hi,
> I have a patch which refactors the above methods as discussed in this thread
> - https://mail.openjdk.java.net/pipermail/panama-dev/2018-
> December/003365.html.
> 
> Please review the changes at - http://cr.openjdk.java.net/~kkharbas/vector-
> api/webrev-reshape_etc
> Generation of intrinsics and correct vector boxing elimination have been
> verified. In the next patch I will add changes to jtreg tests.
> 
> I wanted to bring forth one small issue(possibly) which programmers might
> face with this change -
> 
> We provide specialized types like IntVector, FloatVector, etc for users to
> define their vectors and they would be able to write code like this with
> previous methods,
>     FloatVector float256 = SPECIES_FLOAT256.cast(int256); Here FloatSpecies
> would always return FloatVector.
> 
> However with this change, since cast() is defined on a vector and takes
> species of a generic type, it cannot return a specialized Vector like IntVector
> or FloatVector. User has to explicitly cast the return vector from Vector<T>
> to specialized Vector or use a generic vector of corresponding element type.
> For example,
>     FloatVector float256 = (FloatVector)int256.cast(SPECIES_FLOAT256);
>   or
>     Vector<Float> float256 = int256.cast(SPECIES_FLOAT256);
> 
> I am not sure if this is even a problem, but I thought its worth mentioning.
> 
> Thanks
> Kishor


More information about the panama-dev mailing list