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-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org