About JEP 338: Vector API

b.lacombe at lug.com b.lacombe at lug.com
Fri Feb 5 14:19:01 UTC 2021

About JEP 338: Vector API

A)  you write :
static final VectorSpecies<Float> SPECIES = FloatVector.SPECIES_256;

void vectorComputation(float[] a, float[] b, float[] c) {

    for (int i = 0; i < a.length; i += SPECIES.length()) {
        var m = SPECIES.indexInRange(i, a.length);
    // FloatVector va, vb, vc;
        var va = FloatVector.fromArray(SPECIES, a, i, m);
        var vb = FloatVector.fromArray(SPECIES, b, i, m);
        var vc = va.mul(va).
        vc.intoArray(c, i, m);
It is very complexe source code to write a simple (a*a+b )*-1

It 'll more easy, if we can write :
Where each operator (mul,add,neg) can make the convertion :
        var va=>FloatVector.fromArray(SPECIES, a, i, m) ...
Of course optimisation can be done  with a code like :
        void mul(a, ... buf){
                var va = cache.get(a);
                if( va==nul ){
                        va =  FloatVector.fromArray(SPECIES, a, i, m);
                //here va

2) A another optimisation can be make by preparing data  whith a "width" 
operator like :
then source is more easy to read, and less complex 
what did you think ?

3) And if we can upgrade java grammar, a code like this for matrix :
                c = FloatVector[[ a*a+b*-1 ]] 
would be ecxellent (where a,b,c must be final array) and so easy ....


Multimédia SOLUTIONS
Site Technologique de Marticot
33610 Cestas
Tel (33)
Téléchargez Windex GED : Gestion Electronique de Documents

More information about the panama-dev mailing list