You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "msokolov (via GitHub)" <gi...@apache.org> on 2023/05/22 12:17:08 UTC

[GitHub] [lucene] msokolov commented on pull request #12311: Integrate the Incubating Panama Vector API

msokolov commented on PR #12311:
URL: https://github.com/apache/lucene/pull/12311#issuecomment-1557119416

   When I had tried this before I did something like:
   
   ```
   +    ShortVector acc = ShortVector.zero(SHORT_SPECIES);
   +    int l = 0;
   +    for (; l < BYTE_SPECIES.loopBound(len); l += BYTE_SPECIES.length()) {
   +      ByteVector va = ByteVector.fromArray(BYTE_SPECIES, a.bytes, aOffset + l);
   +      ByteVector vb = ByteVector.fromArray(BYTE_SPECIES, b.bytes, bOffset + l);
   +
   +      Vector<Short> vas = va.castShape(SHORT_SPECIES, 0);
   +      Vector<Short> vbs = vb.castShape(SHORT_SPECIES, 0);
   +      acc = acc.add(vas.mul(vbs));
   +
   +      vas = va.castShape(SHORT_SPECIES, 1);
   +      vbs = vb.castShape(SHORT_SPECIES, 1);
   +      acc = acc.add(vas.mul(vbs));
   +    }
   +    long total = acc.reduceLanesToLong(VectorOperators.ADD);
   ```
   
   I don't have perf numbers any more - no idea whether this is better than what you have already - probably not, but it might be worth trying castShape?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org